| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef IPC_PARAM_TRAITS_MACROS_H_ | 5 #ifndef IPC_PARAM_TRAITS_MACROS_H_ |
| 6 #define IPC_PARAM_TRAITS_MACROS_H_ | 6 #define IPC_PARAM_TRAITS_MACROS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 // Traits generation for structs. | 10 // Traits generation for structs. |
| 11 #define IPC_STRUCT_TRAITS_BEGIN(struct_name) \ | 11 #define IPC_STRUCT_TRAITS_BEGIN(struct_name) \ |
| 12 namespace IPC { \ | 12 namespace IPC { \ |
| 13 template <> \ | 13 template <> \ |
| 14 struct IPC_MESSAGE_EXPORT ParamTraits<struct_name> { \ | 14 struct IPC_MESSAGE_EXPORT ParamTraits<struct_name> { \ |
| 15 typedef struct_name param_type; \ | 15 typedef struct_name param_type; \ |
| 16 static void Write(Message* m, const param_type& p); \ | 16 static void Write(Message* m, const param_type& p); \ |
| 17 static bool Read(const Message* m, void** iter, param_type* p); \ | 17 static bool Read(const Message* m, PickleIterator* iter, param_type* p); \ |
| 18 static void Log(const param_type& p, std::string* l); \ | 18 static void Log(const param_type& p, std::string* l); \ |
| 19 }; \ | 19 }; \ |
| 20 } | 20 } |
| 21 | 21 |
| 22 #define IPC_STRUCT_TRAITS_MEMBER(name) | 22 #define IPC_STRUCT_TRAITS_MEMBER(name) |
| 23 #define IPC_STRUCT_TRAITS_PARENT(type) | 23 #define IPC_STRUCT_TRAITS_PARENT(type) |
| 24 #define IPC_STRUCT_TRAITS_END() | 24 #define IPC_STRUCT_TRAITS_END() |
| 25 | 25 |
| 26 // Traits generation for enums. | 26 // Traits generation for enums. |
| 27 #define IPC_ENUM_TRAITS(enum_name) \ | 27 #define IPC_ENUM_TRAITS(enum_name) \ |
| 28 namespace IPC { \ | 28 namespace IPC { \ |
| 29 template <> \ | 29 template <> \ |
| 30 struct IPC_MESSAGE_EXPORT ParamTraits<enum_name> { \ | 30 struct IPC_MESSAGE_EXPORT ParamTraits<enum_name> { \ |
| 31 typedef enum_name param_type; \ | 31 typedef enum_name param_type; \ |
| 32 static void Write(Message* m, const param_type& p); \ | 32 static void Write(Message* m, const param_type& p); \ |
| 33 static bool Read(const Message* m, void** iter, param_type* p); \ | 33 static bool Read(const Message* m, PickleIterator* iter, param_type* p); \ |
| 34 static void Log(const param_type& p, std::string* l); \ | 34 static void Log(const param_type& p, std::string* l); \ |
| 35 }; \ | 35 }; \ |
| 36 } | 36 } |
| 37 | 37 |
| 38 #endif // IPC_PARAM_TRAITS_MACROS_H_ | 38 #endif // IPC_PARAM_TRAITS_MACROS_H_ |
| 39 | 39 |
| OLD | NEW |