CamiTKFile provides functions to read and write in the CAMITK file format. More...
#include <CamiTKFile.h>
Public Member Functions | |
| void | addContent (QString key, const QVariant) |
| Add an element to the CamiTKFile with the provided key. | |
| CamiTKFile () | |
| Construct an empty CamiTKFile (only header information). | |
| QVariant | getContent (QString key) |
| QDateTime | getTimestamp () |
| QString | getVersion () |
| bool | hasContent (QString key) |
| bool | isValid () |
| bool | save (QString filepath) |
| Save the CamitTKFile to a file. | |
| bool | save (QUrl url) |
| Save the CamitTKFile to a url (if the protocol is supported). | |
| void | setCurrentTimestamp () |
| void | setCurrentVersion () |
Static Public Member Functions | |
| static CamiTKFile | load (QString filepath) |
| Read a CamiTKFile from a filepath. | |
| static CamiTKFile | load (QUrl url) |
| Read a CamiTKFile from a url (if the protocol is supported). | |
Static Public Attributes | |
| static const int | maxFileSize = 10000000 |
| maximum authorized camitk file size in bytes (to prevent memory overflow) | |
| static const char * | version = "camitk-6.0" |
| Version of the camitk file format This is the CamiTK version which introduced the latest changes in the camitk format. | |
CamiTKFile provides functions to read and write in the CAMITK file format.
Schematic CamiTKFile format (JSON):
| camitk::CamiTKFile::CamiTKFile | ( | ) |
Construct an empty CamiTKFile (only header information).
References setCurrentTimestamp(), and setCurrentVersion().
| void camitk::CamiTKFile::addContent | ( | QString | key, |
| const QVariant | value ) |
Add an element to the CamiTKFile with the provided key.
If the key already exists, this will replace the current content for this key
The QVariant may be a value (QString, QUrl, double...), a QList<QVariant> or a QMap<QVariant>
Referenced by camitk::PersistenceManager::saveWorkspace().
| QVariant camitk::CamiTKFile::getContent | ( | QString | key | ) |
Referenced by camitk::PersistenceManager::loadWorkspace().
| QDateTime camitk::CamiTKFile::getTimestamp | ( | ) |
References camitk::toString().
| QString camitk::CamiTKFile::getVersion | ( | ) |
Referenced by camitk::PersistenceManager::loadWorkspace().
| bool camitk::CamiTKFile::hasContent | ( | QString | key | ) |
Referenced by camitk::PersistenceManager::loadWorkspace().
| bool camitk::CamiTKFile::isValid | ( | ) |
Referenced by camitk::PersistenceManager::loadWorkspace().
|
static |
Read a CamiTKFile from a filepath.
References CAMITK_ERROR_ALT, CAMITK_WARNING_ALT, CamiTKFile(), and maxFileSize.
Referenced by load(), and camitk::PersistenceManager::loadWorkspace().
|
static |
Read a CamiTKFile from a url (if the protocol is supported).
References CamiTKFile(), and load().
| bool camitk::CamiTKFile::save | ( | QString | filepath | ) |
Save the CamitTKFile to a file.
References setCurrentTimestamp(), and setCurrentVersion().
Referenced by save(), and camitk::PersistenceManager::saveWorkspace().
| bool camitk::CamiTKFile::save | ( | QUrl | url | ) |
Save the CamitTKFile to a url (if the protocol is supported).
References save(), and setCurrentTimestamp().
| void camitk::CamiTKFile::setCurrentTimestamp | ( | ) |
Referenced by CamiTKFile(), save(), and save().
| void camitk::CamiTKFile::setCurrentVersion | ( | ) |
References version.
Referenced by CamiTKFile(), and save().
|
static |
maximum authorized camitk file size in bytes (to prevent memory overflow)
Referenced by load().
|
static |
Version of the camitk file format This is the CamiTK version which introduced the latest changes in the camitk format.
Please update this to the current version of Core::version() when introducing
Referenced by camitk::PersistenceManager::loadWorkspace(), and setCurrentVersion().