summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Doxyfile6
-rw-r--r--README.md2
-rw-r--r--compile_flags.txt2
-rw-r--r--examples/allocator_system/CMakeLists.txt (renamed from dev/examples/allocator_system/CMakeLists.txt)2
-rw-r--r--examples/allocator_system/allocator_system.cc (renamed from dev/examples/allocator_system/allocator_system.cc)2
-rw-r--r--examples/cgi/CMakeLists.txt (renamed from dev/examples/cgi/CMakeLists.txt)2
-rw-r--r--examples/cgi/cgi.cc (renamed from dev/examples/cgi/cgi.cc)2
-rw-r--r--examples/equiv/CMakeLists.txt (renamed from dev/examples/equiv/CMakeLists.txt)2
-rw-r--r--examples/equiv/equiv.cc (renamed from dev/examples/equiv/equiv.cc)2
-rw-r--r--examples/fix/CMakeLists.txt (renamed from dev/examples/fix/CMakeLists.txt)2
-rw-r--r--examples/fix/fix.cc (renamed from dev/examples/fix/fix.cc)8
-rw-r--r--examples/opt/CMakeLists.txt (renamed from dev/examples/opt/CMakeLists.txt)2
-rw-r--r--examples/opt/opt.cc (renamed from dev/examples/opt/opt.cc)6
-rw-r--r--examples/tracked_ptr/CMakeLists.txt (renamed from dev/examples/tracked_ptr/CMakeLists.txt)2
-rw-r--r--examples/tracked_ptr/tracked_ptr.cc (renamed from dev/examples/tracked_ptr/tracked_ptr.cc)4
-rw-r--r--include/ocl/core/chunk_string.hpp (renamed from dev/lib/core/chunk_string.hpp)6
-rw-r--r--include/ocl/core/error_handler.hpp (renamed from dev/lib/core/error_handler.hpp)4
-rw-r--r--include/ocl/core/includes.hpp (renamed from dev/lib/core/includes.hpp)2
-rw-r--r--include/ocl/except/error.hpp (renamed from dev/lib/except/error.hpp)2
-rw-r--r--include/ocl/fix/fix.hpp (renamed from dev/lib/fix/fix.hpp)51
-rw-r--r--include/ocl/io/print.hpp (renamed from dev/lib/io/print.hpp)0
-rw-r--r--include/ocl/logic/equiv.hpp (renamed from dev/lib/logic/equiv.hpp)0
-rw-r--r--include/ocl/logic/math.hpp (renamed from dev/lib/logic/math.hpp)4
-rw-r--r--include/ocl/logic/opt.hpp (renamed from dev/lib/logic/opt.hpp)2
-rw-r--r--include/ocl/memory/allocator_system.hpp (renamed from dev/lib/memory/allocator_system.hpp)2
-rw-r--r--include/ocl/memory/tracked_ptr.hpp (renamed from dev/lib/memory/tracked_ptr.hpp)30
-rw-r--r--include/ocl/net/modem.hpp (renamed from dev/lib/net/modem.hpp)23
-rw-r--r--include/ocl/net/url.hpp (renamed from dev/lib/net/url.hpp)49
-rw-r--r--include/ocl/simd/basic_simd.hpp (renamed from dev/lib/simd/basic_simd.hpp)2
-rw-r--r--include/ocl/simd/simd.hpp (renamed from dev/lib/simd/simd.hpp)6
-rw-r--r--include/ocl/tests/gtest.hpp (renamed from dev/lib/tests/gtest.hpp)0
-rw-r--r--include/ocl/tests/hpptest.hpp (renamed from dev/lib/tests/hpptest.hpp)10
-rw-r--r--include/ocl/utility/cgi.hpp (renamed from dev/lib/utility/cgi.hpp)6
-rw-r--r--include/ocl/utility/crc32.hpp (renamed from dev/lib/utility/crc32.hpp)0
-rw-r--r--include/ocl/utility/embfs.hpp (renamed from dev/lib/utility/embfs.hpp)2
-rwxr-xr-xmake_dist_linux.sh2
-rwxr-xr-xmake_dist_osx.sh2
-rw-r--r--tests/.gitkeep (renamed from dev/tests/.gitkeep)0
-rw-r--r--tests/chunk_string/CMakeLists.txt (renamed from dev/tests/chunk_string/CMakeLists.txt)2
-rw-r--r--tests/chunk_string/chunk_test.cc (renamed from dev/tests/chunk_string/chunk_test.cc)6
-rw-r--r--tests/fix_basic/CMakeLists.txt (renamed from dev/tests/fix_basic/CMakeLists.txt)2
-rw-r--r--tests/fix_basic/fix_test.cc (renamed from dev/tests/fix_basic/fix_test.cc)12
-rw-r--r--tests/network_basic/CMakeLists.txt (renamed from dev/tests/network_basic/CMakeLists.txt)2
-rw-r--r--tests/network_basic/net_test.cc (renamed from dev/tests/network_basic/net_test.cc)6
-rw-r--r--tests/tracked_ptr_basic/CMakeLists.txt (renamed from dev/tests/tracked_ptr_basic/CMakeLists.txt)2
-rw-r--r--tests/tracked_ptr_basic/tracked_ptr_test.cc (renamed from dev/tests/tracked_ptr_basic/tracked_ptr_test.cc)4
-rw-r--r--tests/tracked_ptr_leak/CMakeLists.txt (renamed from dev/tests/tracked_ptr_leak/CMakeLists.txt)2
-rw-r--r--tests/tracked_ptr_leak/tracked_ptr_test.cc (renamed from dev/tests/tracked_ptr_leak/tracked_ptr_test.cc)4
48 files changed, 150 insertions, 143 deletions
diff --git a/Doxyfile b/Doxyfile
index a558fb4..ffa0254 100644
--- a/Doxyfile
+++ b/Doxyfile
@@ -48,7 +48,7 @@ PROJECT_NAME = "Open C++ Library"
# could be handy for archiving the generated documentation or if some version
# control system is used.
-PROJECT_NUMBER = dev
+PROJECT_NUMBER = develop
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewers a
@@ -74,7 +74,7 @@ PROJECT_ICON =
# entered, it will be relative to the location where Doxygen was started. If
# left blank the current directory will be used.
-OUTPUT_DIRECTORY = ./ocl/docs
+OUTPUT_DIRECTORY = ./docs
# If the CREATE_SUBDIRS tag is set to YES then Doxygen will create up to 4096
# sub-directories (in 2 levels) under the output directory of each output format
@@ -991,7 +991,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.
-INPUT = /Volumes/Projects/src/ocl
+INPUT = ./include/ocl
# This tag can be used to specify the character encoding of the source files
# that Doxygen parses. Internally Doxygen uses the UTF-8 encoding. Doxygen uses
diff --git a/README.md b/README.md
index f7da55c..6d495db 100644
--- a/README.md
+++ b/README.md
@@ -30,7 +30,7 @@ A C++ library with additional modules for your C++ SDLC.
### Logic Module (Option container)
```cpp
-#include <lib/logic/opt.hpp>
+#include <logic/opt.hpp>
int main(int argc, char** argv)
{
diff --git a/compile_flags.txt b/compile_flags.txt
index da935d4..cc97734 100644
--- a/compile_flags.txt
+++ b/compile_flags.txt
@@ -1,4 +1,4 @@
--Idev
+-Iinclude/ocl
-std=c++20
-DEMBFS_28BIT_LBA
-xc++
diff --git a/dev/examples/allocator_system/CMakeLists.txt b/examples/allocator_system/CMakeLists.txt
index ee19842..a4bb69d 100644
--- a/dev/examples/allocator_system/CMakeLists.txt
+++ b/examples/allocator_system/CMakeLists.txt
@@ -13,4 +13,4 @@ add_executable(Alloc allocator_system.cc)
target_link_libraries(Alloc PRIVATE Boost::container)
set_property(TARGET Alloc PROPERTY CXX_STANDARD 20)
-target_include_directories(Alloc PUBLIC ../../)
+target_include_directories(Alloc PUBLIC ../../include/ocl)
diff --git a/dev/examples/allocator_system/allocator_system.cc b/examples/allocator_system/allocator_system.cc
index 6bf1de7..fd7ae56 100644
--- a/dev/examples/allocator_system/allocator_system.cc
+++ b/examples/allocator_system/allocator_system.cc
@@ -5,7 +5,7 @@
* Copyright 2025, Amlal El Mahrouss, Licensed under the Boost Software License. Licensed under the BSL 1.0 license
*/
-#include <lib/memory/allocator_system.hpp>
+#include <memory/allocator_system.hpp>
#include <iostream>
class MyClass final
diff --git a/dev/examples/cgi/CMakeLists.txt b/examples/cgi/CMakeLists.txt
index 9c3cbf6..e30707c 100644
--- a/dev/examples/cgi/CMakeLists.txt
+++ b/examples/cgi/CMakeLists.txt
@@ -13,4 +13,4 @@ add_executable(CGI cgi.cc)
target_link_libraries(CGI PRIVATE Boost::container)
set_property(TARGET CGI PROPERTY CXX_STANDARD 20)
-target_include_directories(CGI PUBLIC ../../)
+target_include_directories(CGI PUBLIC ../../include/ocl)
diff --git a/dev/examples/cgi/cgi.cc b/examples/cgi/cgi.cc
index 3eef7b2..b837433 100644
--- a/dev/examples/cgi/cgi.cc
+++ b/examples/cgi/cgi.cc
@@ -4,7 +4,7 @@
licensed under the Boost Software License
*/
-#include <lib/utility/cgi.hpp>
+#include <utility/cgi.hpp>
static ocl::basic_chunk_string<char> text_sample = R"(
<!DOCTYPE html>
diff --git a/dev/examples/equiv/CMakeLists.txt b/examples/equiv/CMakeLists.txt
index 8b29e23..4a374ce 100644
--- a/dev/examples/equiv/CMakeLists.txt
+++ b/examples/equiv/CMakeLists.txt
@@ -9,4 +9,4 @@ project(
add_executable(Equiv equiv.cc)
set_property(TARGET Equiv PROPERTY CXX_STANDARD 20)
-target_include_directories(Equiv PUBLIC ../../)
+target_include_directories(Equiv PUBLIC ../../include/ocl)
diff --git a/dev/examples/equiv/equiv.cc b/examples/equiv/equiv.cc
index 41128a2..0c68e21 100644
--- a/dev/examples/equiv/equiv.cc
+++ b/examples/equiv/equiv.cc
@@ -4,7 +4,7 @@
licensed under the Boost Software License
*/
-#include <lib/logic/equiv.hpp>
+#include <logic/equiv.hpp>
#include <iostream>
/* finally test it */
diff --git a/dev/examples/fix/CMakeLists.txt b/examples/fix/CMakeLists.txt
index 5ed31e7..4c0a432 100644
--- a/dev/examples/fix/CMakeLists.txt
+++ b/examples/fix/CMakeLists.txt
@@ -12,4 +12,4 @@ add_executable(Fix fix.cc)
target_link_libraries(Fix PRIVATE Boost::container)
set_property(TARGET Fix PROPERTY CXX_STANDARD 20)
-target_include_directories(Fix PUBLIC ../../)
+target_include_directories(Fix PUBLIC ../../include/ocl)
diff --git a/dev/examples/fix/fix.cc b/examples/fix/fix.cc
index e09178b..eabe3ac 100644
--- a/dev/examples/fix/fix.cc
+++ b/examples/fix/fix.cc
@@ -4,12 +4,12 @@
licensed under the Boost Software License
*/
-#include <lib/core/error_handler.hpp>
-#include <lib/net/modem.hpp>
-#include <lib/fix/fix.hpp>
+#include <core/error_handler.hpp>
+#include <net/modem.hpp>
+#include <fix/fix.hpp>
#include <iostream>
#include <unistd.h>
-#include <lib/io/print.hpp>
+#include <io/print.hpp>
#include <sys/socket.h>
/* finally test it */
diff --git a/dev/examples/opt/CMakeLists.txt b/examples/opt/CMakeLists.txt
index b63b1de..e537cec 100644
--- a/dev/examples/opt/CMakeLists.txt
+++ b/examples/opt/CMakeLists.txt
@@ -9,4 +9,4 @@ project(
add_executable(Opt opt.cc)
set_property(TARGET Opt PROPERTY CXX_STANDARD 20)
-target_include_directories(Opt PUBLIC ../../)
+target_include_directories(Opt PUBLIC ../../include/ocl)
diff --git a/dev/examples/opt/opt.cc b/examples/opt/opt.cc
index acd59fd..75abed4 100644
--- a/dev/examples/opt/opt.cc
+++ b/examples/opt/opt.cc
@@ -4,9 +4,9 @@
Licensed under the Boost Software License
*/
-#include <lib/logic/opt.hpp>
-#include <lib/io/print.hpp>
-#include <lib/utility/crc32.hpp>
+#include <logic/opt.hpp>
+#include <io/print.hpp>
+#include <utility/crc32.hpp>
#include <string>
static const char do_hash(const std::string& in)
diff --git a/dev/examples/tracked_ptr/CMakeLists.txt b/examples/tracked_ptr/CMakeLists.txt
index 9396506..ea1312a 100644
--- a/dev/examples/tracked_ptr/CMakeLists.txt
+++ b/examples/tracked_ptr/CMakeLists.txt
@@ -9,4 +9,4 @@ project(
add_executable(TrackedPtr tracked_ptr.cc)
set_property(TARGET TrackedPtr PROPERTY CXX_STANDARD 20)
-target_include_directories(TrackedPtr PUBLIC ../../)
+target_include_directories(TrackedPtr PUBLIC ../../include/ocl)
diff --git a/dev/examples/tracked_ptr/tracked_ptr.cc b/examples/tracked_ptr/tracked_ptr.cc
index 27d942c..0f7c43d 100644
--- a/dev/examples/tracked_ptr/tracked_ptr.cc
+++ b/examples/tracked_ptr/tracked_ptr.cc
@@ -4,8 +4,8 @@
licensed under the Boost Software License
*/
-#include <lib/memory/tracked_ptr.hpp>
-#include <lib/io/print.hpp>
+#include <memory/tracked_ptr.hpp>
+#include <io/print.hpp>
static void summon_tracked_ptr()
{
diff --git a/dev/lib/core/chunk_string.hpp b/include/ocl/core/chunk_string.hpp
index 0ecc73e..1d922de 100644
--- a/dev/lib/core/chunk_string.hpp
+++ b/include/ocl/core/chunk_string.hpp
@@ -8,8 +8,8 @@
#ifndef OCL_UTILITY_CHUNK_STRING_HPP
#define OCL_UTILITY_CHUNK_STRING_HPP
-#include <lib/core/includes.hpp>
-#include <lib/io/print.hpp>
+#include <core/includes.hpp>
+#include <io/print.hpp>
#include <cstring>
namespace ocl
@@ -94,7 +94,7 @@ namespace ocl
std::basic_string<char_type> str() const noexcept
{
static std::basic_string<char_type> ret;
- const auto& sz = ret.size();
+ const auto& sz = ret.size();
if (chunk_total_ > sz)
ret.clear();
diff --git a/dev/lib/core/error_handler.hpp b/include/ocl/core/error_handler.hpp
index 832f109..f761d63 100644
--- a/dev/lib/core/error_handler.hpp
+++ b/include/ocl/core/error_handler.hpp
@@ -8,8 +8,8 @@
#ifndef _OCL_ERROR_HANDLER_HPP
#define _OCL_ERROR_HANDLER_HPP
-#include <lib/core/includes.hpp>
-#include <lib/io/print.hpp>
+#include <core/includes.hpp>
+#include <io/print.hpp>
namespace ocl
{
diff --git a/dev/lib/core/includes.hpp b/include/ocl/core/includes.hpp
index a1c6e86..9ed8ffb 100644
--- a/dev/lib/core/includes.hpp
+++ b/include/ocl/core/includes.hpp
@@ -1,6 +1,6 @@
/*
* File: core/includes.hpp
- * Purpose: Core includes for the OCL library.
+ * Purpose: Core includes of the OCL.
* Author: Amlal El Mahrouss (amlal@nekernel.org)
* Copyright 2025, Amlal El Mahrouss, licensed under the Boost Software License.
*/
diff --git a/dev/lib/except/error.hpp b/include/ocl/except/error.hpp
index b00a32b..cf038f8 100644
--- a/dev/lib/except/error.hpp
+++ b/include/ocl/except/error.hpp
@@ -8,7 +8,7 @@
#define _OCL_ERR_HPP
#include <stdexcept>
-#include <lib/core/error_handler.hpp>
+#include <core/error_handler.hpp>
namespace ocl::error
{
diff --git a/dev/lib/fix/fix.hpp b/include/ocl/fix/fix.hpp
index 08360d5..0c6685d 100644
--- a/dev/lib/fix/fix.hpp
+++ b/include/ocl/fix/fix.hpp
@@ -151,6 +151,9 @@ namespace ocl::fix
return this->visit(in);
}
+ /// @brief Visit a FIX message and parse it into a basic_range_data object.
+ /// @param in The input FIX message as a string.
+ /// @warning This function may throw exceptions.
basic_range_data<char_type> visit(const std::basic_string<char_type>& in)
{
thread_local basic_range_data<char_type> ret{};
@@ -160,37 +163,29 @@ namespace ocl::fix
std::basic_string<char_type> in_tmp{"", in.size()};
- try
+ for (auto& ch : in)
{
- for (auto& ch : in)
+ if (ch != basic_visitor::soh)
{
- if (ch != basic_visitor::soh)
- {
- in_tmp += ch;
- continue;
- }
-
- std::basic_string<char_type> key = in_tmp.substr(0, in_tmp.find(basic_visitor::eq));
- std::basic_string<char_type> val = in_tmp.substr(in_tmp.find(basic_visitor::eq) + 1);
-
- if (ret.magic_.empty())
- {
- ret.magic_ = val;
- ret.magic_len_ = ret.magic_.size();
- }
- else
- {
- ret.body_.emplace_back(std::make_pair(key, val));
- ret.body_len_ += in_tmp.size();
- }
-
- in_tmp.clear();
+ in_tmp += ch;
+ continue;
}
- }
- catch (...)
- {
+
+ std::basic_string<char_type> key = in_tmp.substr(0, in_tmp.find(basic_visitor::eq));
+ std::basic_string<char_type> val = in_tmp.substr(in_tmp.find(basic_visitor::eq) + 1);
+
+ if (ret.magic_.empty())
+ {
+ ret.magic_ = val;
+ ret.magic_len_ = ret.magic_.size();
+ }
+ else
+ {
+ ret.body_.emplace_back(std::make_pair(key, val));
+ ret.body_len_ += in_tmp.size();
+ }
+
in_tmp.clear();
- return ret;
}
in_tmp.clear();
@@ -210,7 +205,7 @@ namespace ocl::fix
using fix_tag_type = std::uint32_t;
using range_data = basic_range_data<char>;
- using visitor = basic_visitor<char>;
+ using visitor = basic_visitor<char>;
} // namespace ocl::fix
#endif // ifndef _OCL_FIX_PARSER_HPP \ No newline at end of file
diff --git a/dev/lib/io/print.hpp b/include/ocl/io/print.hpp
index c710156..c710156 100644
--- a/dev/lib/io/print.hpp
+++ b/include/ocl/io/print.hpp
diff --git a/dev/lib/logic/equiv.hpp b/include/ocl/logic/equiv.hpp
index 1bdb6d9..1bdb6d9 100644
--- a/dev/lib/logic/equiv.hpp
+++ b/include/ocl/logic/equiv.hpp
diff --git a/dev/lib/logic/math.hpp b/include/ocl/logic/math.hpp
index 52f4535..d131ef9 100644
--- a/dev/lib/logic/math.hpp
+++ b/include/ocl/logic/math.hpp
@@ -27,7 +27,7 @@ namespace ocl
static constexpr const bool value = false;
};
- constexpr inline auto not_a_number = __builtin_nanf ("");
- constexpr inline auto positive_infinity = __builtin_inff ();
+ constexpr inline auto not_a_number = __builtin_nanf("");
+ constexpr inline auto positive_infinity = __builtin_inff();
constexpr inline auto negative_infinity = -positive_infinity;
} // namespace ocl \ No newline at end of file
diff --git a/dev/lib/logic/opt.hpp b/include/ocl/logic/opt.hpp
index 07a3227..ba76885 100644
--- a/dev/lib/logic/opt.hpp
+++ b/include/ocl/logic/opt.hpp
@@ -7,7 +7,7 @@
#ifndef _OCL_OPT_HPP
#define _OCL_OPT_HPP
-#include <lib/except/error.hpp>
+#include <except/error.hpp>
#include <utility>
namespace ocl
diff --git a/dev/lib/memory/allocator_system.hpp b/include/ocl/memory/allocator_system.hpp
index 0fe7af3..67e3266 100644
--- a/dev/lib/memory/allocator_system.hpp
+++ b/include/ocl/memory/allocator_system.hpp
@@ -8,7 +8,7 @@
#ifndef _OCL_ALLOCATOR_SYSTEM_HPP
#define _OCL_ALLOCATOR_SYSTEM_HPP
-#include <lib/core/includes.hpp>
+#include <core/includes.hpp>
#include <memory>
namespace ocl
diff --git a/dev/lib/memory/tracked_ptr.hpp b/include/ocl/memory/tracked_ptr.hpp
index 0ea0e32..fcaf898 100644
--- a/dev/lib/memory/tracked_ptr.hpp
+++ b/include/ocl/memory/tracked_ptr.hpp
@@ -42,8 +42,10 @@ namespace ocl::memory
tracked_allocator(const tracked_allocator&) = default;
public:
+ using pointer_type = T*;
+
template <typename... U>
- void retain(T*& ptr, U&&... args)
+ void retain(pointer_type& ptr, U&&... args)
{
ptr = new T(std::forward<U>(args)...);
@@ -57,12 +59,12 @@ namespace ocl::memory
}
template <typename... U>
- void must_retain(T*& ptr, U&&... args) noexcept
+ void must_retain(pointer_type& ptr, U&&... args) noexcept
{
this->retain(ptr, args...);
}
- void dispose(T*& ptr) noexcept
+ void dispose(pointer_type& ptr) noexcept
{
if (ptr)
{
@@ -91,27 +93,29 @@ namespace ocl::memory
tracked_mgr(const tracked_mgr&) = default;
public:
+ using pointer_type = T*;
+
const tracked_allocator<T>& allocator() noexcept
{
return allocator_;
}
template <typename... U>
- T* retain(U&&... args)
+ pointer_type retain(U&&... args)
{
- T* ptr = nullptr;
+ pointer_type ptr = nullptr;
allocator_.retain(ptr, std::forward<U>(args)...);
return ptr;
}
template <typename... U>
- T* must_retain(U&&... args) noexcept
+ pointer_type must_retain(U&&... args) noexcept
{
return this->retain(std::forward<U>(args)...);
}
- void dispose(T*& ptr) noexcept
+ void dispose(pointer_type& ptr) noexcept
{
allocator_.dispose(ptr);
}
@@ -140,10 +144,12 @@ namespace ocl::memory
this->reset();
}
- tracked_ptr(const tracked_ptr&) = delete;
+ tracked_ptr(const tracked_ptr&) = delete;
tracked_ptr& operator=(const tracked_ptr&) = delete;
public:
+ using pointer_type = T*;
+
void reset()
{
if (ptr_)
@@ -152,12 +158,12 @@ namespace ocl::memory
}
}
- T* get() const
+ pointer_type get() const
{
return ptr_;
}
- T* data()
+ pointer_type data()
{
return ptr_;
}
@@ -167,7 +173,7 @@ namespace ocl::memory
return *ptr_;
}
- T* operator->() const
+ pointer_type operator->() const
{
return ptr_;
}
@@ -202,7 +208,7 @@ namespace ocl::memory
}
private:
- T* ptr_{nullptr};
+ pointer_type ptr_{nullptr};
};
template <typename T>
diff --git a/dev/lib/net/modem.hpp b/include/ocl/net/modem.hpp
index fd64f72..08d5ca5 100644
--- a/dev/lib/net/modem.hpp
+++ b/include/ocl/net/modem.hpp
@@ -7,7 +7,7 @@
#pragma once
-#include <lib/tests/hpptest.hpp>
+#include <tests/hpptest.hpp>
#include <unistd.h>
#include <arpa/inet.h>
@@ -17,6 +17,10 @@
#define OCL_MODEM_INTERFACE : public ocl::net::modem
+#ifdef _WIN32
+#error !!! "Windows is not supported yet for <modem>" !!!
+#endif // _WIN32
+
namespace ocl::net
{
class modem;
@@ -27,15 +31,17 @@ namespace ocl::net
class modem final
{
public:
- using socket_type = int64_t;
+ using socket_type = int64_t;
+ using error_type = bool;
+ using condition_type = bool;
private:
- socket_type fd_{};
- bool server_fd_{false};
- bool bad_{true};
+ socket_type fd_{};
+ condition_type is_server_{false};
+ error_type bad_{true};
public:
- const bool& bad{bad_};
+ const error_type& bad{bad_};
explicit modem() = default;
@@ -74,7 +80,7 @@ namespace ocl::net
socket_type cl_{fd_};
- if (this->server_fd_)
+ if (this->is_server_)
cl_ = ::accept(fd_, nullptr, nullptr);
auto ret = ::recv(cl_, out, len, 0);
@@ -124,7 +130,7 @@ namespace ocl::net
must_pass<(port > 0) && (port < 65536)>();
fd_ = ::socket(af, kind, 0);
- server_fd_ = is_server;
+ is_server_ = is_server;
if (fd_ == -1)
return false;
@@ -165,4 +171,3 @@ namespace ocl::net
}
};
} // namespace ocl::net
-
diff --git a/dev/lib/net/url.hpp b/include/ocl/net/url.hpp
index 60440ad..ebfc57a 100644
--- a/dev/lib/net/url.hpp
+++ b/include/ocl/net/url.hpp
@@ -18,22 +18,25 @@ namespace ocl::net
template <typename char_type>
class basic_url;
- enum class url_protocol
- {
- invalid = 0,
- http,
- https,
- mailto,
- ftp,
- tel,
- bad = 0xff,
- };
-
/// @brief Basic URL parser container.
template <typename char_type>
class basic_url final
{
- url_protocol m_protocol_{url_protocol::invalid};
+ public:
+ using reference = basic_url&;
+
+ enum
+ {
+ invalid = 0,
+ http,
+ https,
+ mailto,
+ ftp,
+ tel,
+ bad = 0xff,
+ };
+
+ uint32_t m_protocol_{basic_url::invalid};
std::basic_stringstream<char_type> m_ss_{};
std::basic_string<char_type> m_port_{""};
@@ -42,27 +45,27 @@ namespace ocl::net
{
if (protocol.starts_with("https://"))
{
- m_protocol_ = url_protocol::https;
+ m_protocol_ = basic_url::https;
this->operator/=(protocol.substr(std::size("https://")));
}
else if (protocol.starts_with("http://"))
{
- m_protocol_ = url_protocol::http;
+ m_protocol_ = basic_url::http;
this->operator/=(protocol.substr(std::size("http://")));
}
else if (protocol.starts_with("mailto:"))
{
- m_protocol_ = url_protocol::mailto;
+ m_protocol_ = basic_url::mailto;
this->operator/=(protocol.substr(std::size("mailto:")));
}
else if (protocol.starts_with("tel:"))
{
- m_protocol_ = url_protocol::tel;
+ m_protocol_ = basic_url::tel;
this->operator/=(protocol.substr(std::size("tel:")));
}
else if (protocol.starts_with("ftp:"))
{
- m_protocol_ = url_protocol::ftp;
+ m_protocol_ = basic_url::ftp;
this->operator/=(protocol.substr(std::size("ftp:")));
}
}
@@ -73,7 +76,7 @@ namespace ocl::net
basic_url(const basic_url&) = default;
private:
- basic_url& operator/=(const std::basic_string<char_type>& in)
+ reference operator/=(const std::basic_string<char_type>& in)
{
if (in.empty())
return *this;
@@ -88,7 +91,7 @@ namespace ocl::net
return *this;
}
- basic_url& operator/=(const char_type& in)
+ reference operator/=(const char_type& in)
{
m_ss_ += in;
return *this;
@@ -100,19 +103,19 @@ namespace ocl::net
}
public:
- auto protocol() const noexcept
+ uint32_t protocol() const noexcept
{
return this->m_protocol_;
}
- auto port() const noexcept
+ std::basic_string<char_type> port() const noexcept
{
return this->m_port_;
}
- auto is_valid() const noexcept
+ bool is_valid() const noexcept
{
- return m_ss_.size() > 0 && this->m_protocol_ != url_protocol::bad || this->m_protocol_ != url_protocol::invalid;
+ return m_ss_.size() > 0 && this->m_protocol_ != basic_url::bad || this->m_protocol_ != basic_url::invalid;
}
};
diff --git a/dev/lib/simd/basic_simd.hpp b/include/ocl/simd/basic_simd.hpp
index 975ab2b..a401dbd 100644
--- a/dev/lib/simd/basic_simd.hpp
+++ b/include/ocl/simd/basic_simd.hpp
@@ -7,7 +7,7 @@
#pragma once
-#include <lib/core/includes.hpp>
+#include <core/includes.hpp>
#ifdef __x86_64__
#include <immintrin.h>
diff --git a/dev/lib/simd/simd.hpp b/include/ocl/simd/simd.hpp
index 239e512..711bf31 100644
--- a/dev/lib/simd/simd.hpp
+++ b/include/ocl/simd/simd.hpp
@@ -7,7 +7,7 @@
#pragma once
-#include <lib/core/includes.hpp>
+#include <core/includes.hpp>
/// @author Amlal El Mahrouss
/// @brief Basic SIMD processor.
@@ -30,11 +30,11 @@ namespace ocl::simd
};
public:
- real_type() = default;
+ real_type() = default;
virtual ~real_type() = default;
real_type& operator=(const real_type&) = delete;
- real_type(const real_type&) = delete;
+ real_type(const real_type&) = delete;
typename backend_type::register_type& call(const opcode& op, typename backend_type::register_type& lhs, typename backend_type::register_type& rhs)
{
diff --git a/dev/lib/tests/gtest.hpp b/include/ocl/tests/gtest.hpp
index ee328b0..ee328b0 100644
--- a/dev/lib/tests/gtest.hpp
+++ b/include/ocl/tests/gtest.hpp
diff --git a/dev/lib/tests/hpptest.hpp b/include/ocl/tests/hpptest.hpp
index a3136b7..0c7b4e5 100644
--- a/dev/lib/tests/hpptest.hpp
+++ b/include/ocl/tests/hpptest.hpp
@@ -7,7 +7,7 @@
#pragma once
-#include <lib/io/print.hpp>
+#include <io/print.hpp>
#include <cstdlib>
namespace ocl::hpptest
@@ -40,7 +40,7 @@ namespace ocl::hpptest
typedef bool condition_type;
template <condition_type expr = true>
- consteval inline void must_pass()
+ consteval inline void must_be()
{
#ifdef OCL_HPPTEST
OCL_HPPTEST_ASSERT(expr);
@@ -48,7 +48,7 @@ namespace ocl::hpptest
}
template <condition_type expect, typename on_fail>
- inline void must_pass(condition_type cond) noexcept
+ inline void must_be(condition_type cond) noexcept
{
if (cond != expect)
{
@@ -57,7 +57,7 @@ namespace ocl::hpptest
}
template <errno_t expect = 0>
- inline void must_pass(errno_t ern) noexcept
+ inline void must_be(errno_t ern) noexcept
{
if (ern != expect)
{
@@ -79,7 +79,7 @@ namespace ocl::hpptest
};
template <HRESULT expect = S_OK>
- inline void must_pass(HRESULT hr) noexcept
+ inline void must_be(HRESULT hr) noexcept
{
if (hr != expect)
{
diff --git a/dev/lib/utility/cgi.hpp b/include/ocl/utility/cgi.hpp
index fd00bbf..8849c2d 100644
--- a/dev/lib/utility/cgi.hpp
+++ b/include/ocl/utility/cgi.hpp
@@ -7,8 +7,8 @@
#ifndef _OCL_CGI_HPP
#define _OCL_CGI_HPP
-#include <lib/io/print.hpp>
-#include <lib/core/chunk_string.hpp>
+#include <io/print.hpp>
+#include <core/chunk_string.hpp>
#include <sstream>
#include <format>
@@ -37,7 +37,7 @@ namespace ocl
public:
explicit basic_writer() = default;
- virtual ~basic_writer() = default;
+ virtual ~basic_writer() = default;
basic_writer& operator=(const basic_writer&) = default;
basic_writer(const basic_writer&) = default;
diff --git a/dev/lib/utility/crc32.hpp b/include/ocl/utility/crc32.hpp
index 2bcab29..2bcab29 100644
--- a/dev/lib/utility/crc32.hpp
+++ b/include/ocl/utility/crc32.hpp
diff --git a/dev/lib/utility/embfs.hpp b/include/ocl/utility/embfs.hpp
index e2e5d18..8a716ce 100644
--- a/dev/lib/utility/embfs.hpp
+++ b/include/ocl/utility/embfs.hpp
@@ -37,7 +37,7 @@ namespace ocl::embfs
#endif
typedef std::int16_t sword_t;
-
+
typedef std::int32_t sdword_t;
typedef std::uint8_t utf8_char_t;
diff --git a/make_dist_linux.sh b/make_dist_linux.sh
index 221b5f4..2432323 100755
--- a/make_dist_linux.sh
+++ b/make_dist_linux.sh
@@ -4,7 +4,7 @@ outputDir=dist/lib/
mkdir -p $outputDir
-for f in dev/lib/*/*.hpp; do
+for f in include/ocl/*/*.hpp; do
baseName=`echo $f | cut -d "." -f 1`
echo "RUN:" cp --parents $f.hpp $outputDir$baseName
cp --parents $f.hpp $outputDir$baseName
diff --git a/make_dist_osx.sh b/make_dist_osx.sh
index 9d91de3..505c583 100755
--- a/make_dist_osx.sh
+++ b/make_dist_osx.sh
@@ -4,7 +4,7 @@ outputDir=dist/
mkdir -p $outputDir
-for f in dev/lib/*/*.hpp; do
+for f in include/ocl/*/*.hpp; do
baseName=`echo $f | cut -d "." -f 1`
echo "RUN:" ditto $baseName.hpp $outputDir$baseName
ditto $baseName.hpp $outputDir$baseName
diff --git a/dev/tests/.gitkeep b/tests/.gitkeep
index e69de29..e69de29 100644
--- a/dev/tests/.gitkeep
+++ b/tests/.gitkeep
diff --git a/dev/tests/chunk_string/CMakeLists.txt b/tests/chunk_string/CMakeLists.txt
index 89d0e4d..53a9add 100644
--- a/dev/tests/chunk_string/CMakeLists.txt
+++ b/tests/chunk_string/CMakeLists.txt
@@ -19,7 +19,7 @@ add_executable(BasicChunkUsage chunk_test.cc)
target_link_libraries(BasicChunkUsage PRIVATE gtest_main)
set_property(TARGET BasicChunkUsage PROPERTY CXX_STANDARD 20)
-target_include_directories(BasicChunkUsage PUBLIC ../../)
+target_include_directories(BasicChunkUsage PUBLIC ../../include/ocl)
include(GoogleTest)
gtest_discover_tests(BasicChunkUsage)
diff --git a/dev/tests/chunk_string/chunk_test.cc b/tests/chunk_string/chunk_test.cc
index 3498fa8..6b2d290 100644
--- a/dev/tests/chunk_string/chunk_test.cc
+++ b/tests/chunk_string/chunk_test.cc
@@ -5,9 +5,9 @@
* Copyright 2025, Amlal El Mahrouss, licensed under the Boost Software License.
*/
-#include <lib/io/print.hpp>
-#include <lib/tests/gtest.hpp>
-#include <lib/core/chunk_string.hpp>
+#include <io/print.hpp>
+#include <tests/gtest.hpp>
+#include <core/chunk_string.hpp>
TEST(ChunkTest, BasicChunkUsage)
{
diff --git a/dev/tests/fix_basic/CMakeLists.txt b/tests/fix_basic/CMakeLists.txt
index 7b06112..b94e3b5 100644
--- a/dev/tests/fix_basic/CMakeLists.txt
+++ b/tests/fix_basic/CMakeLists.txt
@@ -17,7 +17,7 @@ add_executable(FIXTestBasic fix_test.cc)
target_link_libraries(FIXTestBasic gtest_main)
set_property(TARGET FIXTestBasic PROPERTY CXX_STANDARD 20)
-target_include_directories(FIXTestBasic PUBLIC ../../)
+target_include_directories(FIXTestBasic PUBLIC ../../include/ocl)
include(GoogleTest)
gtest_discover_tests(FIXTestBasic)
diff --git a/dev/tests/fix_basic/fix_test.cc b/tests/fix_basic/fix_test.cc
index 9055803..f58973b 100644
--- a/dev/tests/fix_basic/fix_test.cc
+++ b/tests/fix_basic/fix_test.cc
@@ -1,21 +1,19 @@
/*
- * File: tests/tracked_ptr_test.cc
- * Purpose: Custom smart pointer unit tests in C++
+ * File: tests/fix_test.cc
+ * Purpose: Custom FIX protocol tests.
* Author: Amlal El Mahrouss (amlal@nekernel.org)
* Copyright 2025, Amlal El Mahrouss, licensed under the Boost Software License.
*/
-#include <lib/fix/fix.hpp>
-#include <lib/tests/hpptest.hpp>
-#include <lib/tests/gtest.hpp>
+#include <fix/fix.hpp>
+#include <tests/hpptest.hpp>
+#include <tests/gtest.hpp>
TEST(FIXTest, BasicFIXUsage)
{
ocl::fix::basic_visitor<char> basic_visitor;
ocl::fix::basic_range_data<char> fix = basic_visitor.visit("8=FIX.4.2|9=65|35=A|49=SERVER|56=CLIENT|34=177|52=20090107-18:15:16|98=0|108=30|10=062|");
- ocl::hpptest::must_pass<ENOENT>(EPERM);
-
EXPECT_EQ(fix.magic_, ocl::fix::detail::begin_fix());
EXPECT_TRUE(fix.is_valid());
}
diff --git a/dev/tests/network_basic/CMakeLists.txt b/tests/network_basic/CMakeLists.txt
index 4cfe0d1..88fa1c8 100644
--- a/dev/tests/network_basic/CMakeLists.txt
+++ b/tests/network_basic/CMakeLists.txt
@@ -17,7 +17,7 @@ add_executable(NetworkTestBasic net_test.cc)
target_link_libraries(NetworkTestBasic gtest_main)
set_property(TARGET NetworkTestBasic PROPERTY CXX_STANDARD 20)
-target_include_directories(NetworkTestBasic PUBLIC ../../)
+target_include_directories(NetworkTestBasic PUBLIC ../../include/ocl)
include(GoogleTest)
gtest_discover_tests(NetworkTestBasic)
diff --git a/dev/tests/network_basic/net_test.cc b/tests/network_basic/net_test.cc
index a40ca5d..15090d0 100644
--- a/dev/tests/network_basic/net_test.cc
+++ b/tests/network_basic/net_test.cc
@@ -5,9 +5,9 @@
* Copyright 2025, Amlal El Mahrouss, licensed under the Boost Software License.
*/
-#include <lib/net/modem.hpp>
-#include <lib/io/print.hpp>
-#include <lib/tests/gtest.hpp>
+#include <net/modem.hpp>
+#include <io/print.hpp>
+#include <tests/gtest.hpp>
#include <cstring>
TEST(NetworkTest, BasicNetworkUsage)
diff --git a/dev/tests/tracked_ptr_basic/CMakeLists.txt b/tests/tracked_ptr_basic/CMakeLists.txt
index 1dd5095..7c3dac6 100644
--- a/dev/tests/tracked_ptr_basic/CMakeLists.txt
+++ b/tests/tracked_ptr_basic/CMakeLists.txt
@@ -17,7 +17,7 @@ add_executable(TrackedPtrTestBasic tracked_ptr_test.cc)
target_link_libraries(TrackedPtrTestBasic gtest_main)
set_property(TARGET TrackedPtrTestBasic PROPERTY CXX_STANDARD 20)
-target_include_directories(TrackedPtrTestBasic PUBLIC ../../)
+target_include_directories(TrackedPtrTestBasic PUBLIC ../../include/ocl)
include(GoogleTest)
gtest_discover_tests(TrackedPtrTestBasic)
diff --git a/dev/tests/tracked_ptr_basic/tracked_ptr_test.cc b/tests/tracked_ptr_basic/tracked_ptr_test.cc
index ec3c51f..652974a 100644
--- a/dev/tests/tracked_ptr_basic/tracked_ptr_test.cc
+++ b/tests/tracked_ptr_basic/tracked_ptr_test.cc
@@ -5,8 +5,8 @@
* Copyright 2025, Amlal El Mahrouss, licensed under the Boost Software License.
*/
-#include <lib/memory/tracked_ptr.hpp>
-#include <lib/tests/gtest.hpp>
+#include <memory/tracked_ptr.hpp>
+#include <tests/gtest.hpp>
TEST(TrackedPtrTest, BasicTrackedPtrUsage)
{
diff --git a/dev/tests/tracked_ptr_leak/CMakeLists.txt b/tests/tracked_ptr_leak/CMakeLists.txt
index 30c91a1..314e666 100644
--- a/dev/tests/tracked_ptr_leak/CMakeLists.txt
+++ b/tests/tracked_ptr_leak/CMakeLists.txt
@@ -17,7 +17,7 @@ add_executable(TrackedPtrTestLeak tracked_ptr_test.cc)
target_link_libraries(TrackedPtrTestLeak gtest_main)
set_property(TARGET TrackedPtrTestLeak PROPERTY CXX_STANDARD 20)
-target_include_directories(TrackedPtrTestLeak PUBLIC ../../)
+target_include_directories(TrackedPtrTestLeak PUBLIC ../../include/ocl)
include(GoogleTest)
gtest_discover_tests(TrackedPtrTestLeak)
diff --git a/dev/tests/tracked_ptr_leak/tracked_ptr_test.cc b/tests/tracked_ptr_leak/tracked_ptr_test.cc
index 8ca6615..14d8f8e 100644
--- a/dev/tests/tracked_ptr_leak/tracked_ptr_test.cc
+++ b/tests/tracked_ptr_leak/tracked_ptr_test.cc
@@ -5,8 +5,8 @@
* Copyright 2025, Amlal El Mahrouss, licensed under the Boost Software License.
*/
-#include <lib/memory/tracked_ptr.hpp>
-#include <lib/tests/gtest.hpp>
+#include <memory/tracked_ptr.hpp>
+#include <tests/gtest.hpp>
TEST(TrackedPtrTest, LeakTrackedPtrUsage)
{