2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
15 \brief STLSupport internal header */
17 #ifndef IH_SENF_senf_Utils_Console_STLSupport_
18 #define IH_SENF_senf_Utils_Console_STLSupport_ 1
22 //-/////////////////////////////////////////////////////////////////////////////////////////////////
28 template <class Collection>
29 struct CollectionArgumentTraitsBase
31 typedef Collection type;
32 static bool const singleToken = false;
34 static std::string description();
35 static std::string str(Collection const & value);
38 template <class Collection, class Adder>
39 struct CollectionArgumentTraits
40 : detail::CollectionArgumentTraitsBase<Collection>
42 static void parse(ParseCommandInfo::TokensRange const & tokens, Collection & out);
45 template <class Collection>
46 struct CollectionReturnValueTraits
48 typedef Collection type;
50 static void format(Collection const & value, std::ostream & os);
53 struct PushBackFunctor
55 template <class Sequence, class ValueType>
56 static void add(Sequence & seq, ValueType const & value);
61 template <class Collection, class ValueType>
62 static void add(Collection & seq, ValueType const & value);
65 template <class Collection>
66 struct MapArgumentTraits
68 typedef Collection type;
69 static bool const singleToken = false;
71 static void parse(ParseCommandInfo::TokensRange const & tokens, Collection & out);
72 static std::string description();
73 static std::string str(Collection const & value);
76 template <class Collection>
77 struct MapReturnValueTraits
79 typedef Collection type;
81 static void format(Collection const & value, std::ostream & os);
84 #ifdef SENF_CXX11_ENABLED
86 template <typename TupleType, std::size_t Index, std::size_t MaxIndex>
89 static void parse(CheckedArgumentIteratorWrapper & arg, TupleType & out);
90 static void description(std::stringstream & ss);
91 static void format(TupleType const & value, std::ostream & os);
94 template <typename TupleType, std::size_t MaxIndex>
95 struct TupleHelper<TupleType, MaxIndex, MaxIndex>
97 static void parse(CheckedArgumentIteratorWrapper & arg, TupleType & out);
98 static void description(std::stringstream & ss);
99 static void format(TupleType const & value, std::ostream & os);
106 //-/////////////////////////////////////////////////////////////////////////////////////////////////
113 // comment-column: 40
114 // c-file-style: "senf"
115 // indent-tabs-mode: nil
116 // ispell-local-dictionary: "american"
117 // compile-command: "scons -u test"