From ed4f331bc96b4abb711c5b47c969d5ecb3166e15 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Mon, 29 Dec 2025 22:43:23 +0100 Subject: feat: fix CMake example, update free functions. Signed-off-by: Amlal El Mahrouss --- example/fix_tag_example/CMakeLists.txt | 8 ++++---- example/fix_tag_example/example.cc | 30 ------------------------------ example/fix_tag_example/example.cpp | 30 ++++++++++++++++++++++++++++++ include/ocl/fix.hpp | 6 +++--- include/ocl/fix/parser.hpp | 4 +++- test/fix_basic/fix.test.cpp | 4 ++-- 6 files changed, 42 insertions(+), 40 deletions(-) delete mode 100644 example/fix_tag_example/example.cc create mode 100644 example/fix_tag_example/example.cpp diff --git a/example/fix_tag_example/CMakeLists.txt b/example/fix_tag_example/CMakeLists.txt index b9a80db..57bec7a 100644 --- a/example/fix_tag_example/CMakeLists.txt +++ b/example/fix_tag_example/CMakeLists.txt @@ -1,4 +1,4 @@ - +# AMLALE: Hm? cmake_minimum_required(VERSION 3.15...3.31) project( @@ -6,10 +6,10 @@ project( VERSION 1.0 LANGUAGES CXX) -find_package(Boost REQUIRED COMPONENTS container) +find_package(Boost REQUIRED) -add_executable(FixExample example.cc) +add_executable(FixExample example.cpp) set_property(TARGET FixExample PROPERTY CXX_STANDARD 20) target_include_directories(FixExample PUBLIC ../../include/ocl) -target_link_libraries(FixExample PRIVATE Boost::container) +target_link_libraries(FixExample PRIVATE Boost) diff --git a/example/fix_tag_example/example.cc b/example/fix_tag_example/example.cc deleted file mode 100644 index f7f3e76..0000000 --- a/example/fix_tag_example/example.cc +++ /dev/null @@ -1,30 +0,0 @@ -#include - -constexpr char default_fix[] = { - '8', '=', 'F', 'I', 'X', '.', '4', '.', '2', 0x01, - '9', '=', '6', '3', 0x01, // BodyLength = 63 - '3', '5', '=', 'A', 0x01, - '4', '9', '=', 'S', 'E', 'R', 'V', 'E', 'R', 0x01, - '5', '6', '=', 'C', 'L', 'I', 'E', 'N', 'T', 0x01, - '3', '4', '=', '1', '7', '7', 0x01, - '5', '2', '=', '2', '0', '0', '9', '0', '1', '0', '7', '-', '1', '8', ':', '1', '5', ':', '1', '6', 0x01, - '9', '8', '=', '0', 0x01, - '1', '0', '8', '=', '3', '0', 0x01, - '1', '0', '=', '1', '4', '3', 0x01, 0x00 // CheckSum = 143 -}; - -int main(int argc, char** argv) -{ - ocl::fix::visitor basic_visitor; - ocl::fix::range_buffer fix = basic_visitor.visit(default_fix); - - ocl::io::enable_stdio_sync(false); - - ocl::io::print(":key=35\n"); - ocl::io::print(":value=", fix["35"], "\n"); - - ocl::io::print(":key=49\n"); - ocl::io::print(":value=", fix["49"], "\n"); - - return 0; -} diff --git a/example/fix_tag_example/example.cpp b/example/fix_tag_example/example.cpp new file mode 100644 index 0000000..f7f3e76 --- /dev/null +++ b/example/fix_tag_example/example.cpp @@ -0,0 +1,30 @@ +#include + +constexpr char default_fix[] = { + '8', '=', 'F', 'I', 'X', '.', '4', '.', '2', 0x01, + '9', '=', '6', '3', 0x01, // BodyLength = 63 + '3', '5', '=', 'A', 0x01, + '4', '9', '=', 'S', 'E', 'R', 'V', 'E', 'R', 0x01, + '5', '6', '=', 'C', 'L', 'I', 'E', 'N', 'T', 0x01, + '3', '4', '=', '1', '7', '7', 0x01, + '5', '2', '=', '2', '0', '0', '9', '0', '1', '0', '7', '-', '1', '8', ':', '1', '5', ':', '1', '6', 0x01, + '9', '8', '=', '0', 0x01, + '1', '0', '8', '=', '3', '0', 0x01, + '1', '0', '=', '1', '4', '3', 0x01, 0x00 // CheckSum = 143 +}; + +int main(int argc, char** argv) +{ + ocl::fix::visitor basic_visitor; + ocl::fix::range_buffer fix = basic_visitor.visit(default_fix); + + ocl::io::enable_stdio_sync(false); + + ocl::io::print(":key=35\n"); + ocl::io::print(":value=", fix["35"], "\n"); + + ocl::io::print(":key=49\n"); + ocl::io::print(":value=", fix["49"], "\n"); + + return 0; +} diff --git a/include/ocl/fix.hpp b/include/ocl/fix.hpp index d8c7a3b..26742bd 100644 --- a/include/ocl/fix.hpp +++ b/include/ocl/fix.hpp @@ -14,13 +14,13 @@ namespace ocl::fix { - - template + + template It find(It begin, It end, Pred callable); template It find_if(It begin, It end, Callable callable); -} +} // namespace ocl::fix #endif diff --git a/include/ocl/fix/parser.hpp b/include/ocl/fix/parser.hpp index ffac652..ceba660 100644 --- a/include/ocl/fix/parser.hpp +++ b/include/ocl/fix/parser.hpp @@ -100,7 +100,9 @@ namespace ocl::fix std::unique_ptr impl_; #ifndef OCL_FIX_HAS_IMPL - struct impl {}; + struct impl + { + }; #endif public: diff --git a/test/fix_basic/fix.test.cpp b/test/fix_basic/fix.test.cpp index fd82965..82fb24c 100644 --- a/test/fix_basic/fix.test.cpp +++ b/test/fix_basic/fix.test.cpp @@ -22,8 +22,8 @@ constexpr char default_fix[] = { '1', '0', '=', '1', '4', '3', 0x01, 0x00 // CheckSum = 143 }; -ocl::fix::visitor basic_visitor; -ocl::fix::range_buffer fix = basic_visitor.visit(default_fix); +static ocl::fix::visitor basic_visitor; +static ocl::fix::range_buffer fix = basic_visitor.visit(default_fix); TEST(FIXTest, FIXGoodPacket) { -- cgit v1.2.3