mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 07:03:25 +00:00
Adds pattern scanning functionality
Implements a pattern scanner for byte sequence parsing.
Introduces `omath::PatternScanner` to parse pattern strings, which represent byte sequences.
Adds support for wildcard characters ('?' and '?') to represent optional bytes in the pattern.
Includes unit tests for basic read operations to ensure proper functionality.
This commit is contained in:
28
include/omath/utility/pattern_scan.hpp
Normal file
28
include/omath/utility/pattern_scan.hpp
Normal file
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// Created by Vlad on 10/4/2025.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
#include <expected>
|
||||
#include <optional>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
// ReSharper disable once CppInconsistentNaming
|
||||
class unit_test_pattern_scan_read_test_Test;
|
||||
namespace omath
|
||||
{
|
||||
enum class PatternScanError
|
||||
{
|
||||
INVALID_PATTERN_STRING
|
||||
};
|
||||
class PatternScanner
|
||||
{
|
||||
friend unit_test_pattern_scan_read_test_Test;
|
||||
public:
|
||||
private:
|
||||
[[nodiscard]]
|
||||
static std::expected<std::vector<std::optional<std::byte>>, PatternScanError>
|
||||
parse_pattern(const std::string_view& pattern_string);
|
||||
};
|
||||
} // namespace omath
|
||||
Reference in New Issue
Block a user