1 /*
2  *  This program is free software; you can redistribute it and/or modify
3  *  it under the terms of the GNU General Public License as published by
4  *  the Free Software Foundation; either version 2 of the License, or
5  *  (at your option) any later version.
6  *
7  *  This program is distributed in the hope that it will be useful,
8  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  *  GNU General Public License for more details.
11  *
12  *  You should have received a copy of the GNU General Public License
13  *  along with this program; if not, write to the Free Software
14  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
15  *
16  *  Copyright (C) 2006-2016 XNeur Team
17  *
18  */
19 
20 #ifndef _LIST_CHAR_H_
21 #define _LIST_CHAR_H_
22 
23 #include <stdio.h>
24 
25 #define BY_PLAIN	0 // Search by plain text
26 #define BY_REGEXP	1 // Search by regular expression
27 
28 struct _list_char_data
29 {
30 	char *string;
31 
32 #ifdef WITH_DEBUG
33 	int  debug_value;
34 	char *debug_string;
35 #endif
36 };
37 
38 struct _list_char
39 {
40 	struct _list_char_data *data;
41 	int data_count;
42 
43 	void (*uninit) (struct _list_char *list);
44 	struct _list_char_data* (*add) (struct _list_char *list, const char *string);
45 	struct _list_char_data* (*find) (struct _list_char *list, const char *string, int mode);
46 	struct _list_char_data* (*find_alike) (struct _list_char *list, const char *string);
47 	struct _list_char* (*clone) (struct _list_char *list);
48 	struct _list_char* (*alike) (struct _list_char *list, const char *string);
49 	void (*load)  (struct _list_char *list, char *content);
50 	void (*save)  (struct _list_char *list, FILE *stream);
51 	int  (*exist) (struct _list_char *list, const char *string, int mode);
52 	void (*rem)   (struct _list_char *list, const char *string);
53 	void (*sort)  (struct _list_char *list);
54 };
55 
56 struct _list_char* list_char_init(void);
57 
58 #endif /* _LIST_CHAR_H_ */
59