OLD | NEW |
(Empty) | |
| 1 /* Copyright (c) 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 /** |
| 7 * This file defines the <code>PPB_VarDictionary_Dev</code> struct providing |
| 8 * a way to interact with dictionary vars. |
| 9 */ |
| 10 |
| 11 label Chrome { |
| 12 M27 = 0.1 |
| 13 }; |
| 14 |
| 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. |
| 19 */ |
| 20 [macro="PPB_VAR_DICTIONARY_DEV_INTERFACE"] |
| 21 interface PPB_VarDictionary_Dev { |
| 22 /** |
| 23 * Creates a dictionary var, i.e., a <code>PP_Var</code> with type set to |
| 24 * <code>PP_VARTYPE_DICTIONARY</code>. |
| 25 * |
| 26 * @return An empty dictionary var, whose reference count is set to 1 on |
| 27 * behalf of the caller. |
| 28 */ |
| 29 PP_Var Create(); |
| 30 |
| 31 /** |
| 32 * Gets the value associated with the specified key. |
| 33 * |
| 34 * @param[in] dict A dictionary var. |
| 35 * @param[in] key A string var. |
| 36 * |
| 37 * @return The value that is associated with <code>key</code>. The reference |
| 38 * count is incremented on behalf of the caller. If <code>key</code> is not a |
| 39 * string var, or it doesn't exist in <code>dict</code>, an undefined var is |
| 40 * returned. |
| 41 */ |
| 42 PP_Var Get([in] PP_Var dict, [in] PP_Var key); |
| 43 |
| 44 /** |
| 45 * Sets the value associated with the specified key. The dictionary is |
| 46 * responsible for holding references to its children to keep them alive. |
| 47 * |
| 48 * @param[in] dict A dictionary var. |
| 49 * @param[in] key A string var. If this key hasn't existed in |
| 50 * <code>dict</code>, it is added and associated with <code>value</code>; |
| 51 * otherwise, the previous value is replaced with <code>value</code>. |
| 52 * @param[in] value The value to set. |
| 53 * |
| 54 * @return A <code>PP_Bool</code> indicating whether the operation succeeds. |
| 55 */ |
| 56 PP_Bool Set([in] PP_Var dict, [in] PP_Var key, [in] PP_Var value); |
| 57 |
| 58 /** |
| 59 * Deletes the specified key and its associated value, if the key exists. |
| 60 * |
| 61 * @param[in] dict A dictionary var. |
| 62 * @param[in] key A string var. |
| 63 */ |
| 64 void Delete([in] PP_Var dict, [in] PP_Var key); |
| 65 |
| 66 /** |
| 67 * Checks whether a key exists. |
| 68 * |
| 69 * @param[in] dict A dictionary var. |
| 70 * @param[in] key A string var. |
| 71 * |
| 72 * @return A <code>PP_Bool</code> indicating whether the key exists. |
| 73 */ |
| 74 PP_Bool HasKey([in] PP_Var dict, [in] PP_Var key); |
| 75 |
| 76 /** |
| 77 * Gets all the keys in a dictionary. Please note that for each key that you |
| 78 * set into the dictionary, a string var with the same contents is returned; |
| 79 * but it may not be the same string var (i.e., <code>value.as_id</code> may |
| 80 * be different). |
| 81 * |
| 82 * @param[in] dict A dictionary var. |
| 83 * |
| 84 * @return An array var which contains all the keys of <code>dict</code>. Its |
| 85 * reference count is incremented on behalf of the caller. The elements are |
| 86 * string vars. Returns a null var if failed. |
| 87 */ |
| 88 PP_Var GetKeys([in] PP_Var dict); |
| 89 }; |
OLD | NEW |