- add sources.
[platform/framework/web/crosswalk.git] / src / ppapi / api / pp_bool.idl
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 /**
7  * This file defines the <code>PP_Bool</code> enumeration for use in PPAPI C
8  * headers.
9  */
10
11 /**
12  * The <code>PP_Bool</code> enum is a boolean value for use in PPAPI C headers.
13  * The standard bool type is not available to pre-C99 compilers, and is not
14  * guaranteed to be compatible between C and C++, whereas the PPAPI C headers
15  * can be included from C or C++ code.
16  */
17 [assert_size(4)] enum PP_Bool {
18   PP_FALSE = 0,
19   PP_TRUE  = 1
20 };
21
22 #inline cc
23 /**
24  * Converts a C++ "bool" type to a PP_Bool.
25  *
26  * @param[in] b A C++ "bool" type.
27  *
28  * @return A PP_Bool.
29  */
30 inline PP_Bool PP_FromBool(bool b) {
31   return b ? PP_TRUE : PP_FALSE;
32 }
33
34 /**
35  * Converts a PP_Bool to a C++ "bool" type.
36  *
37  * @param[in] b A PP_Bool.
38  *
39  * @return A C++ "bool" type.
40  */
41 inline bool PP_ToBool(PP_Bool b) {
42   return (b != PP_FALSE);
43 }
44 #endinl