dbus: Property<>.value() should be const
[chromium-blink-merge.git] / ipc / param_traits_log_macros.h
blobb2d1f2ea17ad1267b78321d3fa8efe190dd2c46c
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef IPC_PARAM_TRAITS_LOG_MACROS_H_
6 #define IPC_PARAM_TRAITS_LOG_MACROS_H_
7 #pragma once
9 #include <string>
11 // Null out all the macros that need nulling.
12 #include "ipc/ipc_message_null_macros.h"
14 // STRUCT declarations cause corresponding STRUCT_TRAITS declarations to occur.
15 #undef IPC_STRUCT_BEGIN
16 #undef IPC_STRUCT_BEGIN_WITH_PARENT
17 #undef IPC_STRUCT_MEMBER
18 #undef IPC_STRUCT_END
19 #define IPC_STRUCT_BEGIN_WITH_PARENT(struct_name, parent) \
20 IPC_STRUCT_BEGIN(struct_name)
21 #define IPC_STRUCT_BEGIN(struct_name) IPC_STRUCT_TRAITS_BEGIN(struct_name)
22 #define IPC_STRUCT_MEMBER(type, name) IPC_STRUCT_TRAITS_MEMBER(name)
23 #define IPC_STRUCT_END() IPC_STRUCT_TRAITS_END()
25 // Set up so next include will generate log methods.
26 #undef IPC_STRUCT_TRAITS_BEGIN
27 #undef IPC_STRUCT_TRAITS_MEMBER
28 #undef IPC_STRUCT_TRAITS_PARENT
29 #undef IPC_STRUCT_TRAITS_END
30 #define IPC_STRUCT_TRAITS_BEGIN(struct_name) \
31 void ParamTraits<struct_name>::Log(const param_type& p, std::string* l) { \
32 bool needs_comma = false; \
33 l->append("(");
34 #define IPC_STRUCT_TRAITS_MEMBER(name) \
35 if (needs_comma) \
36 l->append(", "); \
37 LogParam(p.name, l); \
38 needs_comma = true;
39 #define IPC_STRUCT_TRAITS_PARENT(type) \
40 if (needs_comma) \
41 l->append(", "); \
42 ParamTraits<type>::Log(p, l); \
43 needs_comma = true;
44 #define IPC_STRUCT_TRAITS_END() \
45 l->append(")"); \
48 #undef IPC_ENUM_TRAITS
49 #define IPC_ENUM_TRAITS(enum_name) \
50 void ParamTraits<enum_name>::Log(const param_type& p, std::string* l) { \
51 LogParam(static_cast<int>(p), l); \
54 #endif // IPC_PARAM_TRAITS_LOG_MACROS_H_