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