1 #ifndef LIST_H_INCLUDED
2 #define LIST_H_INCLUDED
3 /*********************************************************************
5 * File : $Source: /cvsroot/ijbswa/current/list.h,v $
7 * Purpose : Declares functions to handle lists.
8 * Functions declared include:
9 * `destroy_list', `enlist' and `list_to_text'
11 * Copyright : Written by and Copyright (C) 2001-2007 members of the
12 * Privoxy team. https://www.privoxy.org/
14 * Based on the Internet Junkbuster originally written
15 * by and Copyright (C) 1997 Anonymous Coders and
16 * Junkbusters Corporation. http://www.junkbusters.com
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.
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.
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.
36 *********************************************************************/
44 * A linked list class.
47 extern void init_list (struct list *the_list);
48 extern void destroy_list (struct list *the_list);
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);
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);
61 extern int list_is_empty(const struct list *the_list);
63 extern char * list_to_text(const struct list *the_list);
65 extern int list_contains_item(const struct list *the_list, const char *str);
70 * A class which maps names to values.
72 * Note: You must allocate this through new_map() and free it
76 extern struct map * new_map (void);
77 extern void free_map (struct map * the_map);
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,
84 extern const char * lookup (const struct map * the_map, const char * name);
86 #endif /* ndef LIST_H_INCLUDED */