git-svn-id: svn://db.shs.com.ru/libs@625 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2019-11-05 13:00:29 +00:00
parent 15f1045580
commit 5e2b563d57
18 changed files with 94 additions and 62 deletions

View File

@@ -410,7 +410,12 @@ QPIConfig::Entry & QPIConfig::addEntry(const QString & name, const QString & val
tn += delim + i;
}
QPIConfig::Branch ch = entry->_children;
qSort(ch.begin(), ch.end(), QPIConfig::Entry::compare);
#if QT_VERSION < QT_VERSION_CHECK(5,13,0)
qSort
#else
std::sort
#endif
(ch.begin(), ch.end(), QPIConfig::Entry::compare);
te = (entry->isLeaf() ? 0 : ch.back());
ce = new Entry();
ce->delim = delim;
@@ -423,7 +428,12 @@ QPIConfig::Entry & QPIConfig::addEntry(const QString & name, const QString & val
if (toRoot) ce->_line = other.size();
else {
ch = entry->_parent->_children;
qSort(ch.begin(), ch.end(), QPIConfig::Entry::compare);
#if QT_VERSION < QT_VERSION_CHECK(5,13,0)
qSort
#else
std::sort
#endif
(ch.begin(), ch.end(), QPIConfig::Entry::compare);
ce->_line = ch.back()->_line + 1;
}
} else {
@@ -473,6 +483,19 @@ void QPIConfig::setValue(const QString & name, const QString & value, const QStr
}
QPIConfig::Branch QPIConfig::allLeaves() {
Branch b;
allLeaves(b, &root);
#if QT_VERSION < QT_VERSION_CHECK(5,13,0)
qSort
#else
std::sort
#endif
(b.begin(), b.end(), Entry::compare);
return b;
}
int QPIConfig::entryIndex(const QString & name) {
QStringList tree = name.split(delim);
Entry * ce = &root;

View File

@@ -223,7 +223,7 @@ public:
bool isEntryExists(const QString & name) const {return entryExists(&root, name);}
Branch allTree() {Branch b; foreach (Entry * i, root._children) b << i; return b;}
Branch allLeaves() {Branch b; allLeaves(b, &root); qSort(b.begin(), b.end(), Entry::compare); return b;}
Branch allLeaves();
int entryIndex(const QString & name);
QString getName(uint number) {return entryByIndex(number)._name;}

View File

@@ -64,7 +64,12 @@ void QPIEvaluatorContent::clearCustomVariables() {
void QPIEvaluatorContent::sortVariables() {
var_index.clear();
qSort(variables.begin(), variables.end());
#if QT_VERSION < QT_VERSION_CHECK(5,13,0)
qSort
#else
std::sort
#endif
(variables.begin(), variables.end());
for (int i = 0; i < variables.size(); i++)
var_index[variables[i].name] = i;
/*