diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2026-01-11 15:39:31 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2026-01-11 15:39:31 +0100 |
| commit | 20f36d5bb5f30ba759676fde1a4da0579e66a878 (patch) | |
| tree | a2281d502c527945869a03897e9f8760bedf59aa /include/ocl/fix/parser.hpp | |
| parent | d0decd01ec7c9e3f3d493cc6aa9ec87fd34a6722 (diff) | |
feat: FIX library improvements, prepping release.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'include/ocl/fix/parser.hpp')
| -rw-r--r-- | include/ocl/fix/parser.hpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/include/ocl/fix/parser.hpp b/include/ocl/fix/parser.hpp index ceba660..9268662 100644 --- a/include/ocl/fix/parser.hpp +++ b/include/ocl/fix/parser.hpp @@ -5,10 +5,16 @@ * Copyright 2025, Amlal El Mahrouss, licensed under the Boost Software License. */ +// Copyright 2025-2026, Amlal El Mahrouss (amlal@nekernel.org) +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// Official repository: https://github.com/ocl-org/fix + #ifndef __OCL_FIX_PARSER #define __OCL_FIX_PARSER #include <ocl/fix/detail/config.hpp> +#include <fstream> #include <string> #include <memory> @@ -52,6 +58,14 @@ namespace ocl::fix return std::string(range.bytes_, range.length_); } + inline std::string to_string(const range& range) noexcept + { + if (range.length_ < 1) + return std::string{}; + + return std::string(range.bytes_, range.length_); + } + /// @brief a range object containing the FIX packet values. class range_buffer final { @@ -60,7 +74,7 @@ namespace ocl::fix std::string magic_{}; string_hash_map<value_type> message_{}; - static inline const char* begin; + static boost::string_view& begin; explicit range_buffer() = default; ~range_buffer() = default; @@ -120,4 +134,16 @@ namespace ocl::fix } // namespace ocl::fix +inline std::ostream& operator<<(std::ostream& os, ocl::fix::range& r) +{ + os << ocl::fix::to_string(r); + return os; +} + +inline std::ostream& operator<<(std::ostream& os, const ocl::fix::range& r) +{ + os << ocl::fix::to_string(r); + return os; +} + #endif // ifndef __OCL_FIX_PARSER |
