move utf8_Error to *.h

This commit is contained in:
qPCR4vir 2016-03-24 03:14:18 +01:00
parent 4b2657246d
commit 6b2d5afa6b
2 changed files with 12 additions and 9 deletions

View File

@ -114,6 +114,17 @@ namespace std
namespace nana
{
/// move to *.h ??
struct utf8_Error : std::runtime_error
{
static bool use_throw; ///< def { true }; use carefully - it is a global variable !! \todo initialize from a #define ?
using std::runtime_error::runtime_error;
void emit();
};
/// Checks whether a specified text is utf8 encoding
bool is_utf8(const char* str, unsigned len);
void throw_not_utf8(const std::string& text);

View File

@ -513,20 +513,12 @@ namespace nana
return true;
}
/// move to *.h ??
struct utf8_Error : std::runtime_error
{
static bool use_throw; ///< def { true }; use carefully - it is a global variable !! \todo initialize from a #define ?
using std::runtime_error::runtime_error;
void emit()
void utf8_Error::emit()
{
if (use_throw)
throw utf8_Error(*this);
std::cerr << what();
}
};
//bool utf8_Error::use_throw{true};
bool utf8_Error::use_throw{ false };