switch to new MPL based Fraunhofer FOKUS Public License
[senf.git] / senf / Utils / Console / STLSupport.hh
1 // $Id$
2 //
3 // Copyright (C) 2009
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 //
6 // The contents of this file are subject to the Fraunhofer FOKUS Public License
7 // Version 1.0 (the "License"); you may not use this file except in compliance
8 // with the License. You may obtain a copy of the License at 
9 // http://senf.berlios.de/license.html
10 //
11 // The Fraunhofer FOKUS Public License Version 1.0 is based on, 
12 // but modifies the Mozilla Public License Version 1.1.
13 // See the full license text for the amendments.
14 //
15 // Software distributed under the License is distributed on an "AS IS" basis, 
16 // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 
17 // for the specific language governing rights and limitations under the License.
18 //
19 // The Original Code is Fraunhofer FOKUS code.
20 //
21 // The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V. 
22 // (registered association), Hansastraße 27 c, 80686 Munich, Germany.
23 // All Rights Reserved.
24 //
25 // Contributor(s):
26 //   Stefan Bund <g0dil@berlios.de>
27
28 /** \file
29     \brief STLSupport public header */
30
31 #ifndef HH_SENF_Utils_Console_STLSupport_
32 #define HH_SENF_Utils_Console_STLSupport_ 1
33
34 // Custom includes
35 #include <vector>
36 #include <list>
37 #include "Traits.hh"
38
39 //#include "STLSupport.mpp"
40 #include "STLSupport.ih"
41 //-/////////////////////////////////////////////////////////////////////////////////////////////////
42
43 namespace senf {
44 namespace console {
45
46 #ifndef DOXYGEN
47
48     template <class T, class Alloc>
49     struct ArgumentTraits< std::vector<T,Alloc> >
50         : public detail::CollectionArgumentTraits< std::vector<T,Alloc>,
51                                                    detail::PushBackFunctor >
52     {};
53
54     template <class T, class Alloc>
55     struct ReturnValueTraits< std::vector<T,Alloc> >
56         : public detail::CollectionReturnValueTraits< std::vector<T,Alloc> >
57     {};
58
59     template <class T, class Alloc>
60     struct ArgumentTraits< std::list<T,Alloc> >
61         : public detail::CollectionArgumentTraits< std::list<T,Alloc>,
62                                                    detail::PushBackFunctor >
63     {};
64
65     template <class T, class Alloc>
66     struct ReturnValueTraits< std::list<T,Alloc> >
67         : public detail::CollectionReturnValueTraits< std::list<T,Alloc> >
68     {};
69
70     template <class Key, class Compare, class Alloc>
71     struct ArgumentTraits< std::set<Key,Compare,Alloc> >
72         : public detail::CollectionArgumentTraits< std::set<Key,Compare,Alloc>,
73                                                    detail::InsertFunctor >
74     {};
75
76     template <class Key, class Compare, class Alloc>
77     struct ReturnValueTraits< std::set<Key,Compare,Alloc> >
78         : public detail::CollectionReturnValueTraits< std::set<Key,Compare,Alloc> >
79     {};
80
81     template <class Key, class Compare, class Alloc>
82     struct ArgumentTraits< std::multiset<Key,Compare,Alloc> >
83         : public detail::CollectionArgumentTraits< std::multiset<Key,Compare,Alloc>,
84                                                    detail::InsertFunctor >
85     {};
86
87     template <class Key, class Compare, class Alloc>
88     struct ReturnValueTraits< std::multiset<Key,Compare,Alloc> >
89         : public detail::CollectionReturnValueTraits< std::multiset<Key,Compare,Alloc> >
90     {};
91
92     template <class Key, class Data, class Compare, class Alloc>
93     struct ArgumentTraits< std::map<Key,Data,Compare,Alloc> >
94         : public detail::MapArgumentTraits< std::map<Key,Data,Compare,Alloc> >
95     {};
96
97     template <class Key, class Data, class Compare, class Alloc>
98     struct ReturnValueTraits< std::map<Key,Data,Compare,Alloc> >
99         : public detail::MapReturnValueTraits< std::map<Key,Data,Compare,Alloc> >
100     {};
101
102     template <class Key, class Data, class Compare, class Alloc>
103     struct ArgumentTraits< std::multimap<Key,Data,Compare,Alloc> >
104         : public detail::MapArgumentTraits< std::multimap<Key,Data,Compare,Alloc> >
105     {};
106
107     template <class Key, class Data, class Compare, class Alloc>
108     struct ReturnValueTraits< std::multimap<Key,Data,Compare,Alloc> >
109         : public detail::MapReturnValueTraits< std::multimap<Key,Data,Compare,Alloc> >
110     {};
111
112     template <class T1, class T2>
113     struct ArgumentTraits< std::pair<T1,T2> >
114     {
115         typedef std::pair<T1,T2> type;
116         static bool const singleToken = false;
117
118         static void parse(ParseCommandInfo::TokensRange const & tokens, type & out);
119         static std::string description();
120         static std::string str(type const & value);
121     };
122
123     template <class T1, class T2>
124     struct ReturnValueTraits< std::pair<T1,T2> >
125     {
126         typedef std::pair<T1,T2> type;
127
128         static void format(type const & value, std::ostream & os);
129     };
130
131 #endif
132
133 }}
134
135 //-/////////////////////////////////////////////////////////////////////////////////////////////////
136 //#include "STLSupport.cci"
137 #include "STLSupport.ct"
138 #include "STLSupport.cti"
139 #endif
140
141 \f
142 // Local Variables:
143 // mode: c++
144 // fill-column: 100
145 // comment-column: 40
146 // c-file-style: "senf"
147 // indent-tabs-mode: nil
148 // ispell-local-dictionary: "american"
149 // compile-command: "scons -u test"
150 // End: