diff options
Diffstat (limited to 'dev/lib')
| -rw-r--r-- | dev/lib/core/chunk_string.hpp (renamed from dev/lib/utility/chunk_string.hpp) | 0 | ||||
| -rw-r--r-- | dev/lib/io/print.hpp | 1 | ||||
| -rw-r--r-- | dev/lib/logic/opt.hpp | 17 | ||||
| -rw-r--r-- | dev/lib/memory/allocator_system.hpp (renamed from dev/lib/core/allocator_system.hpp) | 0 |
4 files changed, 16 insertions, 2 deletions
diff --git a/dev/lib/utility/chunk_string.hpp b/dev/lib/core/chunk_string.hpp index 4fe5cc2..4fe5cc2 100644 --- a/dev/lib/utility/chunk_string.hpp +++ b/dev/lib/core/chunk_string.hpp diff --git a/dev/lib/io/print.hpp b/dev/lib/io/print.hpp index 4b32ddb..307c06f 100644 --- a/dev/lib/io/print.hpp +++ b/dev/lib/io/print.hpp @@ -35,6 +35,7 @@ namespace ocl::io inline void println(T... fmt) noexcept { print(fmt...); + print(); } } // namespace ocl::io diff --git a/dev/lib/logic/opt.hpp b/dev/lib/logic/opt.hpp index 442756c..70bce5e 100644 --- a/dev/lib/logic/opt.hpp +++ b/dev/lib/logic/opt.hpp @@ -20,6 +20,7 @@ namespace ocl count = err - okay + 1, }; + template <typename char_type = char> struct opt final { explicit opt(const return_type& return_type) @@ -27,11 +28,23 @@ namespace ocl { } - opt& expect(const char* input) + opt& expect(const char_type* input) { if (m_ret == return_type::err) { - throw std::runtime_error(input); + throw std::runtime_error(input ? input : "opt::error"); + } + + return *this; + } + + template <typename ErrorHandler> + opt& expect_or_handle(const char_type* input) + { + if (m_ret == return_type::err) + { + ErrorHandler err_handler; + err_handler(input ? input : "opt::error"); } return *this; diff --git a/dev/lib/core/allocator_system.hpp b/dev/lib/memory/allocator_system.hpp index 1243ed5..1243ed5 100644 --- a/dev/lib/core/allocator_system.hpp +++ b/dev/lib/memory/allocator_system.hpp |
