Squid Web Cache master
Loading...
Searching...
No Matches
CharacterSetOption.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2025 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#ifndef SQUID_SRC_ACL_CHARACTERSETOPTION_H
10#define SQUID_SRC_ACL_CHARACTERSETOPTION_H
11
12#include "acl/Options.h"
13#include "base/CharacterSet.h"
14#include "sbuf/SBuf.h"
15
16namespace Acl {
17
19
20/* TypedOption<CharacterSetOptionValue> specializations */
21
22template <>
23inline
24void
26{
27 SBuf chars = rawValue; // because c_str() is not constant
28 recipient_->value = CharacterSet(__FILE__, chars.c_str());
29}
30
31template <>
32inline void
34{
35 recipient_->value.printChars(os); // TODO: Quote if needed.
36}
37
39class CharacterSetOption: public TypedOption<CharacterSetOptionValue>
40{
41public:
43 explicit CharacterSetOption(const char *name): Parent(name, nullptr, valueOptional) {}
44};
45
46} // namespace Acl
47
48#endif /* SQUID_SRC_ACL_CHARACTERSETOPTION_H */
49
option value to configure one or more characters (e.g., -m=",;")
TypedOption< CharacterSetOptionValue > Parent
CharacterSetOption(const char *name)
Stores configuration of a typical boolean flag or a single-value Option.
Definition Options.h:100
@ valueOptional
Definition Options.h:59
a type-specific Option (e.g., a boolean –toggle or -m=SBuf)
Definition Options.h:130
void import(const SBuf &rawValue) const
Definition Options.h:194
void printValue(std::ostream &os) const
Definition Options.h:195
optimized set of C chars, with quick membership test and merge support
Definition SBuf.h:94
const char * c_str()
Definition SBuf.cc:516
Definition Acl.cc:33
OptionValue< CharacterSet > CharacterSetOptionValue