App: modernize C++: use range-based for loop

This commit is contained in:
wmayer
2023-08-14 16:37:45 +02:00
committed by wwmayer
parent 367cdb36ed
commit 26f16f7410
22 changed files with 422 additions and 418 deletions

View File

@@ -179,19 +179,19 @@ void PropertyPythonObject::loadPickle(const std::string& str)
std::string PropertyPythonObject::encodeValue(const std::string& str) const
{
std::string tmp;
for (std::string::const_iterator it = str.begin(); it != str.end(); ++it) {
if (*it == '<')
for (char it : str) {
if (it == '<')
tmp += "&lt;";
else if (*it == '"')
else if (it == '"')
tmp += "&quot;";
else if (*it == '&')
else if (it == '&')
tmp += "&amp;";
else if (*it == '>')
else if (it == '>')
tmp += "&gt";
else if (*it == '\n')
else if (it == '\n')
tmp += "\\n";
else
tmp += *it;
tmp += it;
}
return tmp;
@@ -384,8 +384,8 @@ void PropertyPythonObject::Restore(Base::XMLReader &reader)
void PropertyPythonObject::SaveDocFile (Base::Writer &writer) const
{
std::string buffer = this->toString();
for (std::string::iterator it = buffer.begin(); it != buffer.end(); ++it)
writer.Stream().put(*it);
for (char it : buffer)
writer.Stream().put(it);
}
void PropertyPythonObject::RestoreDocFile(Base::Reader &reader)