Pepper_31_C_interfaces
ppb_var_dictionary.h
Go to the documentation of this file.
1 /* Copyright 2013 The Chromium Authors. All rights reserved.
2  * Use of this source code is governed by a BSD-style license that can be
3  * found in the LICENSE file.
4  */
5 
6 /* From ppb_var_dictionary.idl modified Sat Jun 8 23:03:54 2013. */
7 
8 #ifndef PPAPI_C_PPB_VAR_DICTIONARY_H_
9 #define PPAPI_C_PPB_VAR_DICTIONARY_H_
10 
11 #include "ppapi/c/pp_bool.h"
12 #include "ppapi/c/pp_macros.h"
13 #include "ppapi/c/pp_stdint.h"
14 #include "ppapi/c/pp_var.h"
15 
16 #define PPB_VAR_DICTIONARY_INTERFACE_1_0 "PPB_VarDictionary;1.0"
17 #define PPB_VAR_DICTIONARY_INTERFACE PPB_VAR_DICTIONARY_INTERFACE_1_0
18 
19 /**
20  * @file
21  * This file defines the <code>PPB_VarDictionary</code> struct providing
22  * a way to interact with dictionary vars.
23  */
24 
25 
26 /**
27  * @addtogroup Interfaces
28  * @{
29  */
30 /**
31  * A dictionary var contains key-value pairs with unique keys. The keys are
32  * strings while the values can be arbitrary vars. Key comparison is always
33  * done by value instead of by reference.
34  */
36  /**
37  * Creates a dictionary var, i.e., a <code>PP_Var</code> with type set to
38  * <code>PP_VARTYPE_DICTIONARY</code>.
39  *
40  * @return An empty dictionary var, whose reference count is set to 1 on
41  * behalf of the caller.
42  */
43  struct PP_Var (*Create)(void);
44  /**
45  * Gets the value associated with the specified key.
46  *
47  * @param[in] dict A dictionary var.
48  * @param[in] key A string var.
49  *
50  * @return The value that is associated with <code>key</code>. The reference
51  * count of the element returned is incremented on behalf of the caller. If
52  * <code>key</code> is not a string var, or it doesn't exist in
53  * <code>dict</code>, an undefined var is returned.
54  */
55  struct PP_Var (*Get)(struct PP_Var dict, struct PP_Var key);
56  /**
57  * Sets the value associated with the specified key.
58  *
59  * @param[in] dict A dictionary var.
60  * @param[in] key A string var. If this key hasn't existed in
61  * <code>dict</code>, it is added and associated with <code>value</code>;
62  * otherwise, the previous value is replaced with <code>value</code>.
63  * @param[in] value The value to set. The dictionary holds a reference to it
64  * on success.
65  *
66  * @return A <code>PP_Bool</code> indicating whether the operation succeeds.
67  */
68  PP_Bool (*Set)(struct PP_Var dict, struct PP_Var key, struct PP_Var value);
69  /**
70  * Deletes the specified key and its associated value, if the key exists. The
71  * reference to the element will be released.
72  *
73  * @param[in] dict A dictionary var.
74  * @param[in] key A string var.
75  */
76  void (*Delete)(struct PP_Var dict, struct PP_Var key);
77  /**
78  * Checks whether a key exists.
79  *
80  * @param[in] dict A dictionary var.
81  * @param[in] key A string var.
82  *
83  * @return A <code>PP_Bool</code> indicating whether the key exists.
84  */
85  PP_Bool (*HasKey)(struct PP_Var dict, struct PP_Var key);
86  /**
87  * Gets all the keys in a dictionary. Please note that for each key that you
88  * set into the dictionary, a string var with the same contents is returned;
89  * but it may not be the same string var (i.e., <code>value.as_id</code> may
90  * be different).
91  *
92  * @param[in] dict A dictionary var.
93  *
94  * @return An array var which contains all the keys of <code>dict</code>. Its
95  * reference count is incremented on behalf of the caller. The elements are
96  * string vars. Returns a null var if failed.
97  */
98  struct PP_Var (*GetKeys)(struct PP_Var dict);
99 };
100 
102 /**
103  * @}
104  */
105 
106 #endif /* PPAPI_C_PPB_VAR_DICTIONARY_H_ */
107 
struct PP_Var(* GetKeys)(struct PP_Var dict)
struct PP_Var(* Get)(struct PP_Var dict, struct PP_Var key)
struct PP_Var(* Create)(void)
PP_Bool(* Set)(struct PP_Var dict, struct PP_Var key, struct PP_Var value)
union PP_VarValue value
Definition: pp_var.h:169
Definition: pp_var.h:155
void(* Delete)(struct PP_Var dict, struct PP_Var key)
PP_Bool
Definition: pp_bool.h:30
PP_Bool(* HasKey)(struct PP_Var dict, struct PP_Var key)