Generic resources files reader/writer class.
#include <QtxResourceMgr.h>
Public Member Functions | |
Format (const QString &) | |
Constructor. More... | |
virtual | ~Format () |
Destructor. More... | |
QString | format () const |
Get the format name. More... | |
QStringList | options () const |
Get options names. More... | |
QString | option (const QString &) const |
Get the value of the option with specified name. More... | |
void | setOption (const QString &, const QString &) |
Set the value of the option with specified name. More... | |
bool | load (Resources *) |
Load resources from the resource file. More... | |
bool | save (Resources *) |
Save resources to the resource file. More... | |
Protected Member Functions | |
virtual bool | load (const QString &, QMap< QString, Section > &)=0 |
Load resources from the specified resources file. More... | |
virtual bool | save (const QString &, const QMap< QString, Section > &)=0 |
Save resources to the specified resources file. More... | |
Private Attributes | |
QString | myFmt |
format name More... | |
QMap< QString, QString > | myOpt |
options map More... | |
QtxResourceMgr::Format::Format | ( | const QString & | fmt | ) |
fmt | format name (for example, "xml" or "ini") |
|
virtual |
QString QtxResourceMgr::Format::format | ( | ) | const |
bool QtxResourceMgr::Format::load | ( | Resources * | res | ) |
res | resources object |
true
on success and false
on error References QtxResourceMgr::load(), QtxResourceMgr::Resources::myFileName, QtxResourceMgr::Resources::mySections, and QtxResourceMgr::sections().
|
protectedpure virtual |
Should be implemented in the successors.
fname | resources file name |
secMap | resources map to be filled in |
true
on success and false
on error Implemented in QtxResourceMgr::XmlFormat, and QtxResourceMgr::IniFormat.
QString QtxResourceMgr::Format::option | ( | const QString & | opt | ) | const |
If option doesn't exist then null QString is returned.
opt | option name |
QStringList QtxResourceMgr::Format::options | ( | ) | const |
bool QtxResourceMgr::Format::save | ( | Resources * | res | ) |
res | resources object |
true
on success and false
on error References QtxResourceMgr::appName(), Qtx::dir(), Qtx::mkDir(), QtxResourceMgr::Resources::myFileName, QtxResourceMgr::Resources::mySections, QtxResourceMgr::Resources::resMgr(), QtxResourceMgr::save(), and QtxResourceMgr::userFileName().
|
protectedpure virtual |
Should be implemented in the successors.
fname | resources file name |
secMap | resources map |
true
on success and false
on error Implemented in QtxResourceMgr::XmlFormat, and QtxResourceMgr::IniFormat.
opt | option name |
val | option value |
|
private |
|
private |