tclap: StandardTraits.h Source File

Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

# 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 namespace TCLAP {
    00034
    00035 // ======================================================================
    00036 // Integer types
    00037 // ======================================================================
    00038
    00042 template<>
    00043 struct ArgTraits<long> {
    00044     typedef ValueLike ValueCategory;
    00045 };
    00046
    00050 template<>
    00051 struct ArgTraits<int> {
    00052     typedef ValueLike ValueCategory;
    00053 };
    00054
    00058 template<>
    00059 struct ArgTraits<short> {
    00060     typedef ValueLike ValueCategory;
    00061 };
    00062
    00066 template<>
    00067 struct ArgTraits<char> {
    00068     typedef ValueLike ValueCategory;
    00069 };
    00070
    00071 #ifdef HAVE_LONG_LONG
    00072
    00075 template<>
    00076 struct ArgTraits<long long> {
    00077     typedef ValueLike ValueCategory;
    00078 };
    00079 #endif
    00080
    00081 // ======================================================================
    00082 // Unsigned integer types
    00083 // ======================================================================
    00084
    00088 template<>
    00089 struct ArgTraits<unsigned long> {
    00090     typedef ValueLike ValueCategory;
    00091 };
    00092
    00096 template<>
    00097 struct ArgTraits<unsigned int> {
    00098     typedef ValueLike ValueCategory;
    00099 };
    00100
    00104 template<>
    00105 struct ArgTraits<unsigned short> {
    00106     typedef ValueLike ValueCategory;
    00107 };
    00108
    00112 template<>
    00113 struct ArgTraits<unsigned char> {
    00114     typedef ValueLike ValueCategory;
    00115 };
    00116
    00117 #ifdef HAVE_LONG_LONG
    00118
    00121 template<>
    00122 struct ArgTraits<unsigned long long> {
    00123     typedef ValueLike ValueCategory;
    00124 };
    00125 #endif
    00126
    00127 // ======================================================================
    00128 // Float types
    00129 // ======================================================================
    00130
    00134 template<>
    00135 struct ArgTraits<float> {
    00136     typedef ValueLike ValueCategory;
    00137 };
    00138
    00142 template<>
    00143 struct ArgTraits<double> {
    00144     typedef ValueLike ValueCategory;
    00145 };
    00146
    00147 // ======================================================================
    00148 // Other types
    00149 // ======================================================================
    00150
    00154 template<>
    00155 struct ArgTraits<bool> {
    00156     typedef ValueLike ValueCategory;
    00157 };
    00158
    00162 template<>
    00163 struct ArgTraits<wchar_t> {
    00164     typedef ValueLike ValueCategory;
    00165 };
    00166
    00170 template<>
    00171 struct ArgTraits<std::string> {
    00172     typedef StringLike ValueCategory;
    00173 };
    00174
    00175 template<typename T>
    00176 void SetString(T &dst, const std::string &src)
    00177 {
    00178     dst = src;
    00179 }
    00180
    00181 } // namespace
    00182
    00183 #endif
    00184