ToolX 1.11.1 [e3f477f]
A GUI debug tool chain for diagnosing GVA systems
Loading...
Searching...
No Matches
config_file.cpp File Reference

The ToolX configuration file: a JSON document holding every stream table and the overlay settings, written by File > Export and read by File > Import. More...

#include "config_file.h"
#include <QFile>
#include <QJsonDocument>
#include <QJsonParseError>
#include <QSaveFile>
Include dependency graph for config_file.cpp:

Functions

bool toolx::config::writeFile (const QString &path, const QJsonObject &sections, const QString &toolx_version, QString &error)
 Write a configuration file.
bool toolx::config::readFile (const QString &path, QJsonObject &document, QString &error)
 Read and check a configuration file.

Detailed Description

The ToolX configuration file: a JSON document holding every stream table and the overlay settings, written by File > Export and read by File > Import.

Function Documentation

◆ readFile()

bool toolx::config::readFile ( const QString & path,
QJsonObject & document,
QString & error )

Read and check a configuration file.

Parameters
paththe file to read
documentset to the whole document, including the header, when true is returned
errorset to the reason when false is returned
Returns
true if the file is a ToolX configuration file of a version this release can read

◆ writeFile()

bool toolx::config::writeFile ( const QString & path,
const QJsonObject & sections,
const QString & toolx_version,
QString & error )

Write a configuration file.

The header (application, file version and ToolX version) is added to the sections. The file is only readable by its owner because it can hold passphrases. It is written to a temporary file first, so a failure leaves any existing file untouched.

Parameters
paththe file to write
sectionsthe sections to store, keyed by the names in section
toolx_versionthe version of ToolX writing the file
errorset to the reason when false is returned
Returns
true if the file was written