strlist.h 1.17 KB
Newer Older
Bernhard Link's avatar
Bernhard Link committed
1 2
#ifndef REPREPRO_STRLIST_H
#define REPREPRO_STRLIST_H
Bernhard Link's avatar
Bernhard Link committed
3

Bernhard Link's avatar
Bernhard Link committed
4
#ifndef REPREPRO_ERROR_H
Bernhard Link's avatar
Bernhard Link committed
5 6 7 8 9 10 11 12 13
#include "error.h"
#warning "What's hapening here?"
#endif

struct strlist {
	char **values;
	int count,size;
};

14
retvalue strlist_init(struct strlist *strlist);
Bernhard Link's avatar
Bernhard Link committed
15
retvalue strlist_init_n(int startsize,struct strlist *strlist);
16
retvalue strlist_init_singleton(char *value,struct strlist *strlist);
17
void strlist_done(struct strlist *strlist);
Bernhard Link's avatar
Bernhard Link committed
18 19 20

/* add a string, will get property of the strlist and free'd by it */
retvalue strlist_add(struct strlist *strlist,char *element);
21 22
/* include a string at the beginning, otherwise like strlist_add */
retvalue strlist_include(struct strlist *strlist,char *element);
Bernhard Link's avatar
Bernhard Link committed
23

24 25 26 27 28
/* print a space seperated list of elements */
retvalue strlist_fprint(FILE *file,const struct strlist *strlist);

/* duplicate with content */
retvalue strlist_dup(struct strlist *dest,const struct strlist *orig);
Bernhard Link's avatar
Bernhard Link committed
29 30
/* replace the contents of dest with those from orig, which get emptied */
void strlist_move(struct strlist *dest,struct strlist *orig);
31

Bernhard Link's avatar
Bernhard Link committed
32 33
bool_t strlist_in(const struct strlist *strlist,const char *element);
bool_t strlist_subset(const struct strlist *strlist,const struct strlist *subset);
Bernhard Link's avatar
Bernhard Link committed
34 35

#endif