Commit af412c28 by Maarten L. Hekkelman

clean up

parent 874cd3ba
......@@ -67,9 +67,7 @@ std::string get_version_nr();
// some basic utilities: Since we're using ASCII input only, we define for optimisation
// our own case conversion routines.
// bool iequals(const std::string &a, const std::string &b);
bool iequals(std::string_view a, std::string_view b);
// int icompare(const std::string &a, const std::string &b);
int icompare(std::string_view a, std::string_view b);
bool iequals(const char *a, const char *b);
......
......@@ -395,26 +395,6 @@ auto Datablock::emplace(std::string_view name) -> std::tuple<iterator, bool>
mCategories.emplace(begin(), *this, std::string(name), mValidator);
return std::make_tuple(begin(), isNew);
// bool isNew = false;
// iterator i = find_if(begin(), end(), [name](const Category &cat) -> bool
// { return iequals(cat.name(), name); });
// if (i == end())
// {
// isNew = true;
// i = mCategories.emplace(begin(), *this, std::string(name), mValidator);
// }
// else if (i != begin())
// {
// auto n = std::next(i);
// mCategories.splice(begin(), mCategories, i, n);
// i = mCategories.begin();
// }
// return std::make_tuple(i, isNew);
}
Category &Datablock::operator[](std::string_view name)
......
......@@ -123,14 +123,6 @@ const uint8_t kCharToLowerMap[256] =
// --------------------------------------------------------------------
bool iequals(const std::string &a, const std::string &b)
{
bool result = a.length() == b.length();
for (auto ai = a.begin(), bi = b.begin(); result and ai != a.end() and bi != b.end(); ++ai, ++bi)
result = tolower(*ai) == tolower(*bi);
return result;
}
bool iequals(std::string_view a, std::string_view b)
{
bool result = a.length() == b.length();
......@@ -148,25 +140,6 @@ bool iequals(const char *a, const char *b)
return result and *a == *b;
}
int icompare(const std::string &a, const std::string &b)
{
int d = 0;
auto ai = a.begin(), bi = b.begin();
for (; d == 0 and ai != a.end() and bi != b.end(); ++ai, ++bi)
d = tolower(*ai) - tolower(*bi);
if (d == 0)
{
if (ai != a.end())
d = 1;
else if (bi != b.end())
d = -1;
}
return d;
}
int icompare(std::string_view a, std::string_view b)
{
int d = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment