os/graphics/graphicscomposition/openwfcompositionengine/common/include/owfarray.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/graphicscomposition/openwfcompositionengine/common/include/owfarray.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,138 @@
     1.4 +/* Copyright (c) 2009 The Khronos Group Inc.
     1.5 + *
     1.6 + * Permission is hereby granted, free of charge, to any person obtaining a
     1.7 + * copy of this software and/or associated documentation files (the
     1.8 + * "Materials"), to deal in the Materials without restriction, including
     1.9 + * without limitation the rights to use, copy, modify, merge, publish,
    1.10 + * distribute, sublicense, and/or sell copies of the Materials, and to
    1.11 + * permit persons to whom the Materials are furnished to do so, subject to
    1.12 + * the following conditions:
    1.13 + *
    1.14 + * The above copyright notice and this permission notice shall be included
    1.15 + * in all copies or substantial portions of the Materials.
    1.16 + *
    1.17 + * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    1.18 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    1.19 + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
    1.20 + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
    1.21 + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
    1.22 + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
    1.23 + * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
    1.24 + */
    1.25 +#ifndef OWFARRAY_H_
    1.26 +#define OWFARRAY_H_
    1.27 +
    1.28 +#include "owftypes.h"
    1.29 +
    1.30 +
    1.31 +#ifdef __cplusplus
    1.32 +extern "C"
    1.33 +{
    1.34 +#endif
    1.35 +
    1.36 +
    1.37 +typedef void*                 OWF_ARRAY_ITEM;
    1.38 +
    1.39 +typedef struct {
    1.40 +    OWF_ARRAY_ITEM* items;
    1.41 +    OWFint          capacity;
    1.42 +    OWFint          length;
    1.43 +} OWF_ARRAY;
    1.44 +
    1.45 +/*!
    1.46 + *  Initialize array object
    1.47 + *
    1.48 + *  \param array Array object
    1.49 + */
    1.50 +OWF_API_CALL void
    1.51 +OWF_Array_Initialize(OWF_ARRAY* array);
    1.52 +
    1.53 +/*!
    1.54 + *  Reset array. Frees resources allocated by the array.
    1.55 + *  Doesn't destroy the actual contents (managed
    1.56 + *  by the array user). The array can be safely reused afterwards.
    1.57 + *
    1.58 + *  \param array Array object
    1.59 + */
    1.60 +OWF_API_CALL void
    1.61 +OWF_Array_Reset(OWF_ARRAY* array);
    1.62 +
    1.63 +/*!
    1.64 + *  Destroy array. Free all resources allocated
    1.65 + *  by the array.
    1.66 + *
    1.67 + *  \param array Array object
    1.68 + */
    1.69 +OWF_API_CALL void
    1.70 +OWF_Array_Destroy(OWF_ARRAY* array);
    1.71 +
    1.72 +/*!
    1.73 + *  Append item to array
    1.74 + *
    1.75 + *  \param array Array object
    1.76 + *  \param item Item to add
    1.77 + *
    1.78 + *  \return OWF_TRUE if the operation succeeded, OWF_FALSE otherwise
    1.79 + */
    1.80 +OWF_API_CALL OWFboolean
    1.81 +OWF_Array_AppendItem(OWF_ARRAY* array,
    1.82 +                      OWF_ARRAY_ITEM item);
    1.83 +
    1.84 +/*!
    1.85 + *  Insert item into the array
    1.86 + *
    1.87 + *  \param array Array object
    1.88 + *  \param position Where the item should be inserted at
    1.89 + *  \param item Item to insert
    1.90 + *
    1.91 + *  \return OWF_TRUE if the operation succeeded, OWF_FALSE otherwise
    1.92 + */
    1.93 +OWF_API_CALL OWFboolean
    1.94 +OWF_Array_InsertItem(OWF_ARRAY*    array,
    1.95 +                     OWFint position,
    1.96 +                     OWF_ARRAY_ITEM item);
    1.97 +
    1.98 +/*!
    1.99 + *  Remove item (by value) from the array
   1.100 + *
   1.101 + *  \param array Array object
   1.102 + *  \param item Item to remove
   1.103 + *
   1.104 + *  \return Removed item or NULL if the item is invalid.
   1.105 + *
   1.106 + */
   1.107 +OWF_API_CALL OWF_ARRAY_ITEM
   1.108 +OWF_Array_RemoveItem(OWF_ARRAY* array,
   1.109 +                      OWF_ARRAY_ITEM item);
   1.110 +
   1.111 +/*!
   1.112 + *  Remove item (by index) from the array
   1.113 + *
   1.114 + *  \param array Array object
   1.115 + *  \param position Index of the item to remove
   1.116 + *
   1.117 + *  \return Removed item or NULL if the index is out of bounds.
   1.118 + */
   1.119 +OWF_API_CALL OWF_ARRAY_ITEM
   1.120 +OWF_Array_RemoveItemAt(OWF_ARRAY* array,
   1.121 +                          OWFint position);
   1.122 +
   1.123 +/*!
   1.124 + *  Get item from array
   1.125 + *
   1.126 + *  \param array Array object
   1.127 + *  \param position Index of the item to fetch (0..array.length-1)
   1.128 + *
   1.129 + *  \return Item or NULL, if the position argument is out of bounds.
   1.130 + *
   1.131 + */
   1.132 +OWF_API_CALL OWF_ARRAY_ITEM
   1.133 +OWF_Array_GetItemAt(OWF_ARRAY* array,
   1.134 +                    OWFint position);
   1.135 +
   1.136 +
   1.137 +#ifdef __cplusplus
   1.138 +}
   1.139 +#endif
   1.140 +
   1.141 +#endif