[android_webview] Fix AndroidViewIntegrationTest on N7 JB.
[chromium-blink-merge.git] / ppapi / c / ppb_var_dictionary.h
blob712da679b4a5458e2eddc930ac54debeda8faeb7
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 */
6 /* From ppb_var_dictionary.idl modified Sat Jun 8 23:03:54 2013. */
8 #ifndef PPAPI_C_PPB_VAR_DICTIONARY_H_
9 #define PPAPI_C_PPB_VAR_DICTIONARY_H_
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"
16 #define PPB_VAR_DICTIONARY_INTERFACE_1_0 "PPB_VarDictionary;1.0"
17 #define PPB_VAR_DICTIONARY_INTERFACE PPB_VAR_DICTIONARY_INTERFACE_1_0
19 /**
20 * @file
21 * This file defines the <code>PPB_VarDictionary</code> struct providing
22 * a way to interact with dictionary vars.
26 /**
27 * @addtogroup Interfaces
28 * @{
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.
35 struct PPB_VarDictionary_1_0 {
36 /**
37 * Creates a dictionary var, i.e., a <code>PP_Var</code> with type set to
38 * <code>PP_VARTYPE_DICTIONARY</code>.
40 * @return An empty dictionary var, whose reference count is set to 1 on
41 * behalf of the caller.
43 struct PP_Var (*Create)(void);
44 /**
45 * Gets the value associated with the specified key.
47 * @param[in] dict A dictionary var.
48 * @param[in] key A string var.
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.
55 struct PP_Var (*Get)(struct PP_Var dict, struct PP_Var key);
56 /**
57 * Sets the value associated with the specified key.
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.
66 * @return A <code>PP_Bool</code> indicating whether the operation succeeds.
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.
73 * @param[in] dict A dictionary var.
74 * @param[in] key A string var.
76 void (*Delete)(struct PP_Var dict, struct PP_Var key);
77 /**
78 * Checks whether a key exists.
80 * @param[in] dict A dictionary var.
81 * @param[in] key A string var.
83 * @return A <code>PP_Bool</code> indicating whether the key exists.
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).
92 * @param[in] dict A dictionary var.
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.
98 struct PP_Var (*GetKeys)(struct PP_Var dict);
101 typedef struct PPB_VarDictionary_1_0 PPB_VarDictionary;
103 * @}
106 #endif /* PPAPI_C_PPB_VAR_DICTIONARY_H_ */