list.h 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. #include "project.h"
  38. /*
  39. * struct list
  40. *
  41. * A linked list class.
  42. */
  43. extern void init_list (struct list *the_list);
  44. extern void destroy_list (struct list *the_list);
  45. extern jb_err enlist (struct list *the_list, const char *str);
  46. extern jb_err enlist_unique (struct list *the_list, const char *str, size_t num_significant_chars);
  47. extern jb_err enlist_unique_header (struct list *the_list, const char *name, const char *value);
  48. extern jb_err enlist_first (struct list *the_list, const char *str);
  49. extern jb_err list_append_list_unique(struct list *dest, const struct list *src);
  50. extern jb_err list_duplicate (struct list *dest, const struct list *src);
  51. extern int list_remove_item(struct list *the_list, const char *str);
  52. extern int list_remove_list(struct list *dest, const struct list *src);
  53. extern void list_remove_all (struct list *the_list);
  54. extern int list_is_empty(const struct list *the_list);
  55. extern char * list_to_text(const struct list *the_list);
  56. extern int list_contains_item(const struct list *the_list, const char *str);
  57. /*
  58. * struct map
  59. *
  60. * A class which maps names to values.
  61. *
  62. * Note: You must allocate this through new_map() and free it
  63. * through free_map().
  64. */
  65. extern struct map * new_map (void);
  66. extern void free_map (struct map * the_map);
  67. extern jb_err map (struct map * the_map,
  68. const char * name, int name_needs_copying,
  69. const char * value, int value_needs_copying);
  70. extern jb_err unmap (struct map *the_map,
  71. const char *name);
  72. extern const char * lookup (const struct map * the_map, const char * name);
  73. #endif /* ndef LIST_H_INCLUDED */
  74. /*
  75. Local Variables:
  76. tab-width: 3
  77. end:
  78. */