32 #ifndef DRAIN_STRING_MATCHER_LIST
33 #define DRAIN_STRING_MATCHER_LIST
40 #include <drain/Log.h>
41 #include <drain/Sprinter.h>
42 #include <drain/String.h>
43 #include "StringMatcher.h"
51 template <
class T=std::
string>
58 typedef std::list<T> list_t;
61 template<
typename ... TT>
85 template <
typename ...TT>
86 void setKey(
const std::string & arg,
const TT & ... args){
106 template <
typename ...TT>
107 void addKey(
const std::string & arg,
const TT & ... args){
119 bool test(
const std::string & key,
bool defaultResult =
true)
const;
123 return !this->empty();
128 const list_t & getList()
const {
133 void toStream(std::ostream & ostr)
const {
161 std::vector<std::string> argv;
164 for (
const std::string & arg: argv){
183 matcher_t matcher(s);
184 for (
const matcher_t & m: *
this){
191 this->push_back(matcher);
209 return defaultResult;
212 for (
const auto & k: *
this){
228 selector.toStream(ostr);
232 typedef StringMatcherList<StringMatcher> KeySelector;
234 DRAIN_TYPENAME(KeySelector);
LogSourc e is the means for a function or any program segment to "connect" to a Log.
Definition: Log.h:308
static std::ostream & sequenceToStream(std::ostream &ostr, const T &x, const SprinterLayout &layout)
Convenience: if sequence type (array, list, set, map) not given, assume array.
Definition: Sprinter.h:321
static const SprinterLayout cmdLineLayout
Simulates how arguments are given to command line options.
Definition: Sprinter.h:248
Utility for selecting a quantity label Applied by DataSelector.
Definition: StringMatcherList.h:52
StringMatcherList(const TT &... args)
Basic constructor.
Definition: StringMatcherList.h:63
void adaptKey(const std::string &s)
Definition: StringMatcherList.h:176
void addKey(const std::string &arg, const TT &... args)
Define a syntax for quantity key. Will be checked if listed quantity keys do not match.
Definition: StringMatcherList.h:107
virtual ~StringMatcherList()
Destructor.
Definition: StringMatcherList.h:76
bool test(const std::string &key, bool defaultResult=true) const
Check if key is accepted.
Definition: StringMatcherList.h:204
StringMatcherList(const StringMatcherList< T > &slct)
Copy constructor. Copies the list of quantities.
Definition: StringMatcherList.h:70
void setKey(const std::string &arg, const TT &... args)
Define the list of accepted quantities.
Definition: StringMatcherList.h:86
void setKeys(const std::string &args)
Define the list of accepted quantities as a string.
Definition: StringMatcherList.h:158
Definition: DataSelector.cpp:1277