blob: 9925e4471f8e79ac0e2df8b24ae4293732b11fd9 [file] [log] [blame]
[email protected]034fbf82013-06-20 09:08:151/* Copyright 2013 The Chromium Authors. All rights reserved.
[email protected]53db2fa2013-03-19 00:29:032 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 */
5
6/**
[email protected]034fbf82013-06-20 09:08:157 * This file defines the <code>PPB_VarArray</code> struct providing
[email protected]53db2fa2013-03-19 00:29:038 * a way to interact with array vars.
9 */
10
11label Chrome {
[email protected]034fbf82013-06-20 09:08:1512 M29 = 1.0
[email protected]53db2fa2013-03-19 00:29:0313};
14
[email protected]034fbf82013-06-20 09:08:1515[macro="PPB_VAR_ARRAY_INTERFACE"]
16interface PPB_VarArray {
[email protected]53db2fa2013-03-19 00:29:0317 /**
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.
20 *
21 * @return An empty array var, whose reference count is set to 1 on behalf of
22 * the caller.
23 */
24 PP_Var Create();
25
26 /**
27 * Gets an element from the array.
28 *
29 * @param[in] array An array var.
30 * @param[in] index An index indicating which element to return.
31 *
[email protected]034fbf82013-06-20 09:08:1532 * @return The element at the specified position. The reference count of the
33 * element returned is incremented on behalf of the caller. If
34 * <code>index</code> is larger than or equal to the array length, an
35 * undefined var is returned.
[email protected]53db2fa2013-03-19 00:29:0336 */
37 PP_Var Get([in] PP_Var array, [in] uint32_t index);
38
39 /**
40 * Sets the value of an element in the array.
41 *
42 * @param[in] array An array var.
43 * @param[in] index An index indicating which element to modify. If
44 * <code>index</code> is larger than or equal to the array length, the length
45 * is updated to be <code>index</code> + 1. Any position in the array that
46 * hasn't been set before is set to undefined, i.e., <code>PP_Var</code> of
47 * type <code>PP_VARTYPE_UNDEFINED</code>.
48 * @param[in] value The value to set. The array holds a reference to it on
49 * success.
50 *
51 * @return A <code>PP_Bool</code> indicating whether the operation succeeds.
52 */
53 PP_Bool Set([in] PP_Var array, [in] uint32_t index, [in] PP_Var value);
54
55 /**
56 * Gets the array length.
57 *
58 * @param[in] array An array var.
59 *
60 * @return The array length.
61 */
62 uint32_t GetLength([in] PP_Var array);
63
64 /**
65 * Sets the array length.
66 *
67 * @param[in] array An array var.
68 * @param[in] length The new array length. If <code>length</code> is smaller
69 * than its current value, the array is truncated to the new length; any
[email protected]034fbf82013-06-20 09:08:1570 * elements that no longer fit are removed and the references to them will be
71 * released. If <code>length</code> is larger than its current value,
72 * undefined vars are appended to increase the array to the specified length.
[email protected]53db2fa2013-03-19 00:29:0373 *
74 * @return A <code>PP_Bool</code> indicating whether the operation succeeds.
75 */
76 PP_Bool SetLength([in] PP_Var array, [in] uint32_t length);
77};