libcomps  ..
comps_objlist.h
Go to the documentation of this file.
1 /* libcomps - C alternative to yum.comps library
2  * Copyright (C) 2013 Jindrich Luza
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
17  * USA
18  */
19 
24 #ifndef COMPS_OBJLIST_H
25 #define COMPS_OBJLIST_H
26 
27 #include "comps_obj.h"
28 
29 #include <string.h>
30 #include <stdlib.h>
31 
32 typedef struct COMPS_ObjListIt COMPS_ObjListIt;
33 
35  COMPS_Object *comps_obj;
36  COMPS_ObjListIt *next;
37 } UnfoObjListIt;
38 
39 
41 typedef struct COMPS_ObjList {
45  size_t len;
48 
49 //void comps_objlist_create(COMPS_ObjList *objlist, COMPS_Object **args);
50 //void comps_objlist_create_u(COMPS_Object *uobj, COMPS_Object **args);
51 //void comps_objlist_destroy(COMPS_ObjList *objlist);
52 //void comps_objlist_destroy_u(COMPS_Object *objlist);
53 
54 
59 void comps_objlist_clear(COMPS_ObjList *objlist);
60 
61 
62 const COMPS_ObjListIt *comps_objlist_it_next(const COMPS_ObjListIt *it);
63 
74 int comps_objlist_walk(COMPS_ObjListIt **walker, COMPS_Object **result);
75 
86 int comps_objlist_walk_r(COMPS_ObjListIt *walker_start,
87  COMPS_ObjListIt *mantinel,
88  COMPS_Object **result);
89 
97 
105 
113 COMPS_Object* comps_objlist_get(COMPS_ObjList *objlist, unsigned int atpos);
114 
126 int comps_objlist_set(COMPS_ObjList *objlist, unsigned int atpos,
127  COMPS_Object *obj);
128 
136 COMPS_Object* comps_objlist_get_x(COMPS_ObjList *objlist, unsigned int atpos);
137 
150  unsigned int pos,
151  COMPS_Object *obj);
152 
153 int comps_objlist_insert_at_x(COMPS_ObjList *objlist,
154  unsigned int pos,
155  COMPS_Object *obj);
156 
166 int comps_objlist_remove_at(COMPS_ObjList *objlist, unsigned int atpos);
167 
178 
179 
180 int comps_objlist_index(COMPS_ObjList *objlist, COMPS_Object *obj);
181 
193  COMPS_ObjListIt *end);
194 
204  char (*filter_func)(COMPS_Object*));
205 
206 void comps_objlist_concat_in(COMPS_ObjList *list1, COMPS_ObjList *list2);
207 
208 //extern COMPS_ObjectInfo COMPS_ObjList_ObjInfo;
209 
210 #endif
int comps_objlist_append(COMPS_ObjList *objlist, COMPS_Object *obj)
int comps_objlist_walk_r(COMPS_ObjListIt *walker_start, COMPS_ObjListIt *mantinel, COMPS_Object **result)
COMPS_ObjList * comps_objlist_filter(COMPS_ObjList *list, char(*filter_func)(COMPS_Object *))
#define COMPS_Object_HEAD
Definition: comps_obj.h:86
COMPS_Object header file.
COMPS_ObjListIt * last
Definition: comps_objlist.h:44
size_t len
Definition: comps_objlist.h:45
Definition: comps_obj.h:124
void comps_objlist_clear(COMPS_ObjList *objlist)
Definition: comps_objlist.h:34
Definition: comps_objlist.h:41
#define COMPS_Object_TAIL(obj)
insert "extern COMPS_ObjectInfo _ObjInfo" statement. Use this macro in combination with COMPS_OB...
Definition: comps_obj.h:89
int comps_objlist_remove(COMPS_ObjList *objlist, COMPS_Object *obj)
COMPS_ObjListIt * first
Definition: comps_objlist.h:43
int comps_objlist_append_x(COMPS_ObjList *objlist, COMPS_Object *obj)
COMPS_ObjList * comps_objlist_sublist_it(COMPS_ObjListIt *startit, COMPS_ObjListIt *end)
COMPS_Object * comps_objlist_get(COMPS_ObjList *objlist, unsigned int atpos)
COMPS_Object * comps_objlist_get_x(COMPS_ObjList *objlist, unsigned int atpos)
int comps_objlist_set(COMPS_ObjList *objlist, unsigned int atpos, COMPS_Object *obj)
int comps_objlist_walk(COMPS_ObjListIt **walker, COMPS_Object **result)
int comps_objlist_remove_at(COMPS_ObjList *objlist, unsigned int atpos)
int comps_objlist_insert_at(COMPS_ObjList *objlist, unsigned int pos, COMPS_Object *obj)