tclap 1.2.5
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 * Copyright (c) 2017, Google LLC
9 * All rights reserved.
10 *
11 * See the file COPYING in the top directory of this distribution for
12 * more information.
13 *
14 * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 *
22 *****************************************************************************/
23
24// This is an internal tclap file, you should probably not have to
25// include this directly
26
27#ifndef TCLAP_STANDARD_TRAITS_H
28#define TCLAP_STANDARD_TRAITS_H
29
30#ifdef HAVE_CONFIG_H
31#include <config.h> // To check for long long
32#endif
33
34// If Microsoft has already typedef'd wchar_t as an unsigned
35// short, then compiles will break because it's as if we're
36// creating ArgTraits twice for unsigned short. Thus...
37#ifdef _MSC_VER
38#ifndef _NATIVE_WCHAR_T_DEFINED
39#define TCLAP_DONT_DECLARE_WCHAR_T_ARGTRAITS
40#endif
41#endif
42
43namespace TCLAP {
44
45// Integer types (signed, unsigned and bool) and floating point types all
46// have value-like semantics.
47
48// Strings have string like argument traits.
49template<>
50struct ArgTraits<std::string> {
52};
53
54template<typename T>
55void SetString(T &dst, const std::string &src)
56{
57 dst = src;
58}
59
60} // namespace
61
62#endif
63
Arg traits are used to get compile type specialization when parsing argument values.
Definition: ArgTraits.h:82
Definition: Arg.h:48
void SetString(T &dst, const std::string &src)
A string like argument value type is a value that can be set using operator=(string).
Definition: ArgTraits.h:49