89c51f7d2484b39b4f241a01a19b7f57a16d671f
[senf.git] / senf / Utils / Console / STLSupport.hh
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 public header */
25
26 #ifndef HH_SENF_Utils_Console_STLSupport_
27 #define HH_SENF_Utils_Console_STLSupport_ 1
28
29 // Custom includes
30 #include <vector>
31 #include <list>
32 #include "Traits.hh"
33
34 //#include "STLSupport.mpp"
35 #include "STLSupport.ih"
36 ///////////////////////////////hh.p////////////////////////////////////////
37
38 namespace senf {
39 namespace console {
40
41 #ifndef DOXYGEN
42
43     template <class T, class Alloc>
44     struct ArgumentTraits< std::vector<T,Alloc> >
45         : public detail::CollectionArgumentTraits< std::vector<T,Alloc>,
46                                                    detail::PushBackFunctor >
47     {};
48
49     template <class T, class Alloc>
50     struct ReturnValueTraits< std::vector<T,Alloc> >
51         : public detail::CollectionReturnValueTraits< std::vector<T,Alloc> >
52     {};
53
54     template <class T, class Alloc>
55     struct ArgumentTraits< std::list<T,Alloc> >
56         : public detail::CollectionArgumentTraits< std::list<T,Alloc>,
57                                                    detail::PushBackFunctor >
58     {};
59
60     template <class T, class Alloc>
61     struct ReturnValueTraits< std::list<T,Alloc> >
62         : public detail::CollectionReturnValueTraits< std::list<T,Alloc> >
63     {};
64
65     template <class Key, class Compare, class Alloc>
66     struct ArgumentTraits< std::set<Key,Compare,Alloc> >
67         : public detail::CollectionArgumentTraits< std::set<Key,Compare,Alloc>,
68                                                    detail::InsertFunctor >
69     {};
70
71     template <class Key, class Compare, class Alloc>
72     struct ReturnValueTraits< std::set<Key,Compare,Alloc> >
73         : public detail::CollectionReturnValueTraits< std::set<Key,Compare,Alloc> >
74     {};
75
76     template <class Key, class Compare, class Alloc>
77     struct ArgumentTraits< std::multiset<Key,Compare,Alloc> >
78         : public detail::CollectionArgumentTraits< std::multiset<Key,Compare,Alloc>,
79                                                    detail::InsertFunctor >
80     {};
81
82     template <class Key, class Compare, class Alloc>
83     struct ReturnValueTraits< std::multiset<Key,Compare,Alloc> >
84         : public detail::CollectionReturnValueTraits< std::multiset<Key,Compare,Alloc> >
85     {};
86
87     template <class Key, class Data, class Compare, class Alloc>
88     struct ArgumentTraits< std::map<Key,Data,Compare,Alloc> >
89         : public detail::MapArgumentTraits< std::map<Key,Data,Compare,Alloc> >
90     {};
91
92     template <class Key, class Data, class Compare, class Alloc>
93     struct ReturnValueTraits< std::map<Key,Data,Compare,Alloc> >
94         : public detail::MapReturnValueTraits< std::map<Key,Data,Compare,Alloc> >
95     {};
96
97     template <class Key, class Data, class Compare, class Alloc>
98     struct ArgumentTraits< std::multimap<Key,Data,Compare,Alloc> >
99         : public detail::MapArgumentTraits< std::multimap<Key,Data,Compare,Alloc> >
100     {};
101
102     template <class Key, class Data, class Compare, class Alloc>
103     struct ReturnValueTraits< std::multimap<Key,Data,Compare,Alloc> >
104         : public detail::MapReturnValueTraits< std::multimap<Key,Data,Compare,Alloc> >
105     {};
106
107     template <class T1, class T2>
108     struct ArgumentTraits< std::pair<T1,T2> >
109     {
110         typedef std::pair<T1,T2> type;
111         static bool const singleToken = false;
112
113         static void parse(ParseCommandInfo::TokensRange const & tokens, type & out);
114         static std::string description();
115         static std::string str(type const & value);
116     };
117
118     template <class T1, class T2>
119     struct ReturnValueTraits< std::pair<T1,T2> >
120     {
121         typedef std::pair<T1,T2> type;
122
123         static void format(type const & value, std::ostream & os);
124     };
125
126 #endif
127
128 }}
129
130 ///////////////////////////////hh.e////////////////////////////////////////
131 //#include "STLSupport.cci"
132 #include "STLSupport.ct"
133 #include "STLSupport.cti"
134 #endif
135
136 \f
137 // Local Variables:
138 // mode: c++
139 // fill-column: 100
140 // comment-column: 40
141 // c-file-style: "senf"
142 // indent-tabs-mode: nil
143 // ispell-local-dictionary: "american"
144 // compile-command: "scons -u test"
145 // End: