Merge pull request #3627 from ygorshenin/remove-tokenize-iterator-default-ctor

[base] Removed TokenizeIterator default ctor.
This commit is contained in:
Ilya Zverev 2016-06-22 13:14:04 +04:00 committed by GitHub
commit 34ad58798e
4 changed files with 14 additions and 24 deletions

View file

@ -411,12 +411,6 @@ UNIT_TEST(SimpleTokenizer)
tokens.assign(&s[0], &s[0] + ARRAY_SIZE(s));
TestIter("/1/2/", "/", tokens);
}
{
using strings::SimpleTokenizer;
string const str("a,b,c");
TEST_EQUAL(vector<string>(SimpleTokenizer(str, ","), SimpleTokenizer()),
(vector<string>{"a", "b", "c"}), ());
}
{
string const s = "";

View file

@ -24,12 +24,14 @@ SimpleDelimiter::SimpleDelimiter(char const * delims)
m_delims.push_back(utf8::unchecked::next(it));
}
SimpleDelimiter::SimpleDelimiter(char delim)
{
m_delims.push_back(delim);
}
bool SimpleDelimiter::operator()(UniChar c) const
{
for (UniString::const_iterator it = m_delims.begin(); it != m_delims.end(); ++it)
if (*it == c)
return true;
return false;
return find(m_delims.begin(), m_delims.end(), c) != m_delims.end();
}
UniChar LastUniChar(string const & s)

View file

@ -113,10 +113,6 @@ public:
Move();
}
// Use default-constructed iterator for operator == to determine the
// end of the token stream.
TokenizeIterator() = default;
string operator*() const
{
ASSERT(m_start != m_finish, ("Dereferencing of empty iterator."));
@ -204,10 +200,6 @@ public:
++m_end;
}
// Use default-constructed iterator for operator == to determine the
// end of the token stream.
TokenizeIterator() = default;
string operator*() const
{
ASSERT(!m_finished, ("Dereferencing of empty iterator."));
@ -290,9 +282,9 @@ class SimpleDelimiter
public:
SimpleDelimiter(char const * delims);
// Used in TokenizeIterator to allow past the end iterator construction.
SimpleDelimiter() = default;
/// @return true if c is delimiter
SimpleDelimiter(char delim);
// Returns true iff |c| is a delimiter.
bool operator()(UniChar c) const;
};

View file

@ -232,12 +232,14 @@ bool EditableMapObject::ValidateHouseNumber(string const & houseNumber)
// static
bool EditableMapObject::ValidateFlats(string const & flats)
{
auto it = strings::SimpleTokenizer(flats, ";");
for (; it != strings::SimpleTokenizer(); ++it)
for (auto it = strings::SimpleTokenizer(flats, ";"); it; ++it)
{
auto token = *it;
strings::Trim(token);
vector<string> range(strings::SimpleTokenizer(token, "-"), strings::SimpleTokenizer());
vector<string> range;
for (auto i = strings::SimpleTokenizer(token, "-"); i; ++i)
range.push_back(*i);
if (range.empty() || range.size() > 2)
return false;