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_array_dev.idl modified Thu Mar 14 13:41:46 2013. */ | |
7 | |
8 #ifndef PPAPI_C_DEV_PPB_VAR_ARRAY_DEV_H_ | |
9 #define PPAPI_C_DEV_PPB_VAR_ARRAY_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_ARRAY_DEV_INTERFACE_0_1 "PPB_VarArray(Dev);0.1" | |
17 #define PPB_VAR_ARRAY_DEV_INTERFACE PPB_VAR_ARRAY_DEV_INTERFACE_0_1 | |
18 | |
19 /** | |
20 * @file | |
21 * This file defines the <code>PPB_VarArray_Dev</code> struct providing | |
22 * a way to interact with array vars. | |
23 */ | |
24 | |
25 | |
26 /** | |
27 * @addtogroup Interfaces | |
28 * @{ | |
29 */ | |
30 struct PPB_VarArray_Dev_0_1 { | |
31 /** | |
32 * Creates an array var, i.e., a <code>PP_Var</code> with type set to | |
33 * <code>PP_VARTYPE_ARRAY</code>. The array length is set to 0. | |
34 * | |
35 * @return An empty array var, whose reference count is set to 1 on behalf of | |
36 * the caller. | |
37 */ | |
38 struct PP_Var (*Create)(void); | |
39 /** | |
40 * Gets an element from the array. | |
41 * | |
42 * @param[in] array An array var. | |
43 * @param[in] index An index indicating which element to return. | |
44 * | |
45 * @return The element at the specified position. The reference count is | |
46 * incremented on behalf of the caller. If <code>index</code> is larger than | |
47 * or equal to the array length, an undefined var is returned. | |
48 */ | |
49 struct PP_Var (*Get)(struct PP_Var array, uint32_t index); | |
50 /** | |
51 * Sets the value of an element in the array. | |
52 * | |
53 * @param[in] array An array var. | |
54 * @param[in] index An index indicating which element to modify. If | |
55 * <code>index</code> is larger than or equal to the array length, the length | |
56 * is updated to be <code>index</code> + 1. Any position in the array that | |
57 * hasn't been set before is set to undefined, i.e., <code>PP_Var</code> of | |
58 * type <code>PP_VARTYPE_UNDEFINED</code>. | |
59 * @param[in] value The value to set. The array holds a reference to it on | |
60 * success. | |
61 * | |
62 * @return A <code>PP_Bool</code> indicating whether the operation succeeds. | |
63 */ | |
64 PP_Bool (*Set)(struct PP_Var array, uint32_t index, struct PP_Var value); | |
65 /** | |
66 * Gets the array length. | |
67 * | |
68 * @param[in] array An array var. | |
69 * | |
70 * @return The array length. | |
71 */ | |
72 uint32_t (*GetLength)(struct PP_Var array); | |
73 /** | |
74 * Sets the array length. | |
75 * | |
76 * @param[in] array An array var. | |
77 * @param[in] length The new array length. If <code>length</code> is smaller | |
78 * than its current value, the array is truncated to the new length; any | |
79 * elements that no longer fit are removed. If <code>length</code> is larger | |
80 * than its current value, undefined vars are appended to increase the array | |
81 * to the specified length. | |
82 * | |
83 * @return A <code>PP_Bool</code> indicating whether the operation succeeds. | |
84 */ | |
85 PP_Bool (*SetLength)(struct PP_Var array, uint32_t length); | |
86 }; | |
87 | |
88 typedef struct PPB_VarArray_Dev_0_1 PPB_VarArray_Dev; | |
89 /** | |
90 * @} | |
91 */ | |
92 | |
93 #endif /* PPAPI_C_DEV_PPB_VAR_ARRAY_DEV_H_ */ | |
94 | |
OLD | NEW |