Merge remote-tracking branch 'cnjinhao/hotfix-1.3' into geometric_scheme

This commit is contained in:
qPCR4vir 2016-04-12 20:35:49 +02:00
commit b04c290ae7
3 changed files with 28 additions and 0 deletions

View File

@ -121,6 +121,13 @@ namespace nana
using std::runtime_error::runtime_error; using std::runtime_error::runtime_error;
#if defined(_MSC_VER)
# if (_MSC_VER < 1900)
//A workaround for lack support of C++11 inheriting constructors for VC2013
explicit utf8_Error(const std::string& msg);
# endif
#endif
void emit(); void emit();
}; };

View File

@ -1162,12 +1162,21 @@ namespace nana
{ {
switch(encoding) switch(encoding)
{ {
#if defined(NANA_WINDOWS)
case unicode::utf8: case unicode::utf8:
return utf16_to_utf8(wcstr); return utf16_to_utf8(wcstr);
case unicode::utf32: case unicode::utf32:
return utf16_to_utf32(wcstr); return utf16_to_utf32(wcstr);
case unicode::utf16: case unicode::utf16:
return wcstr; return wcstr;
#else //POSIX
case unicode::utf8:
return utf32_to_utf8(wcstr);
case unicode::utf16:
return utf32_to_utf16(wcstr);
case unicode::utf32:
return wcstr;
#endif
} }
} }
return {}; return {};

View File

@ -513,6 +513,17 @@ namespace nana
return true; return true;
} }
//class utf8_Error
#if defined(_MSC_VER)
# if (_MSC_VER < 1900)
//A workaround for lack support of C++11 inheriting constructors for VC2013
utf8_Error::utf8_Error(const std::string& msg)
: std::runtime_error(msg)
{}
# endif
#endif
void utf8_Error::emit() void utf8_Error::emit()
{ {
if (use_throw) if (use_throw)
@ -522,6 +533,7 @@ namespace nana
//bool utf8_Error::use_throw{true}; //bool utf8_Error::use_throw{true};
bool utf8_Error::use_throw{ false }; bool utf8_Error::use_throw{ false };
//end class utf8_Error
void throw_not_utf8(const std::string& text) void throw_not_utf8(const std::string& text)
{ {