1 #ifndef LIST_H_INCLUDED
2 #define LIST_H_INCLUDED
3 #define LIST_H_VERSION "$Id: list.h,v 1.18 2011/09/04 11:10:56 fabiankeil Exp $"
4 /*********************************************************************
6 * File : $Source: /cvsroot/ijbswa/current/list.h,v $
8 * Purpose : Declares functions to handle lists.
9 * Functions declared include:
10 * `destroy_list', `enlist' and `list_to_text'
12 * Copyright : Written by and Copyright (C) 2001-2007 the SourceForge
13 * Privoxy team. http://www.privoxy.org/
15 * Based on the Internet Junkbuster originally written
16 * by and Copyright (C) 1997 Anonymous Coders and
17 * Junkbusters Corporation. http://www.junkbusters.com
19 * This program is free software; you can redistribute it
20 * and/or modify it under the terms of the GNU General
21 * Public License as published by the Free Software
22 * Foundation; either version 2 of the License, or (at
23 * your option) any later version.
25 * This program is distributed in the hope that it will
26 * be useful, but WITHOUT ANY WARRANTY; without even the
27 * implied warranty of MERCHANTABILITY or FITNESS FOR A
28 * PARTICULAR PURPOSE. See the GNU General Public
29 * License for more details.
31 * The GNU General Public License should be included with
32 * this file. If not, you can view it at
33 * http://www.gnu.org/copyleft/gpl.html
34 * or write to the Free Software Foundation, Inc., 59
35 * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
37 *********************************************************************/
45 * A linked list class.
48 extern void init_list (struct list *the_list);
49 extern void destroy_list (struct list *the_list);
51 extern jb_err enlist (struct list *the_list, const char *str);
52 extern jb_err enlist_unique (struct list *the_list, const char *str, size_t num_significant_chars);
53 extern jb_err enlist_unique_header (struct list *the_list, const char *name, const char *value);
54 extern jb_err enlist_first (struct list *the_list, const char *str);
55 extern jb_err list_append_list_unique(struct list *dest, const struct list *src);
56 extern jb_err list_duplicate (struct list *dest, const struct list *src);
58 extern int list_remove_item(struct list *the_list, const char *str);
59 extern int list_remove_list(struct list *dest, const struct list *src);
60 extern void list_remove_all (struct list *the_list);
62 extern int list_is_empty(const struct list *the_list);
64 extern char * list_to_text(const struct list *the_list);
66 extern int list_contains_item(const struct list *the_list, const char *str);
71 * A class which maps names to values.
73 * Note: You must allocate this through new_map() and free it
77 extern struct map * new_map (void);
78 extern void free_map (struct map * the_map);
80 extern jb_err map (struct map * the_map,
81 const char * name, int name_needs_copying,
82 const char * value, int value_needs_copying);
83 extern jb_err unmap (struct map *the_map,
85 extern const char * lookup (const struct map * the_map, const char * name);
88 /* Revision control strings from this header and associated .c file */
89 extern const char list_rcs[];
90 extern const char list_h_rcs[];
92 #endif /* ndef LIST_H_INCLUDED */