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

@@ -49,10 +49,8 @@ Array &Array::operator=(const Array& other)
return *this;
}
#ifdef POCO_ENABLE_CPP11
Array::Array(Array&& other) :
Array::Array(Array&& other):
_values(std::move(other._values)),
_pArray(!other._modified ? other._pArray : 0),
_modified(other._modified)
@@ -60,22 +58,18 @@ Array::Array(Array&& other) :
_pArray = 0;
}
Array &Array::operator= (Array&& other)
Array &Array::operator = (Array&& other)
{
if (&other != this)
{
_values = std::move(other._values);
_pArray = other._pArray;
other._pArray = 0;
_modified = other._modified;
}
_values = std::move(other._values);
_pArray = other._pArray;
other._pArray = 0;
_modified = other._modified;
return *this;
}
#endif // POCO_ENABLE_CPP11
Array::~Array()
{
}

View File

@@ -42,10 +42,7 @@ Object::Object(const Object& other) : _values(other._values),
}
#ifdef POCO_ENABLE_CPP11
Object::Object(Object&& other) :
Object::Object(Object&& other):
_values(std::move(other._values)),
_keys(std::move(other._keys)),
_preserveInsOrder(other._preserveInsOrder),
@@ -57,25 +54,20 @@ Object::Object(Object&& other) :
}
Object &Object::operator= (Object &&other)
Object &Object::operator = (Object&& other)
{
if (&other != this)
{
_values = other._values;
_preserveInsOrder = other._preserveInsOrder;
syncKeys(other._keys);
_escapeUnicode = other._escapeUnicode;
_pStruct = !other._modified ? other._pStruct : 0;
_modified = other._modified;
other.clear();
}
_values = other._values;
_preserveInsOrder = other._preserveInsOrder;
syncKeys(other._keys);
_escapeUnicode = other._escapeUnicode;
_pStruct = !other._modified ? other._pStruct : 0;
_modified = other._modified;
other.clear();
return *this;
}
#endif // POCO_ENABLE_CPP11
Object::~Object()
{
}
@@ -224,9 +216,6 @@ Poco::DynamicStruct Object::makeStruct(const Object::Ptr& obj)
}
#ifdef POCO_ENABLE_CPP11
Poco::OrderedDynamicStruct Object::makeOrderedStruct(const Object::Ptr& obj)
{
return makeStructImpl<Poco::OrderedDynamicStruct>(obj);
@@ -242,7 +231,6 @@ void Object::resetOrdDynStruct() const
}
*/
#endif // POCO_ENABLE_CPP11
/*
void Object::resetDynStruct() const
@@ -286,9 +274,6 @@ Object::operator const Poco::DynamicStruct& () const
}
#ifdef POCO_ENABLE_CPP11
Object::operator const Poco::OrderedDynamicStruct& () const
{
if (!_values.size())
@@ -345,9 +330,6 @@ Object::operator const Poco::OrderedDynamicStruct& () const
}
#endif // POCO_ENABLE_CPP11
void Object::clear()
{
_values.clear();

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;
}
}

View File

@@ -42,7 +42,7 @@ public:
virtual void render(const Var& data, std::ostream& out) const = 0;
typedef std::vector<SharedPtr<Part> > VectorParts;
typedef std::vector<SharedPtr<Part>> VectorParts;
};
@@ -99,9 +99,9 @@ public:
void render(const Var& data, std::ostream& out) const
{
for (VectorParts::const_iterator it = _parts.begin(); it != _parts.end(); ++it)
for (const auto& p: _parts)
{
(*it)->render(data, out);
p->render(data, out);
}
}
@@ -246,7 +246,7 @@ public:
void render(const Var& data, std::ostream& out) const
{
int count = 0;
for (std::vector<SharedPtr<LogicQuery> >::const_iterator it = _queries.begin(); it != _queries.end(); ++it, ++count)
for (auto it = _queries.begin(); it != _queries.end(); ++it, ++count)
{
if ((*it)->apply(data) && _parts.size() > count)
{
@@ -257,7 +257,7 @@ public:
}
private:
std::vector<SharedPtr<LogicQuery> > _queries;
std::vector<SharedPtr<LogicQuery>> _queries;
};

View File

@@ -131,9 +131,9 @@ Path TemplateCache::resolvePath(const Path& path) const
if (path.isAbsolute())
return path;
for (std::vector<Path>::const_iterator it = _includePaths.begin(); it != _includePaths.end(); ++it)
for (const auto& p: _includePaths)
{
Path templatePath(*it, path);
Path templatePath(p, path);
File templateFile(templatePath);
if (templateFile.exists())