Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 namespace
00033 cmtk
00034 {
00035
00038
00040 template<>
00041 inline bool CommandLine::Item::Convert<bool>( const char* str )
00042 {
00043 if ( ! str )
00044 return false;
00045 else
00046 return !strcmp( str, "yes" );
00047 }
00048
00050 template<>
00051 inline float CommandLine::Item::Convert<float>( const char* str )
00052 {
00053 return static_cast<float>( this->ConvertStrToDouble( str ) );
00054 }
00055
00057 template<>
00058 inline double CommandLine::Item::Convert<double>( const char* str )
00059 {
00060 return static_cast<double>( this->ConvertStrToDouble( str ) );
00061 }
00062
00064 template<>
00065 inline long int
00066 CommandLine::Item::Convert<long int>( const char* str )
00067 {
00068 return static_cast<long int>( this->ConvertStrToLong( str ) );
00069 }
00070
00072 template<>
00073 inline int CommandLine::Item::Convert<int>( const char* str )
00074 {
00075 return static_cast<int>( this->ConvertStrToLong( str ) );
00076 }
00077
00079 template<>
00080 inline unsigned int
00081 CommandLine::Item::Convert<unsigned int>( const char* str )
00082 {
00083 return static_cast<unsigned int>( this->ConvertStrToLong( str ) );
00084 }
00085
00087 template<>
00088 inline unsigned long int
00089 CommandLine::Item::Convert<unsigned long int>( const char* str )
00090 {
00091 return static_cast<unsigned long int>( this->ConvertStrToLong( str ) );
00092 }
00093
00095 template<>
00096 inline char
00097 CommandLine::Item::Convert<char>( const char* str )
00098 {
00099 return static_cast<char>( this->ConvertStrToLong( str ) );
00100 }
00101
00103 template<>
00104 inline unsigned char
00105 CommandLine::Item::Convert<unsigned char>( const char* str )
00106 {
00107 return static_cast<unsigned char>( this->ConvertStrToLong( str ) );
00108 }
00109
00111 template<>
00112 inline signed char
00113 CommandLine::Item::Convert<signed char>( const char* str )
00114 {
00115 return static_cast<signed char>( this->ConvertStrToLong( str ) );
00116 }
00117
00119 template<>
00120 inline short
00121 CommandLine::Item::Convert<short>( const char* str )
00122 {
00123 return static_cast<short>( this->ConvertStrToLong( str ) );
00124 }
00125
00127 template<>
00128 inline
00129 const char*
00130 CommandLine::Item::Convert<const char*>( const char* str )
00131 {
00132 return str;
00133 }
00134
00136 template<>
00137 inline
00138 std::vector<std::string>
00139 CommandLine::Item::Convert< std::vector<std::string> >( const char* str )
00140 {
00141 std::vector<std::string> v;
00142 v.push_back( std::string( str ) );
00143 return v;
00144 }
00145
00146 }