OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 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. |
| 4 |
| 5 #include "chrome/common/common_param_traits.h" |
| 6 |
| 7 #define IPC_MESSAGE_IMPL |
| 8 #include "ipc/ipc_message_tree.h" |
| 9 |
| 10 // Null out all the macros that need nulling. |
| 11 #include "ipc/ipc_message_null_macros.h" |
| 12 |
| 13 // Generate constructors. |
| 14 #undef IPC_STRUCT_FIRST |
| 15 #undef IPC_STRUCT_NEXT |
| 16 #undef IPC_STRUCT_LAST |
| 17 #define IPC_STRUCT_FIRST(type, name, init) IPC_STRUCT_FIRST_##init(type,name) |
| 18 #define IPC_STRUCT_NEXT(type, name, init) IPC_STRUCT_NEXT_##init(type, name) |
| 19 #define IPC_STRUCT_LAST(type, name, init) IPC_STRUCT_LAST_##init(type, name) |
| 20 #define IPC_STRUCT_FIRST_INIT(type, name) \ |
| 21 IPC_STRUCT_NAME::IPC_STRUCT_NAME () : name(0) |
| 22 #define IPC_STRUCT_NEXT_INIT(type, name) , name(0) |
| 23 #define IPC_STRUCT_LAST_INIT(type, name) , name(0) {} |
| 24 #define IPC_STRUCT_FIRST_NOINIT(type, name) \ |
| 25 error "first member must be initialized" |
| 26 #define IPC_STRUCT_NEXT_NOINIT(type, name) |
| 27 #define IPC_STRUCT_LAST_NOINIT(type, name) {} |
| 28 #include "ipc/ipc_message_tree.h" |
| 29 |
| 30 // Generate destructors. |
| 31 #undef IPC_STRUCT_FIRST |
| 32 #undef IPC_STRUCT_NEXT |
| 33 #undef IPC_STRUCT_LAST |
| 34 #define IPC_STRUCT_FIRST(type, name, init) \ |
| 35 IPC_STRUCT_NAME::~IPC_STRUCT_NAME () {} |
| 36 #define IPC_STRUCT_NEXT(type, name, init) |
| 37 #define IPC_STRUCT_LAST(type, name, init) |
| 38 #include "ipc/ipc_message_tree.h" |
| 39 |
| 40 namespace IPC { |
| 41 |
| 42 // Generate param traits write methods. |
| 43 #undef IPC_STRUCT_FIRST |
| 44 #undef IPC_STRUCT_NEXT |
| 45 #undef IPC_STRUCT_LAST |
| 46 #undef IPC_STRUCT_MEMBER |
| 47 #define IPC_STRUCT_FIRST(type, name, init) \ |
| 48 void ParamTraits<IPC_STRUCT_NAME>:: \ |
| 49 Write(Message* m, const param_type& p) { \ |
| 50 IPC_STRUCT_MEMBER(type, name) |
| 51 #define IPC_STRUCT_NEXT(type, name, init) IPC_STRUCT_MEMBER(type, name) |
| 52 #define IPC_STRUCT_LAST(type, name, init) IPC_STRUCT_MEMBER(type, name) } |
| 53 #define IPC_STRUCT_MEMBER(type, name) WriteParam(m, p.name); |
| 54 #include "ipc/ipc_message_tree.h" |
| 55 |
| 56 // Generate param traits read methods. |
| 57 #undef IPC_STRUCT_FIRST |
| 58 #undef IPC_STRUCT_NEXT |
| 59 #undef IPC_STRUCT_LAST |
| 60 #undef IPC_STRUCT_MEMBER |
| 61 #define IPC_STRUCT_FIRST(type, name, init) \ |
| 62 bool ParamTraits<IPC_STRUCT_NAME>:: \ |
| 63 Read(const Message* m, void** iter, param_type* p) { \ |
| 64 return IPC_STRUCT_MEMBER(type, name) |
| 65 #define IPC_STRUCT_NEXT(type, name, init) && IPC_STRUCT_MEMBER(type, name) |
| 66 #define IPC_STRUCT_LAST(type, name, init) && IPC_STRUCT_MEMBER(type, name); } |
| 67 #define IPC_STRUCT_MEMBER(type, name) ReadParam(m, iter, &p->name) |
| 68 #include "ipc/ipc_message_tree.h" |
| 69 |
| 70 // Generate param traits log methods. |
| 71 #undef IPC_STRUCT_FIRST |
| 72 #undef IPC_STRUCT_NEXT |
| 73 #undef IPC_STRUCT_LAST |
| 74 #undef IPC_STRUCT_MEMBER |
| 75 #define IPC_STRUCT_FIRST(type, name, init) \ |
| 76 void ParamTraits<IPC_STRUCT_NAME>:: \ |
| 77 Log(const param_type& p, std::string* l) { \ |
| 78 l->append("("); IPC_STRUCT_MEMBER(type, name) |
| 79 #define IPC_STRUCT_NEXT(type, name, init) \ |
| 80 l->append(", "); IPC_STRUCT_MEMBER(type, name) |
| 81 #define IPC_STRUCT_LAST(type, name, init) \ |
| 82 IPC_STRUCT_NEXT(type, name, init) l->append(")"); } |
| 83 #define IPC_STRUCT_MEMBER(type, name) LogParam(p.name, l); |
| 84 #include "ipc/ipc_message_tree.h" |
| 85 |
| 86 } // namespace IPC |
OLD | NEW |