tclap
1.2.1
include
tclap
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
// If Microsoft has already typedef'd wchar_t as an unsigned
34
// short, then compiles will break because it's as if we're
35
// creating ArgTraits twice for unsigned short. Thus...
36
#ifdef _MSC_VER
37
#ifndef _NATIVE_WCHAR_T_DEFINED
38
#define TCLAP_DONT_DECLARE_WCHAR_T_ARGTRAITS
39
#endif
40
#endif
41
42
namespace
TCLAP
{
43
44
// ======================================================================
45
// Integer types
46
// ======================================================================
47
51
template
<>
52
struct
ArgTraits<long> {
53
typedef
ValueLike
ValueCategory
;
54
};
55
59
template
<>
60
struct
ArgTraits<int> {
61
typedef
ValueLike
ValueCategory
;
62
};
63
67
template
<>
68
struct
ArgTraits<short> {
69
typedef
ValueLike
ValueCategory
;
70
};
71
75
template
<>
76
struct
ArgTraits
<char> {
77
typedef
ValueLike
ValueCategory
;
78
};
79
80
#ifdef HAVE_LONG_LONG
81
84
template
<>
85
struct
ArgTraits
<long long> {
86
typedef
ValueLike
ValueCategory
;
87
};
88
#endif
89
90
// ======================================================================
91
// Unsigned integer types
92
// ======================================================================
93
97
template
<>
98
struct
ArgTraits
<unsigned long> {
99
typedef
ValueLike
ValueCategory
;
100
};
101
105
template
<>
106
struct
ArgTraits
<unsigned int> {
107
typedef
ValueLike
ValueCategory
;
108
};
109
113
template
<>
114
struct
ArgTraits<unsigned short> {
115
typedef
ValueLike
ValueCategory
;
116
};
117
121
template
<>
122
struct
ArgTraits
<unsigned char> {
123
typedef
ValueLike
ValueCategory
;
124
};
125
126
// Microsoft implements size_t awkwardly.
127
#if defined(_MSC_VER) && defined(_M_X64)
128
131
template
<>
132
struct
ArgTraits
<size_t> {
133
typedef
ValueLike
ValueCategory
;
134
};
135
#endif
136
137
138
#ifdef HAVE_LONG_LONG
139
142
template
<>
143
struct
ArgTraits
<unsigned long long> {
144
typedef
ValueLike
ValueCategory
;
145
};
146
#endif
147
148
// ======================================================================
149
// Float types
150
// ======================================================================
151
155
template
<>
156
struct
ArgTraits<float> {
157
typedef
ValueLike
ValueCategory
;
158
};
159
163
template
<>
164
struct
ArgTraits<double> {
165
typedef
ValueLike
ValueCategory
;
166
};
167
168
// ======================================================================
169
// Other types
170
// ======================================================================
171
175
template
<>
176
struct
ArgTraits
<bool> {
177
typedef
ValueLike
ValueCategory
;
178
};
179
180
184
#ifndef TCLAP_DONT_DECLARE_WCHAR_T_ARGTRAITS
185
template
<>
186
struct
ArgTraits
<wchar_t> {
187
typedef
ValueLike
ValueCategory
;
188
};
189
#endif
190
194
template
<>
195
struct
ArgTraits
<std::string> {
196
typedef
StringLike
ValueCategory
;
197
};
198
199
template
<
typename
T>
200
void
SetString
(T &dst,
const
std::string &src)
201
{
202
dst = src;
203
}
204
205
}
// namespace
206
207
#endif
208
TCLAP::StringLike
A string like argument value type is a value that can be set using operator=(string).
Definition:
ArgTraits.h:66
TCLAP::SetString
void SetString(T &dst, const std::string &src)
Definition:
StandardTraits.h:218
TCLAP::ValueLike
A value like argument value type is a value that can be set using operator>>.
Definition:
ArgTraits.h:56
TCLAP::ArgTraits
Arg traits are used to get compile type specialization when parsing argument values.
Definition:
ArgTraits.h:97
TCLAP::ArgTraits< unsigned short >::ValueCategory
ValueLike ValueCategory
Definition:
StandardTraits.h:133
TCLAP::ArgTraits::ValueCategory
T::ValueCategory ValueCategory
Definition:
ArgTraits.h:98
TCLAP
Definition:
Arg.h:57
Generated by
1.8.18