Add another hide-referrer{conditional-forge} test
[privoxy.git] / list.h
1 #ifndef LIST_H_INCLUDED
2 #define LIST_H_INCLUDED
3 /*********************************************************************
4  *
5  * File        :  $Source: /cvsroot/ijbswa/current/list.h,v $
6  *
7  * Purpose     :  Declares functions to handle lists.
8  *                Functions declared include:
9  *                   `destroy_list', `enlist' and `list_to_text'
10  *
11  * Copyright   :  Written by and Copyright (C) 2001-2007 members of the
12  *                Privoxy team. https://www.privoxy.org/
13  *
14  *                Based on the Internet Junkbuster originally written
15  *                by and Copyright (C) 1997 Anonymous Coders and
16  *                Junkbusters Corporation.  http://www.junkbusters.com
17  *
18  *                This program is free software; you can redistribute it
19  *                and/or modify it under the terms of the GNU General
20  *                Public License as published by the Free Software
21  *                Foundation; either version 2 of the License, or (at
22  *                your option) any later version.
23  *
24  *                This program is distributed in the hope that it will
25  *                be useful, but WITHOUT ANY WARRANTY; without even the
26  *                implied warranty of MERCHANTABILITY or FITNESS FOR A
27  *                PARTICULAR PURPOSE.  See the GNU General Public
28  *                License for more details.
29  *
30  *                The GNU General Public License should be included with
31  *                this file.  If not, you can view it at
32  *                http://www.gnu.org/copyleft/gpl.html
33  *                or write to the Free Software Foundation, Inc., 59
34  *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
35  *
36  *********************************************************************/
37
38
39 #include "project.h"
40
41 /*
42  * struct list
43  *
44  * A linked list class.
45  */
46
47 extern void init_list    (struct list *the_list);
48 extern void destroy_list (struct list *the_list);
49
50 extern jb_err enlist                 (struct list *the_list, const char *str);
51 extern jb_err enlist_unique          (struct list *the_list, const char *str, size_t num_significant_chars);
52 extern jb_err enlist_unique_header   (struct list *the_list, const char *name, const char *value);
53 extern jb_err enlist_first           (struct list *the_list, const char *str);
54 extern jb_err list_append_list_unique(struct list *dest,     const struct list *src);
55 extern jb_err list_duplicate         (struct list *dest,     const struct list *src);
56
57 extern int    list_remove_item(struct list *the_list, const char *str);
58 extern int    list_remove_list(struct list *dest,     const struct list *src);
59 extern void   list_remove_all (struct list *the_list);
60
61 extern int    list_is_empty(const struct list *the_list);
62
63 extern char * list_to_text(const struct list *the_list);
64
65 extern int    list_contains_item(const struct list *the_list, const char *str);
66
67 /*
68  * struct map
69  *
70  * A class which maps names to values.
71  *
72  * Note: You must allocate this through new_map() and free it
73  * through free_map().
74  */
75
76 extern struct map * new_map  (void);
77 extern void         free_map (struct map * the_map);
78
79 extern jb_err       map      (struct map * the_map,
80                               const char * name, int name_needs_copying,
81                               const char * value, int value_needs_copying);
82 extern jb_err       unmap    (struct map *the_map,
83                               const char *name);
84 extern const char * lookup   (const struct map * the_map, const char * name);
85
86 #endif /* ndef LIST_H_INCLUDED */
87
88 /*
89   Local Variables:
90   tab-width: 3
91   end:
92 */