Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: ppapi/c/pp_var.h

Issue 6297018: Removed Doxygen groupings by ppb_, pp_, and ppp_. Added grouping by construct... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 /* Copyright (c) 2010 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_VAR_H_ 5 #ifndef PPAPI_C_PP_VAR_H_
6 #define PPAPI_C_PP_VAR_H_ 6 #define PPAPI_C_PP_VAR_H_
7 7
8 /** 8 /**
9 * @file 9 * @file
10 * Defines the API ... 10 * Defines the API ...
11 *
12 * @addtogroup PP
13 * @{
14 */ 11 */
15 12
16 #include "ppapi/c/pp_bool.h" 13 #include "ppapi/c/pp_bool.h"
17 #include "ppapi/c/pp_macros.h" 14 #include "ppapi/c/pp_macros.h"
18 #include "ppapi/c/pp_stdint.h" 15 #include "ppapi/c/pp_stdint.h"
19 16
17 /**
18 *
19 * @addtogroup Enums
20 * @{
21 */
20 typedef enum { 22 typedef enum {
21 PP_VARTYPE_UNDEFINED, 23 PP_VARTYPE_UNDEFINED,
22 PP_VARTYPE_NULL, 24 PP_VARTYPE_NULL,
23 PP_VARTYPE_BOOL, 25 PP_VARTYPE_BOOL,
24 PP_VARTYPE_INT32, 26 PP_VARTYPE_INT32,
25 PP_VARTYPE_DOUBLE, 27 PP_VARTYPE_DOUBLE,
26 PP_VARTYPE_STRING, 28 PP_VARTYPE_STRING,
27 PP_VARTYPE_OBJECT 29 PP_VARTYPE_OBJECT
28 } PP_VarType; 30 } PP_VarType;
31 /**
32 * @}
33 */
34
29 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_VarType, 4); 35 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_VarType, 4);
30 36
31 /** 37 /**
38 * @addtogroup Structs
39 * @{
40 */
41
42 /**
32 * Do not rely on having a predictable and reproducible 43 * Do not rely on having a predictable and reproducible
33 * int/double differentiation. 44 * int/double differentiation.
34 * JavaScript has a "number" type for holding a number, and 45 * JavaScript has a "number" type for holding a number, and
35 * does not differentiate between floating point and integer numbers. The 46 * does not differentiate between floating point and integer numbers. The
36 * JavaScript library will try to optimize operations by using integers 47 * JavaScript library will try to optimize operations by using integers
37 * when possible, but could end up with doubles depending on how the number 48 * when possible, but could end up with doubles depending on how the number
38 * was arrived at. 49 * was arrived at.
39 * 50 *
40 * Your best bet is to have a wrapper for variables 51 * Your best bet is to have a wrapper for variables
41 * that always gets out the type you expect, converting as necessary. 52 * that always gets out the type you expect, converting as necessary.
53 *
42 */ 54 */
43 struct PP_Var { 55 struct PP_Var {
44 PP_VarType type; 56 PP_VarType type;
45 57
46 /** Ensures @a value is aligned on an 8-byte boundary relative to the 58 /** Ensures @a value is aligned on an 8-byte boundary relative to the
47 * start of the struct. Some compilers align doubles on 8-byte boundaries 59 * start of the struct. Some compilers align doubles on 8-byte boundaries
48 * for 32-bit x86, and some align on 4-byte boundaries. 60 * for 32-bit x86, and some align on 4-byte boundaries.
49 */ 61 */
50 int32_t padding; 62 int32_t padding;
51 63
52 union { 64 union {
53 PP_Bool as_bool; 65 PP_Bool as_bool;
54 int32_t as_int; 66 int32_t as_int;
55 double as_double; 67 double as_double;
56 68
57 /** 69 /**
58 * Internal ID for strings and objects. The identifier is an opaque handle 70 * Internal ID for strings and objects. The identifier is an opaque handle
59 * assigned by the browser to the plugin. It is guaranteed never to be 0, 71 * assigned by the browser to the plugin. It is guaranteed never to be 0,
60 * so a plugin can initialize this ID to 0 to indicate a "NULL handle." 72 * so a plugin can initialize this ID to 0 to indicate a "NULL handle."
61 */ 73 */
62 int64_t as_id; 74 int64_t as_id;
63 } value; 75 } value;
64 }; 76 };
77 /**
78 * @}
79 */
80
65 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_Var, 16); 81 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_Var, 16);
66 82
83 /**
84 * @addtogroup Functions
85 * @{
86 */
67 PP_INLINE struct PP_Var PP_MakeUndefined() { 87 PP_INLINE struct PP_Var PP_MakeUndefined() {
68 struct PP_Var result = { PP_VARTYPE_UNDEFINED, 0, {PP_FALSE} }; 88 struct PP_Var result = { PP_VARTYPE_UNDEFINED, 0, {PP_FALSE} };
69 return result; 89 return result;
70 } 90 }
71 91
72 PP_INLINE struct PP_Var PP_MakeNull() { 92 PP_INLINE struct PP_Var PP_MakeNull() {
73 struct PP_Var result = { PP_VARTYPE_NULL, 0, {PP_FALSE} }; 93 struct PP_Var result = { PP_VARTYPE_NULL, 0, {PP_FALSE} };
74 return result; 94 return result;
75 } 95 }
76 96
77 PP_INLINE struct PP_Var PP_MakeBool(PP_Bool value) { 97 PP_INLINE struct PP_Var PP_MakeBool(PP_Bool value) {
78 struct PP_Var result = { PP_VARTYPE_BOOL, 0, {PP_FALSE} }; 98 struct PP_Var result = { PP_VARTYPE_BOOL, 0, {PP_FALSE} };
79 result.value.as_bool = value; 99 result.value.as_bool = value;
80 return result; 100 return result;
81 } 101 }
82 102
83 PP_INLINE struct PP_Var PP_MakeInt32(int32_t value) { 103 PP_INLINE struct PP_Var PP_MakeInt32(int32_t value) {
84 struct PP_Var result = { PP_VARTYPE_INT32, 0, {PP_FALSE} }; 104 struct PP_Var result = { PP_VARTYPE_INT32, 0, {PP_FALSE} };
85 result.value.as_int = value; 105 result.value.as_int = value;
86 return result; 106 return result;
87 } 107 }
88 108
89 PP_INLINE struct PP_Var PP_MakeDouble(double value) { 109 PP_INLINE struct PP_Var PP_MakeDouble(double value) {
90 struct PP_Var result = { PP_VARTYPE_DOUBLE, 0, {PP_FALSE} }; 110 struct PP_Var result = { PP_VARTYPE_DOUBLE, 0, {PP_FALSE} };
91 result.value.as_double = value; 111 result.value.as_double = value;
92 return result; 112 return result;
93 } 113 }
94
95 /** 114 /**
96 * @} 115 * @}
97 * End addtogroup PP
98 */ 116 */
117
99 #endif /* PPAPI_C_PP_VAR_H_ */ 118 #endif /* PPAPI_C_PP_VAR_H_ */
100 119
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698