move utf8_Error to *.h
This commit is contained in:
parent
4b2657246d
commit
6b2d5afa6b
@ -114,6 +114,17 @@ namespace std
|
|||||||
|
|
||||||
namespace nana
|
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
|
/// Checks whether a specified text is utf8 encoding
|
||||||
bool is_utf8(const char* str, unsigned len);
|
bool is_utf8(const char* str, unsigned len);
|
||||||
void throw_not_utf8(const std::string& text);
|
void throw_not_utf8(const std::string& text);
|
||||||
|
|||||||
@ -513,20 +513,12 @@ namespace nana
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// move to *.h ??
|
void utf8_Error::emit()
|
||||||
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()
|
|
||||||
{
|
{
|
||||||
if (use_throw)
|
if (use_throw)
|
||||||
throw utf8_Error(*this);
|
throw utf8_Error(*this);
|
||||||
std::cerr << what();
|
std::cerr << what();
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
//bool utf8_Error::use_throw{true};
|
//bool utf8_Error::use_throw{true};
|
||||||
bool utf8_Error::use_throw{ false };
|
bool utf8_Error::use_throw{ false };
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user