forked from yaosj2k/dnsforwarder
-
Notifications
You must be signed in to change notification settings - Fork 9
/
stringlist.h
executable file
·47 lines (35 loc) · 1.28 KB
/
stringlist.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef STRINGLIST_H_INCLUDED
#define STRINGLIST_H_INCLUDED
#include "common.h"
#include "stablebuffer.h"
/* This class is not thread safe. */
typedef struct _StringList StringList;
struct _StringList{
StableBuffer Buffer;
int (*Count)(StringList *s);
void *(*Add)(StringList *s, const char *str, const char *Delimiters);
int (*AppendLast)(StringList *s, const char *str, const char *Delimiters);
const char **(*ToCharPtrArray)(StringList *s);
void (*TrimAll)(StringList *s, const char *Garbage);
void (*LowercaseAll)(StringList *s);
void (*Clear)(StringList *s);
void (*Free)(StringList *s);
};
int StringList_Init(__in StringList *s,
__in const char *ori,
__in const char *Delimiters
);
void FreeCharPtrArray(char **s);
/**
Iterator
*/
typedef struct _StringListIterator StringListIterator;
struct _StringListIterator{
StableBufferIterator BufferIterator;
char *CurrentPosition;
const char *(*Next)(StringListIterator *i);
const char *(*Remove)(StringListIterator *i);
void (*Reset)(StringListIterator *i);
};
int StringListIterator_Init(StringListIterator *i, StringList *l);
#endif /* STRINGLIST_H_INCLUDED */