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:
@@ -102,7 +102,7 @@ public:
|
||||
Branch getBranches();
|
||||
Branch & filter(const PIString & f);
|
||||
bool isEntryExists(const PIString & name) const {
|
||||
piForeachC(Entry * i, *this)
|
||||
for (const auto * i: *this)
|
||||
if (entryExists(i, name)) return true;
|
||||
return false;
|
||||
}
|
||||
@@ -115,7 +115,7 @@ public:
|
||||
private:
|
||||
bool entryExists(const Entry * e, const PIString & name) const;
|
||||
void allLeaves(Branch & b, Entry * e) {
|
||||
piForeach(Entry * i, e->_children) {
|
||||
for (auto * i: e->_children) {
|
||||
if (i->isLeaf())
|
||||
b << i;
|
||||
else
|
||||
@@ -124,12 +124,12 @@ public:
|
||||
}
|
||||
#ifdef PIP_STD_IOSTREAM
|
||||
void coutt(std::ostream & s, const PIString & p) const {
|
||||
piForeachC(Entry * i, *this)
|
||||
for (const auto * i: *this)
|
||||
i->coutt(s, p);
|
||||
}
|
||||
#endif
|
||||
void piCoutt(PICout s, const PIString & p) const {
|
||||
piForeachC(Entry * i, *this)
|
||||
for (const auto * i: *this)
|
||||
i->piCoutt(s, p);
|
||||
}
|
||||
|
||||
@@ -165,14 +165,14 @@ public:
|
||||
|
||||
//! Returns first child with name "name"
|
||||
Entry * findChild(const PIString & name) {
|
||||
piForeach(Entry * i, _children)
|
||||
for (auto * i: _children)
|
||||
if (i->_name == name) return i;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//! Returns first child with name "name"
|
||||
const Entry * findChild(const PIString & name) const {
|
||||
piForeachC(Entry * i, _children)
|
||||
for (const auto * i: _children)
|
||||
if (i->_name == name) return i;
|
||||
return 0;
|
||||
}
|
||||
@@ -425,7 +425,7 @@ public:
|
||||
#endif
|
||||
void piCoutt(PICout s, const PIString & p) const;
|
||||
void deleteBranch() {
|
||||
piForeach(Entry * i, _children) {
|
||||
for (auto * i: _children) {
|
||||
i->deleteBranch();
|
||||
delete i;
|
||||
}
|
||||
@@ -573,7 +573,7 @@ public:
|
||||
//! Returns all top-level entries
|
||||
Branch allTree() {
|
||||
Branch b;
|
||||
piForeach(Entry * i, root._children)
|
||||
for (auto * i: root._children)
|
||||
b << i;
|
||||
b.delim = delim;
|
||||
return b;
|
||||
@@ -636,14 +636,14 @@ private:
|
||||
void _writeDev(const PIString & l);
|
||||
int childCount(const Entry * e) const {
|
||||
int c = 0;
|
||||
piForeachC(Entry * i, e->_children)
|
||||
for (const auto * i: e->_children)
|
||||
c += childCount(i);
|
||||
c += e->_children.size_s();
|
||||
return c;
|
||||
}
|
||||
bool entryExists(const Entry * e, const PIString & name) const;
|
||||
void buildFullNames(Entry * e) {
|
||||
piForeach(Entry * i, e->_children) {
|
||||
for (auto * i: e->_children) {
|
||||
if (e != &root)
|
||||
i->_full_name = e->_full_name + delim + i->_name;
|
||||
else
|
||||
@@ -652,13 +652,13 @@ private:
|
||||
}
|
||||
}
|
||||
void allLeaves(Branch & b, Entry * e) {
|
||||
piForeach(Entry * i, e->_children) {
|
||||
for (auto * i: e->_children) {
|
||||
if ((!i->_value.isEmpty() && !i->isLeaf()) || i->isLeaf()) b << i;
|
||||
allLeaves(b, i);
|
||||
}
|
||||
}
|
||||
void setEntryDelim(Entry * e, const PIString & d) {
|
||||
piForeach(Entry * i, e->_children)
|
||||
for (auto * i: e->_children)
|
||||
setEntryDelim(i, d);
|
||||
e->delim = d;
|
||||
}
|
||||
@@ -669,7 +669,7 @@ private:
|
||||
}
|
||||
void removeEntry(Branch & b, Entry * e);
|
||||
void deleteEntry(Entry * e) {
|
||||
piForeach(Entry * i, e->_children)
|
||||
for (auto * i: e->_children)
|
||||
deleteEntry(i);
|
||||
delete e;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user