Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members  

fun::ConfigFile Class Reference

ConfigFile loads and saves configuration files which can be represented as simple key/value pairs of strings. More...

#include <ConfigFile.h>

Inheritance diagram for fun::ConfigFile:

fun::PropertyList fun::Serializable fun::LoadableClass List of all members.

Public Slots

virtual bool loadFromXML (const QString &filename=QString())
 Loads this ConfigFile from the given file.

virtual bool saveToXML (const QString &filename=QString()) const
 Saves this ConfigFile to the given file.

bool loadFromText (std::istream &is)
 Loads this ConfigFile from the given input stream.

bool saveToText (std::ostream &os) const
 Stores this ConfigFile to the given output stream.


Public Methods

virtual void deserialize (const Deserializer &node)
 Tells the object to restore it's state from the given Deserializer.

virtual void serialize (Serializer &node) const
 Tells the instance to save it's state to the given Serializer object.


Detailed Description

ConfigFile loads and saves configuration files which can be represented as simple key/value pairs of strings.

They can be loaded from & saved to plain text or XML files.

The most interesting methods are probably getString(), getInt(), etc., as those are how you get at the configuration values loaded from file. If you need to know whether a value was explicitly set in the file, use isSet(). That might be a little cumbersome; hopefully there aren't that many cases where it will matter whether a value was explicitly set, or couldn't be interpreted as an int or whatever.

The text format used will treat lines ending in "\" as continued on the next line. \t and
will be expanded into tab and newline during reading, and will be escaped again during writing.

Definition at line 68 of file ConfigFile.h.


Member Function Documentation

bool fun::ConfigFile::loadFromXML const QString &    filename = QString() [virtual, slot]
 

Loads this ConfigFile from the given file.

If filename is empty, this->getFilename() will be used.

Definition at line 174 of file ConfigFile.cpp.

References fun::Deserializer::getSerializable(), and fun::PropertyList::mergeIn().

bool fun::ConfigFile::saveToXML const QString &    filename = QString() const [virtual, slot]
 

Saves this ConfigFile to the given file.

If filename is empty, this->getFilename() will be used.

Definition at line 203 of file ConfigFile.cpp.

References fun::Serializer::putSerializable(), and fun::SerialTree::saveToXMLFile().


The documentation for this class was generated from the following files:
Generated on Mon Aug 11 14:06:56 2003 for libfunutil by doxygen1.2.18