merge some changes from develop branch; modernize and clean-up code; remove support for compiling without POCO_WIN32_UTF8

This commit is contained in:
Günter Obiltschnig
2020-01-09 10:08:09 +01:00
parent 7c177b6f89
commit 1bf40a0cd2
389 changed files with 3029 additions and 4111 deletions

View File

@@ -102,7 +102,7 @@ Var Query::find(const std::string& path) const
{
Var result = _source;
StringTokenizer tokenizer(path, ".");
for (StringTokenizer::Iterator token = tokenizer.begin(); token != tokenizer.end(); token++)
for (const auto& token: tokenizer)
{
if (!result.isEmpty())
{
@@ -111,18 +111,18 @@ Var Query::find(const std::string& path) const
int firstOffset = -1;
int offset = 0;
RegularExpression regex("\\[([0-9]+)\\]");
while (regex.match(*token, offset, matches) > 0)
while (regex.match(token, offset, matches) > 0)
{
if (firstOffset == -1)
{
firstOffset = static_cast<int>(matches[0].offset);
}
std::string num = token->substr(matches[1].offset, matches[1].length);
std::string num(token, matches[1].offset, matches[1].length);
indexes.push_back(NumberParser::parse(num));
offset = static_cast<int>(matches[0].offset + matches[0].length);
}
std::string name(*token);
std::string name(token);
if (firstOffset != -1)
{
name = name.substr(0, firstOffset);
@@ -147,18 +147,18 @@ Var Query::find(const std::string& path) const
if (!result.isEmpty() && !indexes.empty())
{
for (std::vector<int>::iterator it = indexes.begin(); it != indexes.end(); ++it)
for (auto i: indexes)
{
if (result.type() == typeid(Array::Ptr))
{
Array::Ptr array = result.extract<Array::Ptr>();
result = array->get(*it);
result = array->get(i);
if (result.isEmpty()) break;
}
else if (result.type() == typeid(Array))
{
Array array = result.extract<Array>();
result = array.get(*it);
result = array.get(i);
if (result.isEmpty()) break;
}
}