Inheritance diagram for pp::VarDictionary:
Public Member Functions
VarDictionary () | |
VarDictionary (const Var &var) | |
VarDictionary (const PP_Var &var) | |
VarDictionary (const VarDictionary &other) | |
virtual | ~VarDictionary () |
VarDictionary & | operator= (const VarDictionary &other) |
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 |
Constructor & Destructor Documentation
Constructs a new dictionary var.
pp::VarDictionary::VarDictionary | ( | const 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.
- Parameters:
[in] var A dictionary var.
pp::VarDictionary::VarDictionary | ( | const PP_Var & | var | ) | [explicit] |
Constructs a VarDictionary
given a PP_Var
of type PP_VARTYPE_DICTIONARY.
- Parameters:
[in] var A PP_Var
of type PP_VARTYPE_DICTIONARY.
pp::VarDictionary::VarDictionary | ( | const VarDictionary & | other | ) |
Copy constructor.
virtual pp::VarDictionary::~VarDictionary | ( | ) | [virtual] |
Member Function Documentation
void pp::VarDictionary::Delete | ( | const Var & | key | ) |
Deletes the specified key and its associated value, if the key exists.
- Parameters:
[in] key A string var.
Var pp::VarDictionary::Get | ( | const Var & | key | ) | const |
Gets the value associated with the specified key.
- Parameters:
[in] key A string var.
- Returns:
- The value that is associated with
key
. Ifkey
is not a string var, or it doesn't exist in the dictionary, an undefined var is returned.
Gets all the keys in the dictionary.
- Returns:
- An array var which contains all the keys of the dictionary. The elements are string vars. Returns an empty array var if failed.
bool pp::VarDictionary::HasKey | ( | const Var & | key | ) | const |
Checks whether a key exists.
- Parameters:
[in] key A string var.
- Returns:
- A
bool
indicating whether the key exists.
VarDictionary& pp::VarDictionary::operator= | ( | const VarDictionary & | other | ) |
Assignment operator.
The Var
assignment operator is overridden here so that we can check for assigning a non-dictionary var to a VarDictionary
.
- Parameters:
[in] other The dictionary var to be assigned.
- Returns:
- The resulting
VarDictionary
(as aVar
&).
Reimplemented from pp::Var.
bool pp::VarDictionary::Set | ( | const Var & | key, |
const Var & | value | ||
) |
Sets the value associated with the specified key.
- Parameters:
[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 withvalue
.[in] value The value to set.
- Returns:
- A
bool
indicating whether the operation succeeds.
The documentation for this class was generated from the following file: