QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
JsonValidation.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/QJsonObject>
4#include <QtCore/QStringList>
5
6namespace JsonParsing {
7
9bool validateRequiredKeys(const QJsonObject& jsonObject, const QStringList& keys, QString& errorString);
10
13bool validateKeyTypes(const QJsonObject& jsonObject, const QStringList& keys, const QList<QJsonValue::Type>& types,
14 QString& errorString);
15
17{
18 const char* key;
19 QJsonValue::Type type;
20 bool required;
21};
22
24bool validateKeys(const QJsonObject& jsonObject, const QList<KeyValidateInfo>& keyInfo, QString& errorString);
25
27bool validateKeysStrict(const QJsonObject& jsonObject, const QList<KeyValidateInfo>& keyInfo, QString& errorString);
28
29} // namespace JsonParsing
QString errorString
std::array< MsgOutKey, 4 > keys
Definition UBXPlan.cc:13
bool validateKeyTypes(const QJsonObject &jsonObject, const QStringList &keys, const QList< QJsonValue::Type > &types, 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 validateKeysStrict(const QJsonObject &jsonObject, const QList< KeyValidateInfo > &keyInfo, QString &errorString)
Validates keys like validateKeys but also rejects any keys not listed in keyInfo.
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