mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-20 05:13:58 +00:00
Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
To expand with full Organic Maps and Maps.ME commits history run: git remote add om-historic [om-historic.git repo url] git fetch --tags om-historic git replace squashed-history historic-commits
This commit is contained in:
42
base/uni_string_dfa.hpp
Normal file
42
base/uni_string_dfa.hpp
Normal file
@@ -0,0 +1,42 @@
|
||||
#pragma once
|
||||
|
||||
#include "base/string_utils.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace strings
|
||||
{
|
||||
class UniStringDFA
|
||||
{
|
||||
public:
|
||||
class Iterator
|
||||
{
|
||||
public:
|
||||
Iterator & Move(UniChar c);
|
||||
|
||||
bool Accepts() const { return !Rejects() && m_pos == m_s.size(); }
|
||||
bool Rejects() const { return m_rejected; }
|
||||
size_t ErrorsMade() const { return 0; }
|
||||
size_t PrefixErrorsMade() const { return 0; }
|
||||
|
||||
private:
|
||||
friend class UniStringDFA;
|
||||
|
||||
explicit Iterator(UniString const & s);
|
||||
|
||||
UniString const & m_s;
|
||||
size_t m_pos;
|
||||
bool m_rejected;
|
||||
};
|
||||
|
||||
explicit UniStringDFA(UniString const & s) : m_s(s) {}
|
||||
explicit UniStringDFA(std::string const & s);
|
||||
|
||||
Iterator Begin() const { return Iterator(m_s); }
|
||||
|
||||
friend std::string DebugPrint(UniStringDFA const & dfa);
|
||||
|
||||
private:
|
||||
UniString const m_s;
|
||||
};
|
||||
} // namespace strings
|
||||
Reference in New Issue
Block a user