Pepper_47_C++_interfaces
|
#include <var_array.h>
Public Member Functions | |
VarArray () | |
Constructs a new array var. More... | |
VarArray (const Var &var) | |
VarArray (const PP_Var &var) | |
VarArray (const VarArray &other) | |
Copy constructor. More... | |
virtual | ~VarArray () |
VarArray & | operator= (const VarArray &other) |
Assignment operator. More... | |
virtual Var & | operator= (const Var &other) |
Var | Get (uint32_t index) const |
bool | Set (uint32_t index, const Var &value) |
uint32_t | GetLength () const |
bool | SetLength (uint32_t length) |
![]() | |
Var () | |
Var (Null) | |
A constructor used to create a Var of type Null . More... | |
Var (bool b) | |
Var (int32_t i) | |
Var (double d) | |
Var (const char *utf8_str) | |
A constructor used to create a UTF-8 character Var . More... | |
Var (const std::string &utf8_str) | |
A constructor used to create a UTF-8 character Var . More... | |
Var (const pp::Resource &resource) | |
A constructor used to create a resource Var . More... | |
Var (PassRef, const PP_Var &var) | |
Var (const PP_Var &var) | |
A constructor that increments the reference count. More... | |
Var (DontManage, const PP_Var &var) | |
Var (const Var &other) | |
A constructor for copying a Var . More... | |
virtual | ~Var () |
Destructor. More... | |
bool | operator== (const Var &other) const |
bool | is_undefined () const |
bool | is_null () const |
bool | is_bool () const |
bool | is_string () const |
bool | is_object () const |
bool | is_array () const |
bool | is_dictionary () const |
bool | is_resource () const |
bool | is_int () const |
bool | is_double () const |
bool | is_number () const |
bool | is_array_buffer () const |
This function determines if this Var is an ArrayBuffer. More... | |
bool | AsBool () const |
int32_t | AsInt () const |
double | AsDouble () const |
std::string | AsString () const |
pp::Resource | AsResource () const |
const PP_Var & | pp_var () const |
PP_Var | Detach () |
std::string | DebugString () const |
Additional Inherited Members | |
![]() | |
PP_Var | var_ |
bool | is_managed_ |
Definition at line 17 of file var_array.h.
pp::VarArray::VarArray | ( | ) |
Constructs a new array var.
Definition at line 21 of file var_array.cc.
References PP_NOTREACHED, and pp::Var::var_.
|
explicit |
Constructs a VarArray
given a var for which is_array() is true. This will refer to the same array var, but allow you to access methods specific to arrays.
[in] | var | An array var. |
Definition at line 28 of file var_array.cc.
References pp::Var::is_array(), pp::Var::operator=(), PP_NOTREACHED, and pp::Var::Var().
|
explicit |
Constructs a VarArray
given a PP_Var
of type PP_VARTYPE_ARRAY.
[in] | var | A PP_Var of type PP_VARTYPE_ARRAY. |
Definition at line 37 of file var_array.cc.
References pp::Var::operator=(), PP_NOTREACHED, and pp::Var::Var().
pp::VarArray::VarArray | ( | const VarArray & | other | ) |
Copy constructor.
Definition at line 46 of file var_array.cc.
|
virtual |
Definition at line 49 of file var_array.cc.
Var pp::VarArray::Get | ( | uint32_t | index | ) | const |
Gets an element from the array.
[in] | index | An index indicating which element to return. |
index
is larger than or equal to the array length, an undefined var is returned. Definition at line 67 of file var_array.cc.
References pp::PASS_REF, pp::Var::Var(), and pp::Var::var_.
Referenced by pp::ext::internal::ArrayVarOutputAdapterWithStorage< T >::output().
uint32_t pp::VarArray::GetLength | ( | ) | const |
Gets the array length.
Definition at line 82 of file var_array.cc.
References pp::Var::var_.
Referenced by pp::ext::internal::ArrayVarOutputAdapterWithStorage< T >::output().
The Var
assignment operator is overridden here so that we can check for assigning a non-array var to a VarArray
.
[in] | other | The array var to be assigned. |
Reimplemented from pp::Var.
Definition at line 57 of file var_array.cc.
References pp::Var::is_array(), pp::Var::operator=(), PP_NOTREACHED, and pp::Var::Var().
Sets the value of an element in the array.
[in] | index | An index indicating which element to modify. If index is larger than or equal to the array length, the length is updated to be index + 1. Any position in the array that hasn't been set before is set to undefined, i.e., PP_Var of type PP_VARTYPE_UNDEFINED . |
[in] | value | The value to set. |
bool
indicating whether the operation succeeds. Definition at line 74 of file var_array.cc.
References pp::Var::pp_var(), and pp::Var::var_.
bool pp::VarArray::SetLength | ( | uint32_t | length | ) |
Sets the array length.
[in] | length | The new array length. If length is smaller than its current value, the array is truncated to the new length; any elements that no longer fit are removed. If length is larger than its current value, undefined vars are appended to increase the array to the specified length. |
bool
indicating whether the operation succeeds. Definition at line 89 of file var_array.cc.
References pp::Var::var_.