pp::VarArray Class Reference
Inheritance diagram for pp::VarArray:
![Inheritance graph](/web/20200922145242im_/https://developer.chrome.com/native-client/pepper_dev/cpp/classpp_1_1_var_array__inherit__graph.png)
Public Member Functions
VarArray () | |
VarArray (const Var &var) | |
VarArray (const PP_Var &var) | |
VarArray (const VarArray &other) | |
virtual | ~VarArray () |
VarArray & | operator= (const VarArray &other) |
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) |
Constructor & Destructor Documentation
Constructs a new array var.
pp::VarArray::VarArray | ( | const 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.
- Parameters:
-
[in] var An array var.
pp::VarArray::VarArray | ( | const PP_Var & | var | ) | [explicit] |
Constructs a VarArray
given a PP_Var
of type PP_VARTYPE_ARRAY.
- Parameters:
-
[in] var A PP_Var
of type PP_VARTYPE_ARRAY.
pp::VarArray::VarArray | ( | const VarArray & | other | ) |
Copy constructor.
virtual pp::VarArray::~VarArray | ( | ) | [virtual] |
Member Function Documentation
Var pp::VarArray::Get | ( | uint32_t | index | ) | const |
Gets an element from the array.
- Parameters:
-
[in] index An index indicating which element to return.
- Returns:
- The element at the specified position. If
index
is larger than or equal to the array length, an undefined var is returned.
uint32_t pp::VarArray::GetLength | ( | ) | const |
Gets the array length.
- Returns:
- The array length.
bool pp::VarArray::Set | ( | uint32_t | index, |
const Var & | value | ||
) |
Sets the value of an element in the array.
- Parameters:
-
[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 beindex
+ 1. Any position in the array that hasn't been set before is set to undefined, i.e.,PP_Var
of typePP_VARTYPE_UNDEFINED
.[in] value The value to set.
- Returns:
- A
bool
indicating whether the operation succeeds.
bool pp::VarArray::SetLength | ( | uint32_t | length | ) |
Sets the array length.
- Parameters:
-
[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. Iflength
is larger than its current value, undefined vars are appended to increase the array to the specified length.
- Returns:
- A
bool
indicating whether the operation succeeds.
The documentation for this class was generated from the following file: