]> git.ipfire.org Git - thirdparty/squid.git/blob - src/StrList.h
Source Format Enforcement (#763)
[thirdparty/squid.git] / src / StrList.h
1 /*
2 * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
3 *
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.
7 */
8
9 /* DEBUG: section 66 HTTP Header Tools */
10
11 #ifndef SQUID_STRLIST_H_
12 #define SQUID_STRLIST_H_
13
14 #include "sbuf/forward.h"
15
16 #include <iterator>
17
18 class String;
19
20 /// Appends the given item to a delimiter-separated list in str.
21 void strListAdd(String * str, const char *item, char del);
22
23 /// Appends the given item of a given size to a delimiter-separated list in str.
24 void strListAdd(String &str, const char *item, const size_t itemSize, const char del = ',');
25
26 /// Appends the given item to a delimiter-separated list in str.
27 /// Use strListAdd(c-string) for c-string items with unknown length.
28 void strListAdd(String &str, const SBuf &item, char delimiter = ',');
29
30 int strListIsMember(const String * str, const SBuf &item, char del);
31 int strListIsSubstr(const String * list, const char *s, char del);
32 /// Iterates through delimiter-separated and optionally "quoted" list members.
33 /// Follows HTTP #rule, including skipping OWS and empty members.
34 int strListGetItem(const String * str, char del, const char **item, int *ilen, const char **pos);
35 /// Searches for the first matching key=value pair
36 /// within a delimiter-separated list of items.
37 /// \returns the value of the found pair or an empty string.
38 SBuf getListMember(const String &list, const char *key, const char delimiter);
39
40 #endif /* SQUID_STRLIST_H_ */
41