{{+bindTo:partials.standard_nacl_api}}
struct PP_Var(* | Create )(void) |
struct PP_Var(* | Get )(struct PP_Var dict, struct PP_Var key) |
PP_Bool(* | Set )(struct PP_Var dict, struct PP_Var key, struct PP_Var value) |
void(* | Delete )(struct PP_Var dict, struct PP_Var key) |
PP_Bool(* | HasKey )(struct PP_Var dict, struct PP_Var key) |
struct PP_Var(* | GetKeys )(struct PP_Var dict) |
A dictionary var contains key-value pairs with unique keys.
The keys are strings while the values can be arbitrary vars. Key comparison is always done by value instead of by reference.
struct PP_Var(* PPB_VarDictionary::Create)(void) [read] |
Creates a dictionary var, i.e., a PP_Var
with type set to PP_VARTYPE_DICTIONARY
.
void(* PPB_VarDictionary::Delete)(struct PP_Var dict, struct PP_Var key) |
Deletes the specified key and its associated value, if the key exists.
The reference to the element will be released.
[in] | dict | A dictionary var. |
[in] | key | A string var. |
struct PP_Var(* PPB_VarDictionary::Get)(struct PP_Var dict, struct PP_Var key) [read] |
Gets the value associated with the specified key.
[in] | dict | A dictionary var. |
[in] | key | A string var. |
key
. The reference count of the element returned is incremented on behalf of the caller. If key
is not a string var, or it doesn't exist in dict
, an undefined var is returned. struct PP_Var(* PPB_VarDictionary::GetKeys)(struct PP_Var dict) [read] |
Gets all the keys in a dictionary.
Please note that for each key that you set into the dictionary, a string var with the same contents is returned; but it may not be the same string var (i.e., value.as_id
may be different).
[in] | dict | A dictionary var. |
dict
. Its reference count is incremented on behalf of the caller. The elements are string vars. Returns a null var if failed. PP_Bool(* PPB_VarDictionary::HasKey)(struct PP_Var dict, struct PP_Var key) |
Checks whether a key exists.
[in] | dict | A dictionary var. |
[in] | key | A string var. |
PP_Bool
indicating whether the key exists. PP_Bool(* PPB_VarDictionary::Set)(struct PP_Var dict, struct PP_Var key, struct PP_Var value) |
Sets the value associated with the specified key.
[in] | dict | A dictionary var. |
[in] | key | A string var. If this key hasn't existed in dict , it is added and associated with value ; otherwise, the previous value is replaced with value . |
[in] | value | The value to set. The dictionary holds a reference to it on success. |
PP_Bool
indicating whether the operation succeeds.