libcomps ..

Loading...
Searching...
No Matches
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
34 struct COMPS_ObjListIt {
35 COMPS_Object *comps_obj;
36 COMPS_ObjListIt *next;
37};
38
39
41 typedef struct COMPS_ObjList {
42 COMPS_Object_HEAD;
43 COMPS_ObjListIt *first;
44 COMPS_ObjListIt *last;
45 size_t len;
46} COMPS_ObjList;
47 COMPS_Object_TAIL(COMPS_ObjList);
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
96 int comps_objlist_append_x(COMPS_ObjList *objlist, COMPS_Object *obj);
97
104 int comps_objlist_append(COMPS_ObjList *objlist, COMPS_Object *obj);
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
149 int comps_objlist_insert_at(COMPS_ObjList *objlist,
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
177 int comps_objlist_remove(COMPS_ObjList *objlist, COMPS_Object *obj);
178
179
180 int comps_objlist_index(COMPS_ObjList *objlist, COMPS_Object *obj);
181
192 COMPS_ObjList* comps_objlist_sublist_it(COMPS_ObjListIt *startit,
193 COMPS_ObjListIt *end);
194
203 COMPS_ObjList* comps_objlist_filter(COMPS_ObjList *list,
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
comps_obj.h
COMPS_Object header file.
COMPS_Object_HEAD
#define COMPS_Object_HEAD
Definition comps_obj.h:86
COMPS_Object_TAIL
#define COMPS_Object_TAIL(obj)
insert "extern COMPS_ObjectInfo <obj>_ObjInfo" statement. Use this macro in combination with COMPS_OB...
Definition comps_obj.h:89
comps_objlist_append_x
int comps_objlist_append_x(COMPS_ObjList *objlist, COMPS_Object *obj)
comps_objlist_clear
void comps_objlist_clear(COMPS_ObjList *objlist)
comps_objlist_filter
COMPS_ObjList * comps_objlist_filter(COMPS_ObjList *list, char(*filter_func)(COMPS_Object *))
comps_objlist_insert_at
int comps_objlist_insert_at(COMPS_ObjList *objlist, unsigned int pos, COMPS_Object *obj)
comps_objlist_remove_at
int comps_objlist_remove_at(COMPS_ObjList *objlist, unsigned int atpos)
comps_objlist_append
int comps_objlist_append(COMPS_ObjList *objlist, COMPS_Object *obj)
comps_objlist_get_x
COMPS_Object * comps_objlist_get_x(COMPS_ObjList *objlist, unsigned int atpos)
comps_objlist_sublist_it
COMPS_ObjList * comps_objlist_sublist_it(COMPS_ObjListIt *startit, COMPS_ObjListIt *end)
comps_objlist_set
int comps_objlist_set(COMPS_ObjList *objlist, unsigned int atpos, COMPS_Object *obj)
comps_objlist_walk_r
int comps_objlist_walk_r(COMPS_ObjListIt *walker_start, COMPS_ObjListIt *mantinel, COMPS_Object **result)
comps_objlist_remove
int comps_objlist_remove(COMPS_ObjList *objlist, COMPS_Object *obj)
comps_objlist_get
COMPS_Object * comps_objlist_get(COMPS_ObjList *objlist, unsigned int atpos)
comps_objlist_walk
int comps_objlist_walk(COMPS_ObjListIt **walker, COMPS_Object **result)
COMPS_ObjListIt
Definition comps_objlist.h:34
COMPS_ObjList
Definition comps_objlist.h:41
COMPS_ObjList::len
size_t len
Definition comps_objlist.h:45
COMPS_ObjList::first
COMPS_ObjListIt * first
Definition comps_objlist.h:43
COMPS_ObjList::last
COMPS_ObjListIt * last
Definition comps_objlist.h:44
COMPS_Object
Definition comps_obj.h:124