tclap  1.2.0
StandardTraits.h
Go to the documentation of this file.
1 // -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
2 
3 /******************************************************************************
4  *
5  * file: StandardTraits.h
6  *
7  * Copyright (c) 2007, Daniel Aarno, Michael E. Smoot .
8  * All rights reverved.
9  *
10  * See the file COPYING in the top directory of this distribution for
11  * more information.
12  *
13  * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
14  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
19  * DEALINGS IN THE SOFTWARE.
20  *
21  *****************************************************************************/
22 
23 // This is an internal tclap file, you should probably not have to
24 // include this directly
25 
26 #ifndef TCLAP_STANDARD_TRAITS_H
27 #define TCLAP_STANDARD_TRAITS_H
28 
29 #ifdef HAVE_CONFIG_H
30 #include <config.h> // To check for long long
31 #endif
32 
33 namespace TCLAP {
34 
35 // ======================================================================
36 // Integer types
37 // ======================================================================
38 
42 template<>
43 struct ArgTraits<long> {
45 };
46 
50 template<>
51 struct ArgTraits<int> {
53 };
54 
58 template<>
59 struct ArgTraits<short> {
61 };
62 
66 template<>
67 struct ArgTraits<char> {
69 };
70 
71 #ifdef HAVE_LONG_LONG
72 
75 template<>
76 struct ArgTraits<long long> {
77  typedef ValueLike ValueCategory;
78 };
79 #endif
80 
81 // ======================================================================
82 // Unsigned integer types
83 // ======================================================================
84 
88 template<>
89 struct ArgTraits<unsigned long> {
91 };
92 
96 template<>
97 struct ArgTraits<unsigned int> {
99 };
100 
104 template<>
105 struct ArgTraits<unsigned short> {
107 };
108 
112 template<>
113 struct ArgTraits<unsigned char> {
115 };
116 
117 #ifdef HAVE_LONG_LONG
118 
121 template<>
122 struct ArgTraits<unsigned long long> {
123  typedef ValueLike ValueCategory;
124 };
125 #endif
126 
127 // ======================================================================
128 // Float types
129 // ======================================================================
130 
134 template<>
135 struct ArgTraits<float> {
137 };
138 
142 template<>
143 struct ArgTraits<double> {
145 };
146 
147 // ======================================================================
148 // Other types
149 // ======================================================================
150 
154 template<>
155 struct ArgTraits<bool> {
157 };
158 
162 template<>
163 struct ArgTraits<wchar_t> {
165 };
166 
170 template<>
171 struct ArgTraits<std::string> {
173 };
174 
175 template<typename T>
176 void SetString(T &dst, const std::string &src)
177 {
178  dst = src;
179 }
180 
181 } // namespace
182 
183 #endif
184