Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ppapi / c / pp_bool.h
blob549faea40ac260d0d9c0012379c0c3db2a32c5df
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 */
6 /* From pp_bool.idl modified Thu Nov 1 13:48:33 2012. */
8 #ifndef PPAPI_C_PP_BOOL_H_
9 #define PPAPI_C_PP_BOOL_H_
11 #include "ppapi/c/pp_macros.h"
13 /**
14 * @file
15 * This file defines the <code>PP_Bool</code> enumeration for use in PPAPI C
16 * headers.
20 /**
21 * @addtogroup Enums
22 * @{
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.
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 * @}
39 #ifdef __cplusplus
40 /**
41 * Converts a C++ "bool" type to a PP_Bool.
43 * @param[in] b A C++ "bool" type.
45 * @return A PP_Bool.
47 inline PP_Bool PP_FromBool(bool b) {
48 return b ? PP_TRUE : PP_FALSE;
51 /**
52 * Converts a PP_Bool to a C++ "bool" type.
54 * @param[in] b A PP_Bool.
56 * @return A C++ "bool" type.
58 inline bool PP_ToBool(PP_Bool b) {
59 return (b != PP_FALSE);
62 #endif /* __cplusplus */
64 #endif /* PPAPI_C_PP_BOOL_H_ */