mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 18:25:52 +02:00
perform requested interpolation when unpacking
This commit is contained in:
parent
99bddcc102
commit
5e2a22a006
2 changed files with 14 additions and 2 deletions
|
@ -153,6 +153,7 @@ QVariantMap JSONBreakableMarshal::fromStringList(const QStringList& stringList)
|
||||||
QVariant* currentValue = &result;
|
QVariant* currentValue = &result;
|
||||||
|
|
||||||
// pull the key (everything left of the equality sign)
|
// pull the key (everything left of the equality sign)
|
||||||
|
QString parentKeypath;
|
||||||
QString keypath = marshalString.left(equalityIndex);
|
QString keypath = marshalString.left(equalityIndex);
|
||||||
|
|
||||||
// setup for array index checking
|
// setup for array index checking
|
||||||
|
@ -161,6 +162,8 @@ QVariantMap JSONBreakableMarshal::fromStringList(const QStringList& stringList)
|
||||||
|
|
||||||
// as long as we have a keypath we need to recurse downwards
|
// as long as we have a keypath we need to recurse downwards
|
||||||
while (!keypath.isEmpty()) {
|
while (!keypath.isEmpty()) {
|
||||||
|
parentKeypath = keypath;
|
||||||
|
|
||||||
int arrayBracketIndex = arrayRegex.indexIn(keypath);
|
int arrayBracketIndex = arrayRegex.indexIn(keypath);
|
||||||
|
|
||||||
// is this an array index
|
// is this an array index
|
||||||
|
@ -255,10 +258,19 @@ QVariantMap JSONBreakableMarshal::fromStringList(const QStringList& stringList)
|
||||||
|
|
||||||
// change the currentValue to the QJsonValue for this key
|
// change the currentValue to the QJsonValue for this key
|
||||||
currentValue = ¤tMap[subKey];
|
currentValue = ¤tMap[subKey];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*currentValue = fromString(marshalString.mid(equalityIndex + 1));
|
*currentValue = fromString(marshalString.mid(equalityIndex + 1));
|
||||||
|
|
||||||
|
if (_interpolationMap.contains(parentKeypath)) {
|
||||||
|
// we expect the currentValue here to be a string, that's the key we use for interpolation
|
||||||
|
// bail if it isn't
|
||||||
|
if (currentValue->canConvert(QMetaType::QString)
|
||||||
|
&& _interpolationMap[parentKeypath].canConvert(QMetaType::QVariantMap)) {
|
||||||
|
*currentValue = _interpolationMap[parentKeypath].toMap()[currentValue->toString()];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ const QString ASSIGNMENT_CLIENT_MONITOR_LOCAL_PORT_SMEM_KEY = "assignment-client
|
||||||
const char DEFAULT_ASSIGNMENT_CLIENT_MONITOR_HOSTNAME[] = "localhost";
|
const char DEFAULT_ASSIGNMENT_CLIENT_MONITOR_HOSTNAME[] = "localhost";
|
||||||
const unsigned short DEFAULT_ASSIGNMENT_CLIENT_MONITOR_PORT = 40104;
|
const unsigned short DEFAULT_ASSIGNMENT_CLIENT_MONITOR_PORT = 40104;
|
||||||
|
|
||||||
const QString USERNAME_UUID_REPLACEMENT_STATS_KEY = "$username_for_uuid";
|
const QString USERNAME_UUID_REPLACEMENT_STATS_KEY = "$username";
|
||||||
|
|
||||||
class HifiSockAddr;
|
class HifiSockAddr;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue