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 <stdint.h> |
| 9 |
8 #include <string> | 10 #include <string> |
9 #include <vector> | 11 #include <vector> |
10 | 12 |
11 #include "ppapi/c/pp_var.h" | 13 #include "ppapi/c/pp_var.h" |
12 #include "ppapi/cpp/pass_ref.h" | 14 #include "ppapi/cpp/pass_ref.h" |
13 #include "ppapi/cpp/resource.h" | 15 #include "ppapi/cpp/resource.h" |
14 | 16 |
15 /// @file | 17 /// @file |
16 /// This file defines the API for handling the passing of data types between | 18 /// This file defines the API for handling the passing of data types between |
17 /// your module and the page. | 19 /// your module and the page. |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 /// The JavaScript runtime may convert between the two as needed, so the | 159 /// The JavaScript runtime may convert between the two as needed, so the |
158 /// distinction may not be relevant in all cases (int is really an | 160 /// distinction may not be relevant in all cases (int is really an |
159 /// optimization inside the runtime). So most of the time, you will want to | 161 /// optimization inside the runtime). So most of the time, you will want to |
160 /// check is_number(). | 162 /// check is_number(). |
161 /// | 163 /// |
162 /// @return true if this <code>Var</code> is a double, otherwise false. | 164 /// @return true if this <code>Var</code> is a double, otherwise false. |
163 bool is_double() const { return var_.type == PP_VARTYPE_DOUBLE; } | 165 bool is_double() const { return var_.type == PP_VARTYPE_DOUBLE; } |
164 | 166 |
165 /// This function determines if this <code>Var</code> is a number. | 167 /// This function determines if this <code>Var</code> is a number. |
166 /// | 168 /// |
167 /// @return true if this <code>Var</code> is an int32 or double number, | 169 /// @return true if this <code>Var</code> is an int32_t or double number, |
168 /// otherwise false. | 170 /// otherwise false. |
169 bool is_number() const { | 171 bool is_number() const { |
170 return var_.type == PP_VARTYPE_INT32 || | 172 return var_.type == PP_VARTYPE_INT32 || |
171 var_.type == PP_VARTYPE_DOUBLE; | 173 var_.type == PP_VARTYPE_DOUBLE; |
172 } | 174 } |
173 | 175 |
174 /// This function determines if this <code>Var</code> is an ArrayBuffer. | 176 /// This function determines if this <code>Var</code> is an ArrayBuffer. |
175 bool is_array_buffer() const { return var_.type == PP_VARTYPE_ARRAY_BUFFER; } | 177 bool is_array_buffer() const { return var_.type == PP_VARTYPE_ARRAY_BUFFER; } |
176 | 178 |
177 /// AsBool() converts this <code>Var</code> to a bool. Assumes the | 179 /// AsBool() converts this <code>Var</code> to a bool. Assumes the |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 private: | 316 private: |
315 // Prevent an arbitrary pointer argument from being implicitly converted to | 317 // Prevent an arbitrary pointer argument from being implicitly converted to |
316 // a bool at Var construction. If somebody makes such a mistake, (s)he will | 318 // a bool at Var construction. If somebody makes such a mistake, (s)he will |
317 // get a compilation error. | 319 // get a compilation error. |
318 Var(void* non_scriptable_object_pointer); | 320 Var(void* non_scriptable_object_pointer); |
319 }; | 321 }; |
320 | 322 |
321 } // namespace pp | 323 } // namespace pp |
322 | 324 |
323 #endif // PPAPI_CPP_VAR_H_ | 325 #endif // PPAPI_CPP_VAR_H_ |
OLD | NEW |