Pepper_47_C++_interfaces
|
#include <var_dictionary.h>
Public Member Functions | |
VarDictionary () | |
Constructs a new dictionary var. More... | |
VarDictionary (const Var &var) | |
VarDictionary (const PP_Var &var) | |
VarDictionary (const VarDictionary &other) | |
Copy constructor. More... | |
virtual | ~VarDictionary () |
VarDictionary & | operator= (const VarDictionary &other) |
Assignment operator. More... | |
virtual Var & | operator= (const Var &other) |
Var | Get (const Var &key) const |
bool | Set (const Var &key, const Var &value) |
void | Delete (const Var &key) |
bool | HasKey (const Var &key) const |
VarArray | GetKeys () const |
![]() | |
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_dictionary.h.
pp::VarDictionary::VarDictionary | ( | ) |
Constructs a new dictionary var.
Definition at line 21 of file var_dictionary.cc.
References PP_NOTREACHED, and pp::Var::var_.
|
explicit |
Constructs a VarDictionary
given a var for which is_dictionary() is true. This will refer to the same dictionary var, but allow you to access methods specific to dictionary.
[in] | var | A dictionary var. |
Definition at line 28 of file var_dictionary.cc.
References pp::Var::is_dictionary(), pp::Var::operator=(), PP_NOTREACHED, and pp::Var::Var().
|
explicit |
Constructs a VarDictionary
given a PP_Var
of type PP_VARTYPE_DICTIONARY.
[in] | var | A PP_Var of type PP_VARTYPE_DICTIONARY. |
Definition at line 37 of file var_dictionary.cc.
References pp::Var::operator=(), PP_NOTREACHED, and pp::Var::Var().
pp::VarDictionary::VarDictionary | ( | const VarDictionary & | other | ) |
Copy constructor.
Definition at line 46 of file var_dictionary.cc.
|
virtual |
Definition at line 50 of file var_dictionary.cc.
void pp::VarDictionary::Delete | ( | const Var & | key | ) |
Deletes the specified key and its associated value, if the key exists.
[in] | key | A string var. |
Definition at line 86 of file var_dictionary.cc.
References pp::Var::pp_var(), and pp::Var::var_.
Gets the value associated with the specified key.
[in] | key | A string var. |
key
. If key
is not a string var, or it doesn't exist in the dictionary, an undefined var is returned. Definition at line 69 of file var_dictionary.cc.
References pp::PASS_REF, pp::Var::pp_var(), pp::Var::Var(), and pp::Var::var_.
VarArray pp::VarDictionary::GetKeys | ( | ) | const |
Gets all the keys in the dictionary.
Definition at line 99 of file var_dictionary.cc.
References pp::Var::is_array(), pp::PASS_REF, and pp::Var::var_.
Checks whether a key exists.
[in] | key | A string var. |
bool
indicating whether the key exists. Definition at line 91 of file var_dictionary.cc.
References pp::Var::pp_var(), and pp::Var::var_.
VarDictionary & pp::VarDictionary::operator= | ( | const VarDictionary & | other | ) |
Assignment operator.
Definition at line 53 of file var_dictionary.cc.
References pp::Var::operator=().
The Var
assignment operator is overridden here so that we can check for assigning a non-dictionary var to a VarDictionary
.
[in] | other | The dictionary var to be assigned. |
VarDictionary
(as a Var
&). Reimplemented from pp::Var.
Definition at line 59 of file var_dictionary.cc.
References pp::Var::is_dictionary(), pp::Var::operator=(), PP_NOTREACHED, and pp::Var::Var().
Sets the value associated with the specified key.
[in] | key | A string var. If this key hasn't existed in the dictionary, it is added and associated with value ; otherwise, the previous value is replaced with value . |
[in] | value | The value to set. |
bool
indicating whether the operation succeeds. Definition at line 78 of file var_dictionary.cc.
References pp::Var::pp_var(), and pp::Var::var_.