get rid of piForeach

apply some code analyzer recommendations
ICU flag now check if libicu exists
prepare for more accurate growth of containers (limited PoT, then constantly increase size)
This commit is contained in:
2024-11-20 20:01:47 +03:00
parent 24112498ce
commit caa7880cc4
40 changed files with 415 additions and 320 deletions

View File

@@ -121,7 +121,7 @@ int PIPropertyStorage::removePropertiesByFlag(int flag) {
//! \~russian "flag_ignore" - битовое поле для исключения свойств из процесса слияния
void PIPropertyStorage::updateProperties(const PIVector<PIPropertyStorage::Property> & properties_, int flag_ignore) {
PIMap<PIString, PIVariant> values;
piForeachC(Property & p, props)
for (const auto & p: props)
if (((p.flags & flag_ignore) != flag_ignore) || (flag_ignore == 0)) values[p.name] = p.value;
props = properties_;
for (uint i = 0; i < props.size(); ++i) {
@@ -135,14 +135,14 @@ void PIPropertyStorage::updateProperties(const PIVector<PIPropertyStorage::Prope
PIPropertyStorage::Property PIPropertyStorage::propertyByName(const PIString & name) const {
piForeachC(Property & p, props)
for (const auto & p: props)
if (p.name == name) return p;
return Property();
}
PIVariant PIPropertyStorage::propertyValueByName(const PIString & name) const {
piForeachC(Property & p, props)
for (const auto & p: props)
if (p.name == name) return p.value;
return PIVariant();
}
@@ -182,7 +182,7 @@ bool PIPropertyStorage::setPropertyFlags(const PIString & name, int flags) {
PIPropertyStorage::Property & PIPropertyStorage::operator[](const PIString & name) {
piForeach(Property & p, props)
for (auto & p: props)
if (p.name == name) return p;
addProperty(name, "");
return props.back();
@@ -190,7 +190,7 @@ PIPropertyStorage::Property & PIPropertyStorage::operator[](const PIString & nam
const PIPropertyStorage::Property PIPropertyStorage::operator[](const PIString & name) const {
piForeachC(Property & p, props)
for (const auto & p: props)
if (p.name == name) return p;
return Property();
}

View File

@@ -128,7 +128,7 @@ PIString PIVariantTypes::IODevice::toPICout() const {
}
#endif // MICRO_PIP
PIPropertyStorage ps = get();
piForeachC(PIPropertyStorage::Property & p, ps) {
for (const auto & p: ps) {
s += ", " + p.name + "=\"" + p.value.toString() + "\"";
}
s += ")";