Register all character types
This commit is contained in:
@@ -157,7 +157,12 @@ namespace chaiscript
|
|||||||
/// Internal function for converting from a string to a value
|
/// Internal function for converting from a string to a value
|
||||||
/// uses ostream operator >> to perform the conversion
|
/// uses ostream operator >> to perform the conversion
|
||||||
template<typename Input>
|
template<typename Input>
|
||||||
Input parse_string(const std::string &i)
|
auto parse_string(const std::string &i)
|
||||||
|
-> typename std::enable_if<
|
||||||
|
!std::is_same<Input, wchar_t>::value
|
||||||
|
&& !std::is_same<Input, char16_t>::value
|
||||||
|
&& !std::is_same<Input, char32_t>::value,
|
||||||
|
Input>::type
|
||||||
{
|
{
|
||||||
std::stringstream ss(i);
|
std::stringstream ss(i);
|
||||||
Input t;
|
Input t;
|
||||||
@@ -165,6 +170,17 @@ namespace chaiscript
|
|||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename Input>
|
||||||
|
auto parse_string(const std::string &)
|
||||||
|
-> typename std::enable_if<
|
||||||
|
std::is_same<Input, wchar_t>::value
|
||||||
|
|| std::is_same<Input, char16_t>::value
|
||||||
|
|| std::is_same<Input, char32_t>::value,
|
||||||
|
Input>::type
|
||||||
|
{
|
||||||
|
throw std::runtime_error("Parsing of wide characters is not yet supported");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Add all common functions for a POD type. All operators, and
|
/// Add all common functions for a POD type. All operators, and
|
||||||
/// common conversions
|
/// common conversions
|
||||||
@@ -486,6 +502,9 @@ namespace chaiscript
|
|||||||
bootstrap_pod_type<unsigned long>("unsigned_long", m);
|
bootstrap_pod_type<unsigned long>("unsigned_long", m);
|
||||||
bootstrap_pod_type<size_t>("size_t", m);
|
bootstrap_pod_type<size_t>("size_t", m);
|
||||||
bootstrap_pod_type<char>("char", m);
|
bootstrap_pod_type<char>("char", m);
|
||||||
|
bootstrap_pod_type<wchar_t>("wchar_t", m);
|
||||||
|
bootstrap_pod_type<char16_t>("char16_t", m);
|
||||||
|
bootstrap_pod_type<char32_t>("char32_t", m);
|
||||||
bootstrap_pod_type<std::int8_t>("int8_t", m);
|
bootstrap_pod_type<std::int8_t>("int8_t", m);
|
||||||
bootstrap_pod_type<std::int16_t>("int16_t", m);
|
bootstrap_pod_type<std::int16_t>("int16_t", m);
|
||||||
bootstrap_pod_type<std::int32_t>("int32_t", m);
|
bootstrap_pod_type<std::int32_t>("int32_t", m);
|
||||||
|
Reference in New Issue
Block a user