27 #ifndef COMMON_CONFIGFILE_H 28 #define COMMON_CONFIGFILE_H 32 #include <boost/noncopyable.hpp> 40 class SeekableReadStream;
82 void set(
const ConfigDomain &domain,
bool clobber =
true);
87 StringIMap::const_iterator
key;
147 typedef std::map<UString, ConfigDomain *, UString::iless>
DomainMap;
165 #endif // COMMON_CONFIGFILE_H UString _comment
Comment on the same line as the domain definition.
bool removeDomain(const UString &name)
This class allows reading/writing INI style config files.
void setDouble(const UString &key, double value)
bool renameDomain(const UString &oldName, const UString &newName)
void save(WriteStream &stream) const
A class holding an UTF-8 string.
PtrList< ConfigDomain > DomainList
UString _prologue
Comment directly above the domain.
void setString(const UString &key, const UString &value)
void load(SeekableReadStream &stream)
std::map< UString, UString, UString::iless > StringIMap
DomainList _domainList
List of domains in order.
void parseConfigLine(const UString &line, UString &domainName, UString &key, UString &value, UString &comment, int lineNumber)
UString getString(const UString &key, const UString &def="") const
ConfigDomain(const UString &name)
const DomainList & getDomains() const
StringIMap _keys
The key/value pairs of the config domain.
A list storing pointer to objects, with automatic deletion.
bool removeKey(const UString &key)
int getInt(const UString &key, int def=0) const
bool getKey(const UString &key, UString &value) const
DomainMap _domainMap
Domains indexed by name.
LineList _lines
The lines of the config domain.
bool renameKey(const UString &oldName, const UString &newName)
Generic interface for a writable data stream.
void setBool(const UString &key, bool value)
void setInt(const UString &key, int value)
double getDouble(const UString &key, double def=0.0) const
std::map< UString, ConfigDomain *, UString::iless > DomainMap
UString _prologue
Comments on top of the file.
A map to quickly match strings from a list.
const UString & getName() const
Accessor for a domain (section) in a config file.
bool hasDomain(const UString &name) const
bool getBool(const UString &key, bool def=false) const
A line in the config domain.
void clear()
Reset everything stored in this config file.
UString _epilogue
Comments at the bottom of the file.
void addDomainKey(ConfigDomain &domain, const UString &key, const UString &value, const UString &comment, int lineNumber)
std::list< Line > LineList
ConfigDomain * getDomain(const UString &name)
void setKey(const UString &key, const UString &value)
uint getUint(const UString &key, uint def=0) const
static bool isValidName(const UString &name)
Check whether the given string is a valid section or key name.
bool hasKey(const UString &key) const
Interface for a seekable & readable data stream.
UString comment
Line comment.
ConfigDomain * addDomain(const UString &name)
StringIMap::const_iterator key
Pointer to the key/value pair.
void setUint(const UString &key, uint value)