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.
7 * This file defines the <code>PPB_VarArray_Dev</code> struct providing
8 * a way to interact with array vars.
15 [macro
="PPB_VAR_ARRAY_DEV_INTERFACE"]
16 interface PPB_VarArray_Dev
{
18 * Creates an array var, i.e., a <code>PP_Var</code> with type set to
19 * <code>PP_VARTYPE_ARRAY</code>. The array length is set to 0.
21 * @return An empty array var, whose reference count is set to 1 on behalf of
27 * Gets an element from the array.
29 * @param[in] array An array var.
30 * @param[in] index An index indicating which element to return.
32 * @return The element at the specified position. The reference count is
33 * incremented on behalf of the caller. If <code>index</code> is larger than
34 * or equal to the array length, an undefined var is returned.
36 PP_Var Get
([in] PP_Var array
, [in] uint32_t index
);
39 * Sets the value of an element in the array.
41 * @param[in] array An array var.
42 * @param[in] index An index indicating which element to modify. If
43 * <code>index</code> is larger than or equal to the array length, the length
44 * is updated to be <code>index</code> + 1. Any position in the array that
45 * hasn't been set before is set to undefined, i.e., <code>PP_Var</code> of
46 * type <code>PP_VARTYPE_UNDEFINED</code>.
47 * @param[in] value The value to set. The array holds a reference to it on
50 * @return A <code>PP_Bool</code> indicating whether the operation succeeds.
52 PP_Bool Set
([in] PP_Var array
, [in] uint32_t index
, [in] PP_Var value
);
55 * Gets the array length.
57 * @param[in] array An array var.
59 * @return The array length.
61 uint32_t GetLength
([in] PP_Var array
);
64 * Sets the array length.
66 * @param[in] array An array var.
67 * @param[in] length The new array length. If <code>length</code> is smaller
68 * than its current value, the array is truncated to the new length; any
69 * elements that no longer fit are removed. If <code>length</code> is larger
70 * than its current value, undefined vars are appended to increase the array
71 * to the specified length.
73 * @return A <code>PP_Bool</code> indicating whether the operation succeeds.
75 PP_Bool SetLength
([in] PP_Var array
, [in] uint32_t length
);