diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-18 07:44:48 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-18 07:55:34 +0100 |
| commit | 9eec329ebdf4cf079619edb58dbcd78ce42b8626 (patch) | |
| tree | b9b6d442f8a92fea4c8943a1504dba105b133596 /dev/lib/core | |
| parent | ce3ce66e005eb54b315dbc0c78a74e56e2db4191 (diff) | |
feat: lib: error_handler improvements, new method. FIX module improvements.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/lib/core')
| -rw-r--r-- | dev/lib/core/error_handler.hpp | 13 | ||||
| -rw-r--r-- | dev/lib/core/includes.hpp | 9 |
2 files changed, 21 insertions, 1 deletions
diff --git a/dev/lib/core/error_handler.hpp b/dev/lib/core/error_handler.hpp index 67bf7b4..4234721 100644 --- a/dev/lib/core/error_handler.hpp +++ b/dev/lib/core/error_handler.hpp @@ -23,7 +23,18 @@ namespace ocl basic_error_handler& operator=(const basic_error_handler&) = delete; basic_error_handler(const basic_error_handler&) = delete; - virtual void operator()(const std::basic_string<char>& msg) + template <bool throw_too = false> + void error(const std::basic_string<char>& msg) + { + this->operator()(msg); + + if constexpr (throw_too) + { + throw std::runtime_error(msg); + } + } + + void operator()(const std::basic_string<char>& msg) { ocl::io::print(msg); } diff --git a/dev/lib/core/includes.hpp b/dev/lib/core/includes.hpp index ff59535..78eccd3 100644 --- a/dev/lib/core/includes.hpp +++ b/dev/lib/core/includes.hpp @@ -12,3 +12,12 @@ #include <boost/core/demangle.hpp> #include <boost/core/null_deleter.hpp> #include <boost/container/allocator.hpp> + +namespace ocl +{ +#ifdef OCL_USE_UTF8 + using char_type = char8_t; +#else + using char_type = char; +#endif +} // namespace ocl
\ No newline at end of file |
