Delete unused downloads page asset.
[chromium-blink-merge.git] / ppapi / api / ppb_var_dictionary.idl
blobb4b9c060709dc09f3bc82e079371de0d22012864
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 /**
7 * This file defines the <code>PPB_VarDictionary</code> struct providing
8 * a way to interact with dictionary vars.
9 */
11 label Chrome {
12 M29 = 1.0
15 /**
16 * A dictionary var contains key-value pairs with unique keys. The keys are
17 * strings while the values can be arbitrary vars. Key comparison is always
18 * done by value instead of by reference.
20 [macro="PPB_VAR_DICTIONARY_INTERFACE"]
21 interface PPB_VarDictionary {
22 /**
23 * Creates a dictionary var, i.e., a <code>PP_Var</code> with type set to
24 * <code>PP_VARTYPE_DICTIONARY</code>.
26 * @return An empty dictionary var, whose reference count is set to 1 on
27 * behalf of the caller.
29 PP_Var Create();
31 /**
32 * Gets the value associated with the specified key.
34 * @param[in] dict A dictionary var.
35 * @param[in] key A string var.
37 * @return The value that is associated with <code>key</code>. The reference
38 * count of the element returned is incremented on behalf of the caller. If
39 * <code>key</code> is not a string var, or it doesn't exist in
40 * <code>dict</code>, an undefined var is returned.
42 PP_Var Get([in] PP_Var dict, [in] PP_Var key);
44 /**
45 * Sets the value associated with the specified key.
47 * @param[in] dict A dictionary var.
48 * @param[in] key A string var. If this key hasn't existed in
49 * <code>dict</code>, it is added and associated with <code>value</code>;
50 * otherwise, the previous value is replaced with <code>value</code>.
51 * @param[in] value The value to set. The dictionary holds a reference to it
52 * on success.
54 * @return A <code>PP_Bool</code> indicating whether the operation succeeds.
56 PP_Bool Set([in] PP_Var dict, [in] PP_Var key, [in] PP_Var value);
58 /**
59 * Deletes the specified key and its associated value, if the key exists. The
60 * reference to the element will be released.
62 * @param[in] dict A dictionary var.
63 * @param[in] key A string var.
65 void Delete([in] PP_Var dict, [in] PP_Var key);
67 /**
68 * Checks whether a key exists.
70 * @param[in] dict A dictionary var.
71 * @param[in] key A string var.
73 * @return A <code>PP_Bool</code> indicating whether the key exists.
75 PP_Bool HasKey([in] PP_Var dict, [in] PP_Var key);
77 /**
78 * Gets all the keys in a dictionary. Please note that for each key that you
79 * set into the dictionary, a string var with the same contents is returned;
80 * but it may not be the same string var (i.e., <code>value.as_id</code> may
81 * be different).
83 * @param[in] dict A dictionary var.
85 * @return An array var which contains all the keys of <code>dict</code>. Its
86 * reference count is incremented on behalf of the caller. The elements are
87 * string vars. Returns a null var if failed.
89 PP_Var GetKeys([in] PP_Var dict);