Mirror reflection library 0.5.13
|
00001 00011 #ifndef MIRROR_UTILS_LEX_CONV_1011291729_HPP 00012 #define MIRROR_UTILS_LEX_CONV_1011291729_HPP 00013 00014 #include <mirror/config.hpp> 00015 #include <mirror/utils/lex_conv/base.hpp> 00016 #include <mirror/utils/lex_conv/bool.hpp> 00017 #include <mirror/utils/lex_conv/character.hpp> 00018 #include <mirror/utils/lex_conv/std_tm.hpp> 00019 00020 MIRROR_NAMESPACE_BEGIN 00021 00023 00026 template <typename Source, typename Target> 00027 struct lex_conv; 00028 00029 template <typename Source, typename Target> 00030 struct lex_conv : public aux::_lex_conv<Source, Target> 00031 { 00032 }; 00033 00034 template <typename Target> 00035 struct lex_conv<std::string, Target> 00036 : public aux::_lex_conv<std::string, Target> 00037 { 00038 inline Target operator()(const std::string& value) const 00039 { 00040 std::string::const_iterator i = value.begin(); 00041 return this->convert(i, value.end()); 00042 } 00043 }; 00044 00045 template <typename T> 00046 struct lex_conv<T, T> 00047 { 00048 inline T operator()(T value) const 00049 { 00050 return value; 00051 } 00052 }; 00053 00054 template <> 00055 struct lex_conv<std::string, std::string> 00056 { 00057 template <typename Iterator> 00058 inline std::string convert(Iterator b, Iterator e) const 00059 { 00060 return std::string(b, e); 00061 } 00062 00063 inline std::string operator()(std::string value) const 00064 { 00065 return value; 00066 } 00067 }; 00068 00069 00070 MIRROR_NAMESPACE_END 00071 00072 #endif //include guard 00073