forked from qt-creator/qt-creator
UserFileAccessor: Remove unused helper functions
Amends b6c9879f41
.
Change-Id: Iae5034a5afa47c671c5f9de5167b0566784bab37
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -152,47 +152,6 @@ Q_DECLARE_TYPEINFO(HandlerNode, Q_MOVABLE_TYPE);
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
static HandlerNode buildHandlerNodes(const char * const **keys)
|
||||
{
|
||||
HandlerNode ret;
|
||||
while (const char *rname = *(*keys)++) {
|
||||
QString name = QLatin1String(rname);
|
||||
if (name.endsWith('.')) {
|
||||
HandlerNode sub = buildHandlerNodes(keys);
|
||||
foreach (const QString &key, name.split('|'))
|
||||
ret.children.insert(key, sub);
|
||||
} else {
|
||||
ret.strings.insert(name);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static QVariantMap processHandlerNodes(const HandlerNode &node, const QVariantMap &map,
|
||||
QVariant (*handler)(const QVariant &var))
|
||||
{
|
||||
QVariantMap result;
|
||||
QMapIterator<QString, QVariant> it(map);
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
const QString &key = it.key();
|
||||
if (node.strings.contains(key)) {
|
||||
result.insert(key, handler(it.value()));
|
||||
goto handled;
|
||||
}
|
||||
if (it.value().type() == QVariant::Map)
|
||||
for (QHash<QString, HandlerNode>::ConstIterator subit = node.children.constBegin();
|
||||
subit != node.children.constEnd(); ++subit)
|
||||
if (key.startsWith(subit.key())) {
|
||||
result.insert(key, processHandlerNodes(subit.value(), it.value().toMap(), handler));
|
||||
goto handled;
|
||||
}
|
||||
result.insert(key, it.value());
|
||||
handled: ;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// Helpers:
|
||||
// --------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user