1 #ifndef LIST_H_INCLUDED
2 #define LIST_H_INCLUDED
3 #define LIST_H_VERSION "$Id: list.h,v 1.16 2009/05/16 13:27:20 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 *********************************************************************/
50 * A linked list class.
53 extern void init_list (struct list *the_list);
54 extern void destroy_list (struct list *the_list);
56 extern jb_err enlist (struct list *the_list, const char *str);
57 extern jb_err enlist_unique (struct list *the_list, const char *str, size_t num_significant_chars);
58 extern jb_err enlist_unique_header (struct list *the_list, const char *name, const char *value);
59 extern jb_err enlist_first (struct list *the_list, const char *str);
60 extern jb_err list_append_list_unique(struct list *dest, const struct list *src);
61 extern jb_err list_duplicate (struct list *dest, const struct list *src);
63 extern int list_remove_item(struct list *the_list, const char *str);
64 extern int list_remove_list(struct list *dest, const struct list *src);
65 extern void list_remove_all (struct list *the_list);
67 extern int list_is_empty(const struct list *the_list);
69 extern char * list_to_text(const struct list *the_list);
71 extern int list_contains_item(const struct list *the_list, const char *str);
76 * A class which maps names to values.
78 * Note: You must allocate this through new_map() and free it
82 extern struct map * new_map (void);
83 extern void free_map (struct map * the_map);
85 extern jb_err map (struct map * the_map,
86 const char * name, int name_needs_copying,
87 const char * value, int value_needs_copying);
88 extern jb_err unmap (struct map *the_map,
90 extern const char * lookup (const struct map * the_map, const char * name);
93 /* Revision control strings from this header and associated .c file */
94 extern const char list_rcs[];
95 extern const char list_h_rcs[];
101 #endif /* ndef LIST_H_INCLUDED */