diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-07-10 12:02:02 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-07-10 12:02:02 +0200 |
| commit | be9f0a30c110737760c6cd8cea19cca558be85af (patch) | |
| tree | a893914cddd8a7b720a8cc786e5fb55a8603ffd9 /lib | |
| parent | e23e9e7eb3a1e3876fd9d245b307dc81f16f904a (diff) | |
feat: operator() for FIX parser, laying groundwork for fix's network
stack too.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/embfs.hpp (renamed from lib/embdfs.hpp) | 0 | ||||
| -rw-r--r-- | lib/equiv.hpp | 2 | ||||
| -rw-r--r-- | lib/fix/network.hpp | 3 | ||||
| -rw-r--r-- | lib/fix/parser.hpp | 20 | ||||
| -rw-r--r-- | lib/opt.hpp | 2 |
5 files changed, 19 insertions, 8 deletions
diff --git a/lib/embdfs.hpp b/lib/embfs.hpp index 7beb1db..7beb1db 100644 --- a/lib/embdfs.hpp +++ b/lib/embfs.hpp diff --git a/lib/equiv.hpp b/lib/equiv.hpp index 08ea031..4bb5904 100644 --- a/lib/equiv.hpp +++ b/lib/equiv.hpp @@ -99,4 +99,4 @@ namespace snu::equiv return left_ / right_; } }; -} // namespace snu
\ No newline at end of file +} // namespace snu::equiv
\ No newline at end of file diff --git a/lib/fix/network.hpp b/lib/fix/network.hpp index 6f355d8..a99ba05 100644 --- a/lib/fix/network.hpp +++ b/lib/fix/network.hpp @@ -13,7 +13,8 @@ namespace snu::fix { - + class network_rx; + class network_tx; } #endif // ifndef _SNU_FIX_NETWORK_HPP
\ No newline at end of file diff --git a/lib/fix/parser.hpp b/lib/fix/parser.hpp index a9a42d2..091d8a9 100644 --- a/lib/fix/parser.hpp +++ b/lib/fix/parser.hpp @@ -111,8 +111,9 @@ namespace snu::fix class visitor final { public: - static constexpr char_type soh = '|'; - static constexpr uint32_t base = 10U; + static constexpr const char_type soh = '|'; + static constexpr const char_type eq = '='; + static constexpr uint32_t base = 10U; explicit visitor() = default; ~visitor() = default; @@ -120,9 +121,18 @@ namespace snu::fix visitor& operator=(const visitor&) = default; visitor(const visitor&) = default; + range<char_type> operator()(const std::basic_string<char_type>& in) + { + return this->visit(in); + } + range_data<char_type> visit(const std::basic_string<char_type>& in) { - thread_local range_data<char_type> ret{}; + thread_local range_data<char_type> ret{}; + + if (in.empty()) + return ret; + thread_local std::basic_string<char_type> in_tmp{}; in_tmp.reserve(in.size()); @@ -137,8 +147,8 @@ namespace snu::fix continue; } - std::basic_string<char_type> key = in_tmp.substr(0, in_tmp.find("=")); - std::basic_string<char_type> val = in_tmp.substr(in_tmp.find("=") + 1); + std::basic_string<char_type> key = in_tmp.substr(0, in_tmp.find(visitor::eq)); + std::basic_string<char_type> val = in_tmp.substr(in_tmp.find(visitor::eq) + 1); if (ret.msg_magic_.empty()) { diff --git a/lib/opt.hpp b/lib/opt.hpp index 11f7a30..f4f62a2 100644 --- a/lib/opt.hpp +++ b/lib/opt.hpp @@ -15,7 +15,7 @@ namespace snu enum class ret { invalid = 0, - okay = 100, + okay = 100, err, count = err - okay + 1, }; |
