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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 /// This function determines if this <code>Var</code> is an array. | 128 /// This function determines if this <code>Var</code> is an array. |
129 /// | 129 /// |
130 /// @return true if this <code>Var</code> is an array, otherwise false. | 130 /// @return true if this <code>Var</code> is an array, otherwise false. |
131 bool is_array() const { return var_.type == PP_VARTYPE_ARRAY; } | 131 bool is_array() const { return var_.type == PP_VARTYPE_ARRAY; } |
132 | 132 |
133 /// This function determines if this <code>Var</code> is a dictionary. | 133 /// This function determines if this <code>Var</code> is a dictionary. |
134 /// | 134 /// |
135 /// @return true if this <code>Var</code> is a dictionary, otherwise false. | 135 /// @return true if this <code>Var</code> is a dictionary, otherwise false. |
136 bool is_dictionary() const { return var_.type == PP_VARTYPE_DICTIONARY; } | 136 bool is_dictionary() const { return var_.type == PP_VARTYPE_DICTIONARY; } |
137 | 137 |
| 138 /// This function determines if this <code>Var</code> is a resource. |
| 139 /// |
| 140 /// @return true if this <code>Var</code> is a resource, otherwise false. |
| 141 bool is_resource() const { return var_.type == PP_VARTYPE_RESOURCE; } |
| 142 |
138 /// This function determines if this <code>Var</code> is an integer value. | 143 /// This function determines if this <code>Var</code> is an integer value. |
139 /// The <code>is_int</code> function returns the internal representation. | 144 /// The <code>is_int</code> function returns the internal representation. |
140 /// The JavaScript runtime may convert between the two as needed, so the | 145 /// The JavaScript runtime may convert between the two as needed, so the |
141 /// distinction may not be relevant in all cases (int is really an | 146 /// distinction may not be relevant in all cases (int is really an |
142 /// optimization inside the runtime). So most of the time, you will want | 147 /// optimization inside the runtime). So most of the time, you will want |
143 /// to check is_number(). | 148 /// to check is_number(). |
144 /// | 149 /// |
145 /// @return true if this <code>Var</code> is an integer, otherwise false. | 150 /// @return true if this <code>Var</code> is an integer, otherwise false. |
146 bool is_int() const { return var_.type == PP_VARTYPE_INT32; } | 151 bool is_int() const { return var_.type == PP_VARTYPE_INT32; } |
147 | 152 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 private: | 306 private: |
302 // Prevent an arbitrary pointer argument from being implicitly converted to | 307 // Prevent an arbitrary pointer argument from being implicitly converted to |
303 // a bool at Var construction. If somebody makes such a mistake, (s)he will | 308 // a bool at Var construction. If somebody makes such a mistake, (s)he will |
304 // get a compilation error. | 309 // get a compilation error. |
305 Var(void* non_scriptable_object_pointer); | 310 Var(void* non_scriptable_object_pointer); |
306 }; | 311 }; |
307 | 312 |
308 } // namespace pp | 313 } // namespace pp |
309 | 314 |
310 #endif // PPAPI_CPP_VAR_H_ | 315 #endif // PPAPI_CPP_VAR_H_ |
OLD | NEW |