]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/wordlist.h
2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
9 #ifndef SQUID_WORDLIST_H
10 #define SQUID_WORDLIST_H
13 #include "profiler/Profiler.h"
16 /** A list of C-strings
18 * \deprecated use SBufList instead
22 MEMPROXY_CLASS(wordlist
);
23 friend void wordlistDestroy(wordlist
** list
);
24 friend char *wordlistChopHead(wordlist
**);
27 wordlist() : key(nullptr), next(nullptr) {}
28 // create a new wordlist node, with a copy of k as key
29 explicit wordlist(const char *k
) : key(xstrdup(k
)), next(nullptr) {}
31 wordlist(const wordlist
&) = delete;
32 wordlist
&operator=(const wordlist
&) = delete;
38 // use wordlistDestroy instead
39 ~wordlist() = default;
44 /** Add a null-terminated c-string to a wordlist
46 * \deprecated use SBufList.push_back(SBuf(word)) instead
48 const char *wordlistAdd(wordlist
**, const char *);
50 /** Concatenate a wordlist
52 * \deprecated use SBufListContainerJoin(SBuf()) from SBufAlgos.h instead
54 void wordlistCat(const wordlist
*, MemBuf
*);
56 /** append a wordlist to another
58 * \deprecated use SBufList.merge(otherwordlist) instead
60 void wordlistAddWl(wordlist
**, wordlist
*);
62 /** Concatenate the words in a wordlist
64 * \deprecated use SBufListContainerJoin(SBuf()) from SBufAlgos.h instead
66 void wordlistJoin(wordlist
**, wordlist
**);
68 /// destroy a wordlist
69 void wordlistDestroy(wordlist
**);
71 /** remove the first element in a wordlist, and return its key
73 * \note the returned key must be freed by the caller using safe_free
74 * \note wl is altered so that it points to the second element
75 * \return nullptr if pointed-to wordlist is nullptr.
77 char *wordlistChopHead(wordlist
**);
79 /// convert a wordlist to a SBufList
80 SBufList
ToSBufList(wordlist
*);
82 #endif /* SQUID_WORDLIST_H */