JsonHelper(3)

NAME
JsonHelper - The JsonHelper class is responsible for parsing the database (sqlite) to and from JSON.

SYNOPSIS

#include <jsonhelper.h>

  Public Member Functions
JsonHelper (QFileInfo database_file)

  Static Public Member Functions
static void exportDatabase ()
exportDatabase exports the currently active database to JSON.
static void importDatabase ()
importDatabase imports a dataset from JSON. Files need to be at AStanardPaths::JSON for now.
static QJsonDocument readFileToDoc (const QString &file_path)
readToDocument reads data from a JSON file into a QJSonDocument
static void writeDocToFile (const QJsonDocument &doc, const QString &file_name)
writes a QJsonDocument to a file

Detailed Description

The JsonHelper class is responsible for parsing the database (sqlite) to and from JSON.

Member Function Documentation

  void JsonHelper::exportDatabase () [static]

exportDatabase exports the currently active database to JSON. QJsonObject can be constructed from QHash<QString, QVariant> aka QVariantmap. All rows are put into a QJsonArray and the Array is embedded into a QJsonDocument, which can be exported. The files are created at Paths::Export.

  QJsonDocument JsonHelper::readFileToDoc (const QString & file_path) [static]

readToDocument reads data from a JSON file into a QJSonDocument

Parameters
    file_path

Author

Generated automatically by Doxygen for openPilotLog from the source code.