From 6b2d5afa6b779dcb4d33d50b14cf2291329ee8f1 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Thu, 24 Mar 2016 03:14:18 +0100 Subject: [PATCH] move utf8_Error to *.h --- include/nana/deploy.hpp | 11 +++++++++++ source/deploy.cpp | 10 +--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/include/nana/deploy.hpp b/include/nana/deploy.hpp index f172fb71..f031c66d 100644 --- a/include/nana/deploy.hpp +++ b/include/nana/deploy.hpp @@ -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); diff --git a/source/deploy.cpp b/source/deploy.cpp index 0e6b0faf..bf2f69d2 100644 --- a/source/deploy.cpp +++ b/source/deploy.cpp @@ -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 };