b99b213df7954d35f451b5db5b71c993cd59f0e4
[senf.git] / senf / Utils / Console / STLSupport.ih
1 // $Id$
2 //
3 // Copyright (C) 2009
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 //     Stefan Bund <g0dil@berlios.de>
7 //
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22
23 /** \file
24     \brief STLSupport internal header */
25
26 #ifndef IH_SENF_senf_Utils_Console_STLSupport_
27 #define IH_SENF_senf_Utils_Console_STLSupport_ 1
28
29 // Custom includes
30
31 //-/////////////////////////////////////////////////////////////////////////////////////////////////
32
33 namespace senf {
34 namespace console {
35 namespace detail {
36
37     template <class Collection>
38     struct CollectionArgumentTraitsBase
39     {
40         typedef Collection type;
41         static bool const singleToken = false;
42
43         static std::string description();
44         static std::string str(Collection const & value);
45     };
46
47     template <class Collection, class Adder>
48     struct CollectionArgumentTraits
49         : detail::CollectionArgumentTraitsBase<Collection>
50     {
51         static void parse(ParseCommandInfo::TokensRange const & tokens, Collection  & out);
52     };
53
54     template <class Collection>
55     struct CollectionReturnValueTraits
56     {
57         typedef Collection type;
58
59         static void format(Collection const & value, std::ostream & os);
60     };
61
62     struct PushBackFunctor
63     {
64         template <class Sequence, class ValueType>
65         static void add(Sequence & seq, ValueType const & value);
66     };
67
68     struct InsertFunctor
69     {
70         template <class Collection, class ValueType>
71         static void add(Collection & seq, ValueType const & value);
72     };
73
74     template <class Collection>
75     struct MapArgumentTraits
76     {
77         typedef Collection type;
78         static bool const singleToken = false;
79
80         static void parse(ParseCommandInfo::TokensRange const & tokens, Collection & out);
81         static std::string description();
82         static std::string str(Collection const & value);
83     };
84
85     template <class Collection>
86     struct MapReturnValueTraits
87     {
88         typedef Collection type;
89
90         static void format(Collection const & value, std::ostream & os);
91     };
92
93 }}}
94
95 //-/////////////////////////////////////////////////////////////////////////////////////////////////
96 #endif
97
98 \f
99 // Local Variables:
100 // mode: c++
101 // fill-column: 100
102 // comment-column: 40
103 // c-file-style: "senf"
104 // indent-tabs-mode: nil
105 // ispell-local-dictionary: "american"
106 // compile-command: "scons -u test"
107 // End: