Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 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 |
| 3 | * found in the LICENSE file. |
| 4 | */ |
| 5 | |
| 6 | /* From pp_bool.idl modified Thu Nov 1 13:48:33 2012. */ |
| 7 | |
| 8 | #ifndef PPAPI_C_PP_BOOL_H_ |
| 9 | #define PPAPI_C_PP_BOOL_H_ |
| 10 | |
| 11 | #include "ppapi/c/pp_macros.h" |
| 12 | |
| 13 | /** |
| 14 | * @file |
| 15 | * This file defines the <code>PP_Bool</code> enumeration for use in PPAPI C |
| 16 | * headers. |
| 17 | */ |
| 18 | |
| 19 | |
| 20 | /** |
| 21 | * @addtogroup Enums |
| 22 | * @{ |
| 23 | */ |
| 24 | /** |
| 25 | * The <code>PP_Bool</code> enum is a boolean value for use in PPAPI C headers. |
| 26 | * The standard bool type is not available to pre-C99 compilers, and is not |
| 27 | * guaranteed to be compatible between C and C++, whereas the PPAPI C headers |
| 28 | * can be included from C or C++ code. |
| 29 | */ |
| 30 | typedef enum { |
| 31 | PP_FALSE = 0, |
| 32 | PP_TRUE = 1 |
| 33 | } PP_Bool; |
| 34 | PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_Bool, 4); |
| 35 | /** |
| 36 | * @} |
| 37 | */ |
| 38 | |
| 39 | #ifdef __cplusplus |
| 40 | /** |
| 41 | * Converts a C++ "bool" type to a PP_Bool. |
| 42 | * |
| 43 | * @param[in] b A C++ "bool" type. |
| 44 | * |
| 45 | * @return A PP_Bool. |
| 46 | */ |
| 47 | inline PP_Bool PP_FromBool(bool b) { |
| 48 | return b ? PP_TRUE : PP_FALSE; |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * Converts a PP_Bool to a C++ "bool" type. |
| 53 | * |
| 54 | * @param[in] b A PP_Bool. |
| 55 | * |
| 56 | * @return A C++ "bool" type. |
| 57 | */ |
| 58 | inline bool PP_ToBool(PP_Bool b) { |
| 59 | return (b != PP_FALSE); |
| 60 | } |
| 61 | |
| 62 | #endif /* __cplusplus */ |
| 63 | |
| 64 | #endif /* PPAPI_C_PP_BOOL_H_ */ |
| 65 | |