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 [macro="PPB_VAR_DICTIONARY_DEV_INTERFACE"] |
| 16 interface PPB_VarDictionary_Dev { |
| 17 /** |
| 18 * Creates a dictionary var, i.e., a <code>PP_Var</code> with type set to |
| 19 * <code>PP_VARTYPE_DICTIONARY</code>. |
| 20 * |
| 21 * @return An empty dictionary var, whose reference count is set to 1 on |
| 22 * behalf of the caller. |
| 23 */ |
| 24 PP_Var Create(); |
| 25 |
| 26 /** |
| 27 * Gets the value associated with the specified key. |
| 28 * |
| 29 * @param[in] dict A dictionary var. |
| 30 * @param[in] key A string var. |
| 31 * |
| 32 * @return The value that is associated with <code>key</code>. The reference |
| 33 * count is incremented on behalf of the caller. If <code>key</code> is not a |
| 34 * string var, or it doesn't exist in <code>dict</code>, an undefined var is |
| 35 * returned. |
| 36 */ |
| 37 PP_Var Get([in] PP_Var dict, [in] PP_Var key); |
| 38 |
| 39 /** |
| 40 * Sets the value associated with the specified key. |
| 41 * |
| 42 * @param[in] dict A dictionary var. |
| 43 * @param[in] key A string var. If this key hasn't existed in |
| 44 * <code>dict</code>, it is added and associated with <code>value</code>; |
| 45 * otherwise, the previous value is replaced with <code>value</code>. |
| 46 * @param[in] value The value to set. |
| 47 * |
| 48 * @return A <code>PP_Bool</code> indicating whether the operation succeeds. |
| 49 */ |
| 50 PP_Bool Set([in] PP_Var dict, [in] PP_Var key, [in] PP_Var value); |
| 51 |
| 52 /** |
| 53 * Deletes the specified key and its associated value, if the key exists. |
| 54 * |
| 55 * @param[in] dict A dictionary var. |
| 56 * @param[in] key A string var. |
| 57 */ |
| 58 void Delete([in] PP_Var dict, [in] PP_Var key); |
| 59 |
| 60 /** |
| 61 * Checks whether a key exists. |
| 62 * |
| 63 * @param[in] dict A dictionary var. |
| 64 * @param[in] key A string var. |
| 65 * |
| 66 * @return A <code>PP_Bool</code> indicating whether the key exists. |
| 67 */ |
| 68 PP_Bool HasKey([in] PP_Var dict, [in] PP_Var key); |
| 69 |
| 70 /** |
| 71 * Gets all the keys in a dictionary. |
| 72 * |
| 73 * @param[in] dict A dictionary var. |
| 74 * |
| 75 * @return An array var which contains all the keys of <code>dict</code>. Its |
| 76 * reference count is incremented on behalf of the caller. The elements are |
| 77 * string vars. Returns a null var if failed. |
| 78 */ |
| 79 PP_Var GetKeys([in] PP_Var dict); |
| 80 }; |
OLD | NEW |