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 LIBRARIES_UTILS_MACROS_H_ | 5 #ifndef LIBRARIES_UTILS_MACROS_H_ |
6 #define LIBRARIES_UTILS_MACROS_H_ | 6 #define LIBRARIES_UTILS_MACROS_H_ |
7 | 7 |
8 /** | 8 /** |
9 * A macro to disallow the evil copy constructor and operator= functions | 9 * A macro to disallow the evil copy constructor and operator= functions |
10 * This should be used in the private: declarations for a class. | 10 * This should be used in the private: declarations for a class. |
11 */ | 11 */ |
12 #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ | 12 #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ |
13 TypeName(const TypeName&); \ | 13 TypeName(const TypeName&); \ |
14 void operator=(const TypeName&) | 14 void operator=(const TypeName&) |
15 | 15 |
| 16 /** returns the size of a member of a struct. */ |
| 17 #define MEMBER_SIZE(struct_name, member) sizeof(((struct_name*)0)->member) |
16 | 18 |
17 /** | 19 /** |
18 * Macros to prevent name mangling of defnitions, allowing them to be | 20 * Macros to prevent name mangling of defnitions, allowing them to be |
19 * referenced from C. | 21 * referenced from C. |
20 */ | 22 */ |
21 #ifdef __cplusplus | 23 #ifdef __cplusplus |
22 # define EXTERN_C_BEGIN extern "C" { | 24 # define EXTERN_C_BEGIN extern "C" { |
23 # define EXTERN_C_END } | 25 # define EXTERN_C_END } |
24 #else | 26 #else |
25 # define EXTERN_C_BEGIN | 27 # define EXTERN_C_BEGIN |
26 # define EXEERN_C_END | 28 # define EXEERN_C_END |
27 #endif /* __cplusplus */ | 29 #endif /* __cplusplus */ |
28 | 30 |
29 | 31 |
30 #endif /* LIBRARIES_UTILS_MACROS_H_ */ | 32 #endif /* LIBRARIES_UTILS_MACROS_H_ */ |
OLD | NEW |