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:
40
base/uni_string_dfa.cpp
Normal file
40
base/uni_string_dfa.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
#include "base/uni_string_dfa.hpp"
|
||||
|
||||
#include "base/assert.hpp"
|
||||
|
||||
namespace strings
|
||||
{
|
||||
// UniStringDFA::Iterator --------------------------------------------------------------------------
|
||||
UniStringDFA::Iterator::Iterator(UniString const & s) : m_s(s), m_pos(0), m_rejected(false) {}
|
||||
|
||||
UniStringDFA::Iterator & UniStringDFA::Iterator::Move(UniChar c)
|
||||
{
|
||||
if (Accepts())
|
||||
{
|
||||
m_rejected = true;
|
||||
return *this;
|
||||
}
|
||||
|
||||
if (Rejects())
|
||||
return *this;
|
||||
|
||||
ASSERT_LESS(m_pos, m_s.size(), ());
|
||||
if (m_s[m_pos] != c)
|
||||
{
|
||||
m_rejected = true;
|
||||
return *this;
|
||||
}
|
||||
|
||||
++m_pos;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// UniStringDFA::UniStringDFA ----------------------------------------------------------------------
|
||||
UniStringDFA::UniStringDFA(std::string const & s) : UniStringDFA(MakeUniString(s)) {}
|
||||
|
||||
std::string DebugPrint(UniStringDFA const & dfa)
|
||||
{
|
||||
return DebugPrint(dfa.m_s);
|
||||
}
|
||||
|
||||
} // namespace strings
|
||||
Reference in New Issue
Block a user