OSDN Git Service

ca3239d8589ccae7c76273c035c9eebbb44b93ed
[rec10/rec10-git.git] / tstools / DtsEdit / src / gpac / list.h
1 /*\r
2  *                      GPAC - Multimedia Framework C SDK\r
3  *\r
4  *                      Copyright (c) Jean Le Feuvre 2000-2005 \r
5  *                                      All rights reserved\r
6  *\r
7  *  This file is part of GPAC / common tools sub-project\r
8  *\r
9  *  GPAC is free software; you can redistribute it and/or modify\r
10  *  it under the terms of the GNU Lesser General Public License as published by\r
11  *  the Free Software Foundation; either version 2, or (at your option)\r
12  *  any later version.\r
13  *   \r
14  *  GPAC is distributed in the hope that it will be useful,\r
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
17  *  GNU Lesser General Public License for more details.\r
18  *   \r
19  *  You should have received a copy of the GNU Lesser General Public\r
20  *  License along with this library; see the file COPYING.  If not, write to\r
21  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. \r
22  *\r
23  */\r
24 \r
25 #ifndef _GF_LIST_H_\r
26 #define _GF_LIST_H_\r
27 \r
28 #ifdef __cplusplus\r
29 extern "C" {\r
30 #endif\r
31 \r
32 /*!\r
33  *      \file <gpac/list.h>\r
34  *      \brief list functions.\r
35  */\r
36 \r
37 /*!\r
38  *      \addtogroup list_grp list\r
39  *      \ingroup utils_grp\r
40  *      \brief List object\r
41  *\r
42  *      This section documents the list object of the GPAC framework.\r
43  *      @{\r
44  */\r
45 \r
46 #include <gpac/tools.h>\r
47 \r
48 typedef struct _tag_array GF_List;\r
49 \r
50 /*!\r
51  *      \brief list constructor\r
52  *\r
53  *      Constructs a new list object\r
54  *      \return new list object\r
55  */\r
56 GF_List *gf_list_new();\r
57 /*!\r
58  *      \brief list destructor\r
59  *\r
60  *      Destructs a list object\r
61  *      \param ptr list object to destruct\r
62  *      \note It is the caller responsability to destroy the content of the list if needed\r
63  */\r
64 void gf_list_del(GF_List *ptr);\r
65 /*!\r
66  *      \brief get count\r
67  *\r
68  *      Returns number of items in the list\r
69  *      \param ptr target list object\r
70  *      \return number of items in the list\r
71  */\r
72 u32 gf_list_count(GF_List *ptr);\r
73 /*!\r
74  *      \brief add item\r
75  *\r
76  *      Adds an item at the end of the list\r
77  *      \param ptr target list object\r
78  *      \param item item to add\r
79  */\r
80 GF_Err gf_list_add(GF_List *ptr, void* item);\r
81 /*!\r
82  *      \brief inserts item\r
83  *\r
84  *      Insert an item in the list\r
85  *      \param ptr target list object\r
86  *      \param item item to add\r
87  *      \param position insertion position. It is expressed between 0 and gf_list_count-1, and any bigger value is equivalent to gf_list_add\r
88  */\r
89 GF_Err gf_list_insert(GF_List *ptr, void *item, u32 position);\r
90 /*!\r
91  *      \brief removes item\r
92  *\r
93  *      Removes an item from the list given its position\r
94  *      \param ptr target list object\r
95  *      \param position position of the item to remove. It is expressed between 0 and gf_list_count-1.\r
96  *      \note It is the caller responsability to destroy the content of the list if needed\r
97  */\r
98 GF_Err gf_list_rem(GF_List *ptr, u32 position);\r
99 /*!\r
100  *      \brief gets item\r
101  *\r
102  *      Gets an item from the list given its position\r
103  *      \param ptr target list object\r
104  *      \param position position of the item to get. It is expressed between 0 and gf_list_count-1.\r
105  */\r
106 void *gf_list_get(GF_List *ptr, u32 position);\r
107 /*!\r
108  *      \brief finds item\r
109  *\r
110  *      Finds an item in the list\r
111  *      \param ptr target list object.\r
112  *      \param item the item to find.\r
113  *      \return 0-based item position in the list, or -1 if the item could not be found.\r
114  */\r
115 s32 gf_list_find(GF_List *ptr, void *item);\r
116 /*!\r
117  *      \brief deletes item\r
118  *\r
119  *      Deletes an item from the list\r
120  *      \param ptr target list object.\r
121  *      \param item the item to find.\r
122  *      \return 0-based item position in the list before removal, or -1 if the item could not be found.\r
123  */\r
124 s32 gf_list_del_item(GF_List *ptr, void *item);\r
125 /*!\r
126  *      \brief resets list\r
127  *\r
128  *      Resets the content of the list\r
129  *      \param ptr target list object.\r
130  *      \note It is the caller responsability to destroy the content of the list if needed\r
131  */\r
132 void gf_list_reset(GF_List *ptr);\r
133 /*!\r
134  *      \brief gets last item\r
135  *\r
136  *      Gets last item o fthe list \r
137  *      \param ptr target list object\r
138  */\r
139 void *gf_list_last(GF_List *ptr);\r
140 /*!\r
141  *      \brief removes last item\r
142  *\r
143  *      Removes the last item of the list\r
144  *      \param ptr target list object\r
145  *      \note It is the caller responsability to destroy the content of the list if needed\r
146  */\r
147 GF_Err gf_list_rem_last(GF_List *ptr);\r
148 \r
149 \r
150 /*!\r
151  *      \brief list enumerator\r
152  *\r
153  *      Retrieves given list item and increment current position\r
154  *      \param ptr target list object\r
155  *      \param pos target item position. The position is automatically incremented regardless of the return value\r
156  *      \note A typical enumeration will start with a value of 0 until NULL is returned.\r
157  */\r
158 void *gf_list_enum(GF_List *ptr, u32 *pos);\r
159 \r
160 /*! @} */\r
161 \r
162 #ifdef __cplusplus\r
163 }\r
164 #endif\r
165 \r
166 \r
167 #endif          /*_GF_LIST_H_*/\r
168 \r