OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_CPP_VAR_H_ | 5 #ifndef PPAPI_CPP_VAR_H_ |
6 #define PPAPI_CPP_VAR_H_ | 6 #define PPAPI_CPP_VAR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 /// @return true if this <code>Var</code> is a bool, otherwise false. | 112 /// @return true if this <code>Var</code> is a bool, otherwise false. |
113 bool is_bool() const { return var_.type == PP_VARTYPE_BOOL; } | 113 bool is_bool() const { return var_.type == PP_VARTYPE_BOOL; } |
114 | 114 |
115 /// This function determines if this <code>Var</code> is a string value. | 115 /// This function determines if this <code>Var</code> is a string value. |
116 /// | 116 /// |
117 /// @return true if this <code>Var</code> is a string, otherwise false. | 117 /// @return true if this <code>Var</code> is a string, otherwise false. |
118 bool is_string() const { return var_.type == PP_VARTYPE_STRING; } | 118 bool is_string() const { return var_.type == PP_VARTYPE_STRING; } |
119 | 119 |
120 /// This function determines if this <code>Var</code> is an object. | 120 /// This function determines if this <code>Var</code> is an object. |
121 /// | 121 /// |
122 /// @return true if this <code>Var</code> is an object, otherwise false. | 122 /// @return true if this <code>Var</code> is an object, otherwise false. |
123 bool is_object() const { return var_.type == PP_VARTYPE_OBJECT; } | 123 bool is_object() const { return var_.type == PP_VARTYPE_OBJECT; } |
124 | 124 |
| 125 /// This function determines if this <code>Var</code> is an array. |
| 126 /// |
| 127 /// @return true if this <code>Var</code> is an array, otherwise false. |
| 128 bool is_array() const { return var_.type == PP_VARTYPE_ARRAY; } |
| 129 |
| 130 /// This function determines if this <code>Var</code> is a dictionary. |
| 131 /// |
| 132 /// @return true if this <code>Var</code> is a dictinoary, otherwise false. |
| 133 bool is_dictionary() const { return var_.type == PP_VARTYPE_DICTIONARY; } |
| 134 |
125 /// This function determines if this <code>Var</code> is an integer value. | 135 /// This function determines if this <code>Var</code> is an integer value. |
126 /// The <code>is_int</code> function returns the internal representation. | 136 /// The <code>is_int</code> function returns the internal representation. |
127 /// The JavaScript runtime may convert between the two as needed, so the | 137 /// The JavaScript runtime may convert between the two as needed, so the |
128 /// distinction may not be relevant in all cases (int is really an | 138 /// distinction may not be relevant in all cases (int is really an |
129 /// optimization inside the runtime). So most of the time, you will want | 139 /// optimization inside the runtime). So most of the time, you will want |
130 /// to check is_number(). | 140 /// to check is_number(). |
131 /// | 141 /// |
132 /// @return true if this <code>Var</code> is an integer, otherwise false. | 142 /// @return true if this <code>Var</code> is an integer, otherwise false. |
133 bool is_int() const { return var_.type == PP_VARTYPE_INT32; } | 143 bool is_int() const { return var_.type == PP_VARTYPE_INT32; } |
134 | 144 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 private: | 298 private: |
289 // Prevent an arbitrary pointer argument from being implicitly converted to | 299 // Prevent an arbitrary pointer argument from being implicitly converted to |
290 // a bool at Var construction. If somebody makes such a mistake, (s)he will | 300 // a bool at Var construction. If somebody makes such a mistake, (s)he will |
291 // get a compilation error. | 301 // get a compilation error. |
292 Var(void* non_scriptable_object_pointer); | 302 Var(void* non_scriptable_object_pointer); |
293 }; | 303 }; |
294 | 304 |
295 } // namespace pp | 305 } // namespace pp |
296 | 306 |
297 #endif // PPAPI_CPP_VAR_H_ | 307 #endif // PPAPI_CPP_VAR_H_ |
OLD | NEW |