StandardTraits.h
Go to the documentation of this file.
00001 // -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
00002 
00003 /******************************************************************************
00004  *
00005  *  file:  StandardTraits.h
00006  *
00007  *  Copyright (c) 2007, Daniel Aarno, Michael E. Smoot .
00008  *  All rights reverved.
00009  *
00010  *  See the file COPYING in the top directory of this distribution for
00011  *  more information.
00012  *
00013  *  THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
00014  *  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00015  *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
00016  *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00017  *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00018  *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00019  *  DEALINGS IN THE SOFTWARE.
00020  *
00021  *****************************************************************************/
00022 
00023 // This is an internal tclap file, you should probably not have to
00024 // include this directly
00025 
00026 #ifndef TCLAP_STANDARD_TRAITS_H
00027 #define TCLAP_STANDARD_TRAITS_H
00028 
00029 #ifdef HAVE_CONFIG_H
00030 #include <config.h> // To check for long long
00031 #endif
00032 
00033 // If Microsoft has already typedef'd wchar_t as an unsigned 
00034 // short, then compiles will break because it's as if we're
00035 // creating ArgTraits twice for unsigned short. Thus...
00036 #ifdef _MSC_VER
00037 #ifndef _NATIVE_WCHAR_T_DEFINED
00038 #define TCLAP_DONT_DECLARE_WCHAR_T_ARGTRAITS
00039 #endif
00040 #endif
00041 
00042 namespace TCLAP {
00043 
00044 // ======================================================================
00045 // Integer types
00046 // ======================================================================
00047 
00051 template<>
00052 struct ArgTraits<long> {
00053     typedef ValueLike ValueCategory;
00054 };
00055 
00059 template<>
00060 struct ArgTraits<int> {
00061     typedef ValueLike ValueCategory;
00062 };
00063 
00067 template<>
00068 struct ArgTraits<short> {
00069     typedef ValueLike ValueCategory;
00070 };
00071 
00075 template<>
00076 struct ArgTraits<char> {
00077     typedef ValueLike ValueCategory;
00078 };
00079 
00080 #ifdef HAVE_LONG_LONG
00081 
00084 template<>
00085 struct ArgTraits<long long> {
00086     typedef ValueLike ValueCategory;
00087 };
00088 #endif
00089 
00090 // ======================================================================
00091 // Unsigned integer types
00092 // ======================================================================
00093 
00097 template<>
00098 struct ArgTraits<unsigned long> {
00099     typedef ValueLike ValueCategory;
00100 };
00101 
00105 template<>
00106 struct ArgTraits<unsigned int> {
00107     typedef ValueLike ValueCategory;
00108 };
00109 
00113 template<>
00114 struct ArgTraits<unsigned short> {
00115     typedef ValueLike ValueCategory;
00116 };
00117 
00121 template<>
00122 struct ArgTraits<unsigned char> {
00123     typedef ValueLike ValueCategory;
00124 };
00125 
00126 // Microsoft implements size_t awkwardly. 
00127 #if defined(_MSC_VER) && defined(_M_X64)
00128 
00131 template<>
00132 struct ArgTraits<size_t> {
00133     typedef ValueLike ValueCategory;
00134 };
00135 #endif
00136 
00137 
00138 #ifdef HAVE_LONG_LONG
00139 
00142 template<>
00143 struct ArgTraits<unsigned long long> {
00144     typedef ValueLike ValueCategory;
00145 };
00146 #endif
00147 
00148 // ======================================================================
00149 // Float types
00150 // ======================================================================
00151 
00155 template<>
00156 struct ArgTraits<float> {
00157     typedef ValueLike ValueCategory;
00158 };
00159 
00163 template<>
00164 struct ArgTraits<double> {
00165     typedef ValueLike ValueCategory;
00166 };
00167 
00168 // ======================================================================
00169 // Other types
00170 // ======================================================================
00171 
00175 template<>
00176 struct ArgTraits<bool> {
00177     typedef ValueLike ValueCategory;
00178 };
00179 
00180 
00184 #ifndef TCLAP_DONT_DECLARE_WCHAR_T_ARGTRAITS
00185 template<>
00186 struct ArgTraits<wchar_t> {
00187     typedef ValueLike ValueCategory;
00188 };
00189 #endif
00190 
00194 template<>
00195 struct ArgTraits<std::string> {
00196     typedef StringLike ValueCategory;
00197 };
00198 
00199 template<typename T>
00200 void SetString(T &dst, const std::string &src)
00201 {
00202     dst = src;
00203 }
00204 
00205 } // namespace
00206 
00207 #endif
00208 


mapstitch
Author(s): Philipp M. Scholl
autogenerated on Mon Oct 6 2014 02:09:53