]> git.ipfire.org Git - thirdparty/squid.git/blame - src/acl/CharacterSetOption.h
Source Format Enforcement (#532)
[thirdparty/squid.git] / src / acl / CharacterSetOption.h
CommitLineData
4eac3407 1/*
77b1029d 2 * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
4eac3407
CT
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_ACL_CHARACTER_SET_OPTION_H
10#define SQUID_ACL_CHARACTER_SET_OPTION_H
11
12#include "acl/Options.h"
13#include "base/CharacterSet.h"
14#include "sbuf/SBuf.h"
15
16namespace Acl {
17
18typedef OptionValue<CharacterSet> CharacterSetOptionValue;
19
20/* TypedOption<CharacterSetOptionValue> specializations */
21
22template <>
23inline
24void
25TypedOption<CharacterSetOptionValue>::import(const SBuf &rawValue) const
26{
27 SBuf chars = rawValue; // because c_str() is not constant
28 recipient_->value = CharacterSet(__FILE__, chars.c_str());
29}
30
31template <>
32inline
33void
34TypedOption<CharacterSetOptionValue>::print(std::ostream &os) const
35{
36 recipient_->value.printChars(os); // TODO: Quote if needed.
37}
38
39/// option value to configure one or more characters (e.g., -m=",;")
40class CharacterSetOption: public TypedOption<CharacterSetOptionValue>
41{
42public:
43 typedef TypedOption<CharacterSetOptionValue> Parent;
44 CharacterSetOption(): Parent(valueOptional) {}
45};
46
47} // namespace Acl
48
49#endif /* SQUID_ACL_CHARACTER_SET_OPTION_H */
50