openPilotLog
JsonHelper Class Reference

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

#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. More...
 
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 More...
 
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

◆ exportDatabase()

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.

◆ readFileToDoc()

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

readToDocument reads data from a JSON file into a QJSonDocument

Parameters
file_path

The documentation for this class was generated from the following files: