| 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 /* From dev/ppb_var_dictionary_dev.idl modified Wed Mar 13 21:47:05 2013. */ | |
| 7 | |
| 8 #ifndef PPAPI_C_DEV_PPB_VAR_DICTIONARY_DEV_H_ | |
| 9 #define PPAPI_C_DEV_PPB_VAR_DICTIONARY_DEV_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_DEV_INTERFACE_0_1 "PPB_VarDictionary(Dev);0.1" | |
| 17 #define PPB_VAR_DICTIONARY_DEV_INTERFACE PPB_VAR_DICTIONARY_DEV_INTERFACE_0_1 | |
| 18 | |
| 19 /** | |
| 20 * @file | |
| 21 * This file defines the <code>PPB_VarDictionary_Dev</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 */ | |
| 35 struct PPB_VarDictionary_Dev_0_1 { | |
| 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 is incremented on behalf of the caller. If <code>key</code> is not a | |
| 52 * string var, or it doesn't exist in <code>dict</code>, an undefined var is | |
| 53 * 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. The dictionary is | |
| 58 * responsible for holding references to its children to keep them alive. | |
| 59 * | |
| 60 * @param[in] dict A dictionary var. | |
| 61 * @param[in] key A string var. If this key hasn't existed in | |
| 62 * <code>dict</code>, it is added and associated with <code>value</code>; | |
| 63 * otherwise, the previous value is replaced with <code>value</code>. | |
| 64 * @param[in] value The value to set. | |
| 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. | |
| 71 * | |
| 72 * @param[in] dict A dictionary var. | |
| 73 * @param[in] key A string var. | |
| 74 */ | |
| 75 void (*Delete)(struct PP_Var dict, struct PP_Var key); | |
| 76 /** | |
| 77 * Checks whether a key exists. | |
| 78 * | |
| 79 * @param[in] dict A dictionary var. | |
| 80 * @param[in] key A string var. | |
| 81 * | |
| 82 * @return A <code>PP_Bool</code> indicating whether the key exists. | |
| 83 */ | |
| 84 PP_Bool (*HasKey)(struct PP_Var dict, struct PP_Var key); | |
| 85 /** | |
| 86 * Gets all the keys in a dictionary. Please note that for each key that you | |
| 87 * set into the dictionary, a string var with the same contents is returned; | |
| 88 * but it may not be the same string var (i.e., <code>value.as_id</code> may | |
| 89 * be different). | |
| 90 * | |
| 91 * @param[in] dict A dictionary var. | |
| 92 * | |
| 93 * @return An array var which contains all the keys of <code>dict</code>. Its | |
| 94 * reference count is incremented on behalf of the caller. The elements are | |
| 95 * string vars. Returns a null var if failed. | |
| 96 */ | |
| 97 struct PP_Var (*GetKeys)(struct PP_Var dict); | |
| 98 }; | |
| 99 | |
| 100 typedef struct PPB_VarDictionary_Dev_0_1 PPB_VarDictionary_Dev; | |
| 101 /** | |
| 102 * @} | |
| 103 */ | |
| 104 | |
| 105 #endif /* PPAPI_C_DEV_PPB_VAR_DICTIONARY_DEV_H_ */ | |
| 106 | |
| OLD | NEW |