3#include <QtCore/QJsonDocument>
4#include <QtCore/QJsonObject>
5#include <QtCore/QJsonValue>
6#include <QtCore/QStringList>
27bool validateKeyTypes(
const QJsonObject& jsonObject,
const QStringList& keys,
const QList<QJsonValue::Type>& types,
54 const QString &expectedFileType,
55 int minSupportedVersion,
56 int maxSupportedVersion,
63 const QString &expectedFileType,
64 int minSupportedVersion,
65 int maxSupportedVersion,
73 const QString &expectedFileType,
74 int minSupportedVersion,
75 int maxSupportedVersion,
78 const QStringList &defaultTranslateKeys = {},
79 const QStringList &defaultArrayIDKeys = {});
bool validateExternalQGCJsonFile(const QJsonObject &jsonObject, const QString &expectedFileType, int minSupportedVersion, int maxSupportedVersion, int &version, QString &errorString)
bool validateKeyTypes(const QJsonObject &jsonObject, const QStringList &keys, const QList< QJsonValue::Type > &types, QString &errorString)
bool validateInternalQGCJsonFile(const QJsonObject &jsonObject, const QString &expectedFileType, int minSupportedVersion, int maxSupportedVersion, int &version, QString &errorString)
bool validateKeys(const QJsonObject &jsonObject, const QList< KeyValidateInfo > &keyInfo, QString &errorString)
Validates that all required keys are present and that listed keys have the expected type.
bool isJsonFile(const QByteArray &bytes, QJsonDocument &jsonDoc, QString &errorString)
Determines whether an in-memory byte buffer contains parseable JSON content.
constexpr const char * jsonFileTypeKey
QJsonObject openInternalQGCJsonFile(const QString &jsonFilename, const QString &expectedFileType, int minSupportedVersion, int maxSupportedVersion, int &version, QString &errorString, const QStringList &defaultTranslateKeys, const QStringList &defaultArrayIDKeys)
double possibleNaNJsonValue(const QJsonValue &value)
Returns NaN if the value is null, or the value converted to double otherwise.
void saveQGCJsonFileHeader(QJsonObject &jsonObject, const QString &fileType, int version)
Saves the standard QGC file header (groundStation, fileType, version) into the json object.
bool validateKeysStrict(const QJsonObject &jsonObject, const QList< KeyValidateInfo > &keyInfo, QString &errorString)
Validates keys like validateKeys but also rejects any keys not listed in keyInfo.
QTranslator * translator()
Translator used by openInternalQGCJsonFile for localized strings.
constexpr const char * jsonVersionKey
bool validateRequiredKeys(const QJsonObject &jsonObject, const QStringList &keys, QString &errorString)
Validates that all listed keys are present in the object.
bool required
true: key must be present
QJsonValue::Type type
required type for key, QJsonValue::Null specifies double with possible NaN
const char * key
json key name