| OLD | NEW |
| 1 /* Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
| 4 */ | 4 */ |
| 5 | 5 |
| 6 /* From dev/ppb_var_dictionary_dev.idl modified Wed Mar 13 21:47:05 2013. */ | 6 /* From ppb_var_dictionary.idl modified Sat Jun 8 23:03:54 2013. */ |
| 7 | 7 |
| 8 #ifndef PPAPI_C_DEV_PPB_VAR_DICTIONARY_DEV_H_ | 8 #ifndef PPAPI_C_PPB_VAR_DICTIONARY_H_ |
| 9 #define PPAPI_C_DEV_PPB_VAR_DICTIONARY_DEV_H_ | 9 #define PPAPI_C_PPB_VAR_DICTIONARY_H_ |
| 10 | 10 |
| 11 #include "ppapi/c/pp_bool.h" | 11 #include "ppapi/c/pp_bool.h" |
| 12 #include "ppapi/c/pp_macros.h" | 12 #include "ppapi/c/pp_macros.h" |
| 13 #include "ppapi/c/pp_stdint.h" | 13 #include "ppapi/c/pp_stdint.h" |
| 14 #include "ppapi/c/pp_var.h" | 14 #include "ppapi/c/pp_var.h" |
| 15 | 15 |
| 16 #define PPB_VAR_DICTIONARY_DEV_INTERFACE_0_1 "PPB_VarDictionary(Dev);0.1" | 16 #define PPB_VAR_DICTIONARY_INTERFACE_1_0 "PPB_VarDictionary;1.0" |
| 17 #define PPB_VAR_DICTIONARY_DEV_INTERFACE PPB_VAR_DICTIONARY_DEV_INTERFACE_0_1 | 17 #define PPB_VAR_DICTIONARY_INTERFACE PPB_VAR_DICTIONARY_INTERFACE_1_0 |
| 18 | 18 |
| 19 /** | 19 /** |
| 20 * @file | 20 * @file |
| 21 * This file defines the <code>PPB_VarDictionary_Dev</code> struct providing | 21 * This file defines the <code>PPB_VarDictionary</code> struct providing |
| 22 * a way to interact with dictionary vars. | 22 * a way to interact with dictionary vars. |
| 23 */ | 23 */ |
| 24 | 24 |
| 25 | 25 |
| 26 /** | 26 /** |
| 27 * @addtogroup Interfaces | 27 * @addtogroup Interfaces |
| 28 * @{ | 28 * @{ |
| 29 */ | 29 */ |
| 30 /** | 30 /** |
| 31 * A dictionary var contains key-value pairs with unique keys. The keys are | 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 | 32 * strings while the values can be arbitrary vars. Key comparison is always |
| 33 * done by value instead of by reference. | 33 * done by value instead of by reference. |
| 34 */ | 34 */ |
| 35 struct PPB_VarDictionary_Dev_0_1 { | 35 struct PPB_VarDictionary_1_0 { |
| 36 /** | 36 /** |
| 37 * Creates a dictionary var, i.e., a <code>PP_Var</code> with type set to | 37 * Creates a dictionary var, i.e., a <code>PP_Var</code> with type set to |
| 38 * <code>PP_VARTYPE_DICTIONARY</code>. | 38 * <code>PP_VARTYPE_DICTIONARY</code>. |
| 39 * | 39 * |
| 40 * @return An empty dictionary var, whose reference count is set to 1 on | 40 * @return An empty dictionary var, whose reference count is set to 1 on |
| 41 * behalf of the caller. | 41 * behalf of the caller. |
| 42 */ | 42 */ |
| 43 struct PP_Var (*Create)(void); | 43 struct PP_Var (*Create)(void); |
| 44 /** | 44 /** |
| 45 * Gets the value associated with the specified key. | 45 * Gets the value associated with the specified key. |
| 46 * | 46 * |
| 47 * @param[in] dict A dictionary var. | 47 * @param[in] dict A dictionary var. |
| 48 * @param[in] key A string var. | 48 * @param[in] key A string var. |
| 49 * | 49 * |
| 50 * @return The value that is associated with <code>key</code>. The reference | 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 | 51 * count of the element returned is incremented on behalf of the caller. If |
| 52 * string var, or it doesn't exist in <code>dict</code>, an undefined var is | 52 * <code>key</code> is not a string var, or it doesn't exist in |
| 53 * returned. | 53 * <code>dict</code>, an undefined var is returned. |
| 54 */ | 54 */ |
| 55 struct PP_Var (*Get)(struct PP_Var dict, struct PP_Var key); | 55 struct PP_Var (*Get)(struct PP_Var dict, struct PP_Var key); |
| 56 /** | 56 /** |
| 57 * Sets the value associated with the specified key. The dictionary is | 57 * Sets the value associated with the specified key. |
| 58 * responsible for holding references to its children to keep them alive. | |
| 59 * | 58 * |
| 60 * @param[in] dict A dictionary var. | 59 * @param[in] dict A dictionary var. |
| 61 * @param[in] key A string var. If this key hasn't existed in | 60 * @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>; | 61 * <code>dict</code>, it is added and associated with <code>value</code>; |
| 63 * otherwise, the previous value is replaced with <code>value</code>. | 62 * otherwise, the previous value is replaced with <code>value</code>. |
| 64 * @param[in] value The value to set. | 63 * @param[in] value The value to set. The dictionary holds a reference to it |
| 64 * on success. |
| 65 * | 65 * |
| 66 * @return A <code>PP_Bool</code> indicating whether the operation succeeds. | 66 * @return A <code>PP_Bool</code> indicating whether the operation succeeds. |
| 67 */ | 67 */ |
| 68 PP_Bool (*Set)(struct PP_Var dict, struct PP_Var key, struct PP_Var value); | 68 PP_Bool (*Set)(struct PP_Var dict, struct PP_Var key, struct PP_Var value); |
| 69 /** | 69 /** |
| 70 * Deletes the specified key and its associated value, if the key exists. | 70 * Deletes the specified key and its associated value, if the key exists. The |
| 71 * reference to the element will be released. |
| 71 * | 72 * |
| 72 * @param[in] dict A dictionary var. | 73 * @param[in] dict A dictionary var. |
| 73 * @param[in] key A string var. | 74 * @param[in] key A string var. |
| 74 */ | 75 */ |
| 75 void (*Delete)(struct PP_Var dict, struct PP_Var key); | 76 void (*Delete)(struct PP_Var dict, struct PP_Var key); |
| 76 /** | 77 /** |
| 77 * Checks whether a key exists. | 78 * Checks whether a key exists. |
| 78 * | 79 * |
| 79 * @param[in] dict A dictionary var. | 80 * @param[in] dict A dictionary var. |
| 80 * @param[in] key A string var. | 81 * @param[in] key A string var. |
| 81 * | 82 * |
| 82 * @return A <code>PP_Bool</code> indicating whether the key exists. | 83 * @return A <code>PP_Bool</code> indicating whether the key exists. |
| 83 */ | 84 */ |
| 84 PP_Bool (*HasKey)(struct PP_Var dict, struct PP_Var key); | 85 PP_Bool (*HasKey)(struct PP_Var dict, struct PP_Var key); |
| 85 /** | 86 /** |
| 86 * Gets all the keys in a dictionary. Please note that for each key that you | 87 * 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 * 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 * but it may not be the same string var (i.e., <code>value.as_id</code> may |
| 89 * be different). | 90 * be different). |
| 90 * | 91 * |
| 91 * @param[in] dict A dictionary var. | 92 * @param[in] dict A dictionary var. |
| 92 * | 93 * |
| 93 * @return An array var which contains all the keys of <code>dict</code>. Its | 94 * @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 * reference count is incremented on behalf of the caller. The elements are |
| 95 * string vars. Returns a null var if failed. | 96 * string vars. Returns a null var if failed. |
| 96 */ | 97 */ |
| 97 struct PP_Var (*GetKeys)(struct PP_Var dict); | 98 struct PP_Var (*GetKeys)(struct PP_Var dict); |
| 98 }; | 99 }; |
| 99 | 100 |
| 100 typedef struct PPB_VarDictionary_Dev_0_1 PPB_VarDictionary_Dev; | 101 typedef struct PPB_VarDictionary_1_0 PPB_VarDictionary; |
| 101 /** | 102 /** |
| 102 * @} | 103 * @} |
| 103 */ | 104 */ |
| 104 | 105 |
| 105 #endif /* PPAPI_C_DEV_PPB_VAR_DICTIONARY_DEV_H_ */ | 106 #endif /* PPAPI_C_PPB_VAR_DICTIONARY_H_ */ |
| 106 | 107 |
| OLD | NEW |