OLD | NEW |
1 // Copyright (c) 2012 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 GetSize(base::PickleSizer* sizer, \ |
| 17 const param_type& p); \ |
16 static void Write(base::Pickle* m, const param_type& p); \ | 18 static void Write(base::Pickle* m, const param_type& p); \ |
17 static bool Read(const base::Pickle* m, \ | 19 static bool Read(const base::Pickle* m, \ |
18 base::PickleIterator* iter, \ | 20 base::PickleIterator* iter, \ |
19 param_type* p); \ | 21 param_type* p); \ |
20 static void Log(const param_type& p, std::string* l); \ | 22 static void Log(const param_type& p, std::string* l); \ |
21 }; \ | 23 }; \ |
22 } | 24 } |
23 | 25 |
24 #define IPC_STRUCT_TRAITS_MEMBER(name) | 26 #define IPC_STRUCT_TRAITS_MEMBER(name) |
25 #define IPC_STRUCT_TRAITS_PARENT(type) | 27 #define IPC_STRUCT_TRAITS_PARENT(type) |
(...skipping 20 matching lines...) Expand all Loading... |
46 IPC_ENUM_TRAITS_VALIDATE( \ | 48 IPC_ENUM_TRAITS_VALIDATE( \ |
47 type, (static_cast<int>(value) >= static_cast<int>(minvalue) && \ | 49 type, (static_cast<int>(value) >= static_cast<int>(minvalue) && \ |
48 static_cast<int>(value) <= static_cast<int>(maxvalue))) | 50 static_cast<int>(value) <= static_cast<int>(maxvalue))) |
49 | 51 |
50 // Traits generation for enums. This macro may be redefined later. | 52 // Traits generation for enums. This macro may be redefined later. |
51 #define IPC_ENUM_TRAITS_VALIDATE(enum_name, validation_expression) \ | 53 #define IPC_ENUM_TRAITS_VALIDATE(enum_name, validation_expression) \ |
52 namespace IPC { \ | 54 namespace IPC { \ |
53 template <> \ | 55 template <> \ |
54 struct IPC_MESSAGE_EXPORT ParamTraits<enum_name> { \ | 56 struct IPC_MESSAGE_EXPORT ParamTraits<enum_name> { \ |
55 typedef enum_name param_type; \ | 57 typedef enum_name param_type; \ |
| 58 static void GetSize(base::PickleSizer* sizer, \ |
| 59 const param_type& p); \ |
56 static void Write(base::Pickle* m, const param_type& p); \ | 60 static void Write(base::Pickle* m, const param_type& p); \ |
57 static bool Read(const base::Pickle* m, \ | 61 static bool Read(const base::Pickle* m, \ |
58 base::PickleIterator* iter, \ | 62 base::PickleIterator* iter, \ |
59 param_type* p); \ | 63 param_type* p); \ |
60 static void Log(const param_type& p, std::string* l); \ | 64 static void Log(const param_type& p, std::string* l); \ |
61 }; \ | 65 }; \ |
62 } | 66 } |
63 | 67 |
64 #endif // IPC_PARAM_TRAITS_MACROS_H_ | 68 #endif // IPC_PARAM_TRAITS_MACROS_H_ |
65 | 69 |
OLD | NEW |