tclap  1.4.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  * 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 #include <string>
31 
32 // If Microsoft has already typedef'd wchar_t as an unsigned
33 // short, then compiles will break because it's as if we're
34 // creating ArgTraits twice for unsigned short. Thus...
35 #ifdef _MSC_VER
36 #ifndef _NATIVE_WCHAR_T_DEFINED
37 #define TCLAP_DONT_DECLARE_WCHAR_T_ARGTRAITS
38 #endif
39 #endif
40 
41 namespace TCLAP {
42 
43 // Integer types (signed, unsigned and bool) and floating point types all
44 // have value-like semantics.
45 
46 // Strings have string like argument traits.
47 template <>
48 struct ArgTraits<std::string> {
50 };
51 
52 template <typename T>
53 void SetString(T &dst, const std::string &src) {
54  dst = src;
55 }
56 
57 } // namespace TCLAP
58 
59 #endif // TCLAP_STANDARD_TRAITS_H
Arg traits are used to get compile type specialization when parsing argument values.
Definition: ArgTraits.h:82
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
Definition: Arg.h:46