]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/wordlist.h
2 * Copyright (C) 1996-2017 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"
14 #include "sbuf/List.h"
16 /** A list of C-strings
18 * \deprecated use SBufList instead
22 MEMPROXY_CLASS(wordlist
);
23 friend char *wordlistChopHead(wordlist
**);
26 wordlist() : key(nullptr), next(nullptr) {}
27 // create a new wordlist node, with a copy of k as key
28 explicit wordlist(const char *k
) : key(xstrdup(k
)), next(nullptr) {}
30 wordlist(const wordlist
&) = delete;
31 wordlist
&operator=(const wordlist
&) = delete;
37 // does not free data members.
38 ~wordlist() = default;
43 /** Add a null-terminated c-string to a wordlist
45 * \deprecated use SBufList.push_back(SBuf(word)) instead
47 const char *wordlistAdd(wordlist
**, const char *);
49 /** Concatenate a wordlist
51 * \deprecated use SBufListContainerJoin(SBuf()) from sbuf/Algorithms.h instead
53 void wordlistCat(const wordlist
*, MemBuf
*);
55 /// destroy a wordlist
56 void wordlistDestroy(wordlist
**);
58 /** Remove and destroy the first element while preserving and returning its key
60 * \note the returned key must be freed by the caller using safe_free
61 * \note wl is altered so that it points to the second element
62 * \return nullptr if pointed-to wordlist is nullptr.
64 char *wordlistChopHead(wordlist
**);
66 /// convert a wordlist to a SBufList
67 SBufList
ToSBufList(wordlist
*);
69 #endif /* SQUID_WORDLIST_H */