mirror of
https://github.com/JulianGro/overte.git
synced 2025-08-12 22:03:55 +02:00
Add Paths entry parsing to json parser
This commit is contained in:
parent
82e21e89e4
commit
452c212c4f
1 changed files with 22 additions and 0 deletions
|
@ -117,6 +117,28 @@ bool OctreeEntitiesFileParser::parseEntities(QVariantMap& parsedEntities) {
|
||||||
int versionValue = readInteger();
|
int versionValue = readInteger();
|
||||||
parsedEntities["Version"] = versionValue;
|
parsedEntities["Version"] = versionValue;
|
||||||
gotVersion = true;
|
gotVersion = true;
|
||||||
|
} else if (key == "Paths") {
|
||||||
|
// Serverless JSON has optional Paths entry.
|
||||||
|
if (nextToken() != '{') {
|
||||||
|
_errorString = "Paths item is not an object";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int matchingBrace = findMatchingBrace();
|
||||||
|
if (matchingBrace < 0) {
|
||||||
|
_errorString = "Unterminated entity object";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray jsonObject = _entitiesContents.mid(_position - 1, matchingBrace - _position + 1);
|
||||||
|
QJsonDocument pathsObject = QJsonDocument::fromJson(jsonObject);
|
||||||
|
if (pathsObject.isNull()) {
|
||||||
|
_errorString = "Ill-formed paths entry";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
parsedEntities["Paths"] = pathsObject.object();
|
||||||
|
_position = matchingBrace;
|
||||||
} else {
|
} else {
|
||||||
_errorString = "Unrecognized key name: " + key;
|
_errorString = "Unrecognized key name: " + key;
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue