1/* Copyright (c) 2012 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_resource_array_dev.idl modified Fri Jan  6 11:59:21 2012. */
7
8#ifndef PPAPI_C_DEV_PPB_RESOURCE_ARRAY_DEV_H_
9#define PPAPI_C_DEV_PPB_RESOURCE_ARRAY_DEV_H_
10
11#include "ppapi/c/pp_bool.h"
12#include "ppapi/c/pp_instance.h"
13#include "ppapi/c/pp_macros.h"
14#include "ppapi/c/pp_resource.h"
15#include "ppapi/c/pp_stdint.h"
16
17#define PPB_RESOURCEARRAY_DEV_INTERFACE_0_1 "PPB_ResourceArray(Dev);0.1"
18#define PPB_RESOURCEARRAY_DEV_INTERFACE PPB_RESOURCEARRAY_DEV_INTERFACE_0_1
19
20/**
21 * @file
22 * This file defines the <code>PPB_ResourceArray_Dev</code> interface.
23 */
24
25
26/**
27 * @addtogroup Interfaces
28 * @{
29 */
30/**
31 * A resource array holds a list of resources and retains a reference to each of
32 * them.
33 */
34struct PPB_ResourceArray_Dev_0_1 {
35  /**
36   * Creates a resource array.
37   * Note: It will add a reference to each of the elements.
38   *
39   * @param[in] elements <code>PP_Resource</code>s to be stored in the created
40   * resource array.
41   * @param[in] size The number of elements.
42   *
43   * @return A <code>PP_Resource</code> corresponding to a resource array if
44   * successful; 0 if failed.
45   */
46  PP_Resource (*Create)(PP_Instance instance,
47                        const PP_Resource elements[],
48                        uint32_t size);
49  /**
50   * Determines if the provided resource is a resource array.
51   *
52   * @param[in] resource A <code>PP_Resource</code> corresponding to a generic
53   * resource.
54   *
55   * @return A <code>PP_Bool</code> that is <code>PP_TRUE</code> if the given
56   * resource is a resource array, otherwise <code>PP_FALSE</code>.
57   */
58  PP_Bool (*IsResourceArray)(PP_Resource resource);
59  /**
60   * Gets the array size.
61   *
62   * @param[in] resource_array The resource array.
63   *
64   * @return How many elements are there in the array.
65   */
66  uint32_t (*GetSize)(PP_Resource resource_array);
67  /**
68   * Gets the element at the specified position.
69   * Note: It doesn't add a reference to the returned resource for the caller.
70   *
71   * @param[in] resource_array The resource array.
72   * @param[in] index An integer indicating a position in the array.
73   *
74   * @return A <code>PP_Resource</code>. Returns 0 if the index is out of range.
75   */
76  PP_Resource (*GetAt)(PP_Resource resource_array, uint32_t index);
77};
78
79typedef struct PPB_ResourceArray_Dev_0_1 PPB_ResourceArray_Dev;
80/**
81 * @}
82 */
83
84#endif  /* PPAPI_C_DEV_PPB_RESOURCE_ARRAY_DEV_H_ */
85
86