summaryrefslogtreecommitdiffhomepage
path: root/dev
diff options
context:
space:
mode:
Diffstat (limited to 'dev')
-rw-r--r--dev/examples/allocator_system/allocator_system.cc2
-rw-r--r--dev/lib/core/chunk_string.hpp (renamed from dev/lib/utility/chunk_string.hpp)0
-rw-r--r--dev/lib/logic/opt.hpp17
-rw-r--r--dev/lib/memory/allocator_system.hpp (renamed from dev/lib/core/allocator_system.hpp)0
-rw-r--r--dev/tests/chunk_string/chunk_test.cc2
5 files changed, 17 insertions, 4 deletions
diff --git a/dev/examples/allocator_system/allocator_system.cc b/dev/examples/allocator_system/allocator_system.cc
index c3cd689..67c3aca 100644
--- a/dev/examples/allocator_system/allocator_system.cc
+++ b/dev/examples/allocator_system/allocator_system.cc
@@ -5,7 +5,7 @@
* Copyright 2025, Amlal El Mahrouss. Licensed under the BSL 1.0 license
*/
-#include <lib/core/allocator_system.hpp>
+#include <lib/memory/allocator_system.hpp>
#include <iostream>
struct MyClass
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/logic/opt.hpp b/dev/lib/logic/opt.hpp
index 442756c..eff08eb 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,16 +28,28 @@ 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;
+ }
+
private:
return_type m_ret;
};
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
diff --git a/dev/tests/chunk_string/chunk_test.cc b/dev/tests/chunk_string/chunk_test.cc
index ad3d31b..be7a457 100644
--- a/dev/tests/chunk_string/chunk_test.cc
+++ b/dev/tests/chunk_string/chunk_test.cc
@@ -7,7 +7,7 @@
#include <lib/io/print.hpp>
#include <lib/tests/gtest.hpp>
-#include <lib/utility/chunk_string.hpp>
+#include <lib/core/chunk_string.hpp>
TEST(ChunkTest, BasicChunkUsage)
{