ParametersFileLoaderSaver Class Referenceabstract

The base for all classes able to load/save configuration parameters from/to file. More...

Public Member Functions

 ParametersFileLoaderSaver ()
 Constructor.
 
virtual ~ParametersFileLoaderSaver ()
 Destructor.
 
bool load (QString filename, ConfigurationParameters &configParams, bool keepOld=false)
 Load configuration from the given file and store them to ConfigurationParameters.
 
bool save (QString filename, const ConfigurationParameters &configParams, bool append=false)
 Save configuration from the ConfigurationParameters to the given file.
 

Protected Member Functions

virtual bool loadParameters (QTextStream &stream, ConfigurationParameters &configParams)=0
 The function actually load configuration from the given stream.
 
virtual bool saveParameters (QTextStream &stream, const ConfigurationParameters &configParams)=0
 The function actually save configuration to the given stream.
 

Detailed Description

The base for all classes able to load/save configuration parameters from/to file.

When subclassing this, you should only override loadParameters and saveParameters

Definition at line 39 of file parametersfileloadersaver.h.

Constructor & Destructor Documentation

Constructor.

Definition at line 45 of file parametersfileloadersaver.h.

virtual ~ParametersFileLoaderSaver ( )
inlinevirtual

Destructor.

Definition at line 52 of file parametersfileloadersaver.h.

Member Function Documentation

bool load ( QString  filename,
ConfigurationParameters configParams,
bool  keepOld = false 
)

Load configuration from the given file and store them to ConfigurationParameters.

Parameters
filenamethe name of the file from which configuration should be loaded
configParamsthe ConfigurationParameters which data will be stored
keepOldif true previous parameters are deleted before loading the new ones, otherwise they are kept (however they can be overridden)
Returns
true on success, false otherwise

Definition at line 28 of file parametersfileloadersaver.cpp.

References ConfigurationParameters::clearAll(), and ParametersFileLoaderSaver::loadParameters().

virtual bool loadParameters ( QTextStream &  stream,
ConfigurationParameters configParams 
)
protectedpure virtual

The function actually load configuration from the given stream.

Implement in subclasses

Parameters
streamthe stream from which data should be read
Returns
true if loading was successful, false otherwise

Referenced by ParametersFileLoaderSaver::load().

bool save ( QString  filename,
const ConfigurationParameters configParams,
bool  append = false 
)

Save configuration from the ConfigurationParameters to the given file.

Parameters
filenamethe name of the file to which configuration will be saved
configParamsthe ConfigurationParameters to save on file
appendif true it appends the parameters to the file specified lefting any previous data present on the file untouched; if false, it delete any previous data on file

Definition at line 56 of file parametersfileloadersaver.cpp.

References ParametersFileLoaderSaver::saveParameters().

virtual bool saveParameters ( QTextStream &  stream,
const ConfigurationParameters configParams 
)
protectedpure virtual

The function actually save configuration to the given stream.

Implement in subclasses

Parameters
streamthe stream to which data should be write
Returns
true if loading was successful, false otherwise

Referenced by ParametersFileLoaderSaver::save().


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