summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2026-02-06 18:03:05 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2026-02-06 18:03:05 +0100
commit5c3092e1436c7e7a1218559605bd73780435f8c8 (patch)
treed35f309751129cb6f0a1c76cb4f83129905c1e45
parent54e0beb80ff75fea53a6d55532df1fce613c7b6a (diff)
chore: performance and build system improvements.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
-rw-r--r--CMakeLists.txt4
-rw-r--r--example/fix_tag_example/CMakeLists.txt2
-rw-r--r--src/fix/parser_impl.cpp17
3 files changed, 11 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 19ca3fa..66d9997 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,10 +3,10 @@
cmake_minimum_required(VERSION 3.10)
project(ocl_fix)
-find_package(Boost REQUIRED)
+find_package(Boost REQUIRED core)
add_library(ocl_fix src/fix/parser_impl.cpp)
-target_link_libraries(ocl_fix boost_core)
+target_link_libraries(ocl_fix Boost::core)
target_include_directories(ocl_fix PUBLIC ${BOOST_INCLUDE_DIRS})
install(DIRECTORY include/ DESTINATION include)
diff --git a/example/fix_tag_example/CMakeLists.txt b/example/fix_tag_example/CMakeLists.txt
index ca6d6dd..967ca07 100644
--- a/example/fix_tag_example/CMakeLists.txt
+++ b/example/fix_tag_example/CMakeLists.txt
@@ -13,4 +13,4 @@ target_include_directories(FixExample PUBLIC ${BOOST_INCLUDE_DIRS})
set_property(TARGET FixExample PROPERTY CXX_STANDARD 20)
target_include_directories(FixExample PUBLIC ../../include/ocl)
-target_link_libraries(FixExample PRIVATE ocl_fix)
+target_link_libraries(FixExample PRIVATE ocl_fix.a)
diff --git a/src/fix/parser_impl.cpp b/src/fix/parser_impl.cpp
index 27ea01d..e236d89 100644
--- a/src/fix/parser_impl.cpp
+++ b/src/fix/parser_impl.cpp
@@ -22,6 +22,8 @@ namespace ocl::fix
} // namespace detail
+ boost::string_view& range_buffer::begin = detail::begin_fix();
+
struct visitor::impl final
{
public:
@@ -40,31 +42,28 @@ namespace ocl::fix
/// @warning This function may throw exceptions.
range_buffer visit(const boost::string_view& in)
{
- if (auto begin = detail::begin_fix(); begin != range_buffer::begin)
- range_buffer::begin = begin;
-
range_buffer ret{};
if (in.empty())
return ret;
- std::string key;
-
+ std::string key, tag, value;
std::size_t off = 0UL;
-
+ std::size_t soh_pos = 0UL;
+
while (off < in.size())
{
std::size_t eq_pos = in.find(eq, off);
if (eq_pos == std::string::npos)
break;
- std::string tag = in.substr(off, eq_pos - off).to_string();
+ tag = in.substr(off, eq_pos - off).to_string();
- std::size_t soh_pos = in.find(soh, eq_pos + 1);
+ soh_pos = in.find(soh, eq_pos + 1);
if (soh_pos == std::string::npos)
soh_pos = in.size();
- std::string value = in.substr(eq_pos + 1, soh_pos - eq_pos - 1).to_string();
+ value = in.substr(eq_pos + 1, soh_pos - eq_pos - 1).to_string();
if (ret.magic_.empty())
{