Data Fields

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)

Detailed Description

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.


Field Documentation

struct PP_Var(* PPB_VarDictionary::Create)(void) [read]

Creates a dictionary var, i.e., a PP_Var with type set to PP_VARTYPE_DICTIONARY.

Returns:
An empty dictionary var, whose reference count is set to 1 on behalf of the caller.
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.

Parameters:
[in]dictA dictionary var.
[in]keyA 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.

Parameters:
[in]dictA dictionary var.
[in]keyA string var.
Returns:
The value that is associated with 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).

Parameters:
[in]dictA dictionary var.
Returns:
An array var which contains all the keys of 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.

Parameters:
[in]dictA dictionary var.
[in]keyA string var.
Returns:
A 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.

Parameters:
[in]dictA dictionary var.
[in]keyA 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]valueThe value to set. The dictionary holds a reference to it on success.
Returns:
A PP_Bool indicating whether the operation succeeds.

The documentation for this struct was generated from the following file:
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.