| OLD | NEW |
| 1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 PPAPI_C_PP_BOOL_H_ | 5 #ifndef PPAPI_C_PP_BOOL_H_ |
| 6 #define PPAPI_C_PP_BOOL_H_ | 6 #define PPAPI_C_PP_BOOL_H_ |
| 7 | 7 |
| 8 #include "ppapi/c/pp_macros.h" | 8 #include "ppapi/c/pp_macros.h" |
| 9 | 9 |
| 10 /** | 10 /** |
| 11 * @file | 11 * @file |
| 12 * This file defines the <code>PP_Bool</code> enumeration for use in PPAPI C | 12 * This file defines the <code>PP_Bool</code> enumeration for use in PPAPI C |
| 13 * headers. | 13 * headers. |
| 14 */ | 14 */ |
| 15 | 15 |
| 16 /** | 16 /** |
| 17 * | 17 * |
| 18 * @addtogroup Enums | 18 * @addtogroup Enums |
| 19 * @{ | 19 * @{ |
| 20 */ | 20 */ |
| 21 | 21 |
| 22 /** | 22 /** |
| 23 * The <code>PP_Bool</code> enum is a boolean value for use in PPAPI C headers. | 23 * The <code>PP_Bool</code> enum is a boolean value for use in PPAPI C headers. |
| 24 * The standard bool type is not available to pre-C99 compilers, and is not | 24 * The standard bool type is not available to pre-C99 compilers, and is not |
| 25 * guaranteed to be compatible between C and C++, whereas the PPAPI C | 25 * guaranteed to be compatible between C and C++, whereas the PPAPI C headers |
| 26 * headers can be included from C or C++ code. | 26 * can be included from C or C++ code. |
| 27 */ | 27 */ |
| 28 typedef enum { | 28 typedef enum { |
| 29 PP_FALSE = 0, | 29 PP_FALSE = 0, |
| 30 PP_TRUE = 1 | 30 PP_TRUE = 1 |
| 31 } PP_Bool; | 31 } PP_Bool; |
| 32 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Bool, 4); | 32 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Bool, 4); |
| 33 /** | 33 /** |
| 34 * @} | 34 * @} |
| 35 */ | 35 */ |
| 36 | 36 |
| 37 #ifdef __cplusplus | 37 #ifdef __cplusplus |
| 38 /** | 38 /** |
| 39 * Converts a C++ "bool" type to a PP_Bool. | 39 * Converts a C++ "bool" type to a PP_Bool. |
| 40 */ | 40 */ |
| 41 inline PP_Bool PP_FromBool(bool b) { | 41 inline PP_Bool PP_FromBool(bool b) { |
| 42 return b ? PP_TRUE : PP_FALSE; | 42 return b ? PP_TRUE : PP_FALSE; |
| 43 } | 43 } |
| 44 | 44 |
| 45 /** | 45 /** |
| 46 * Converts a PP_Bool to a C++ "bool" type. | 46 * Converts a PP_Bool to a C++ "bool" type. |
| 47 */ | 47 */ |
| 48 inline bool PP_ToBool(PP_Bool b) { | 48 inline bool PP_ToBool(PP_Bool b) { |
| 49 return (b != PP_FALSE); | 49 return (b != PP_FALSE); |
| 50 } | 50 } |
| 51 #endif // __cplusplus | 51 #endif // __cplusplus |
| 52 | 52 |
| 53 #endif /* PPAPI_C_PP_BOOL_H_ */ | 53 #endif /* PPAPI_C_PP_BOOL_H_ */ |
| 54 | 54 |
| OLD | NEW |