| xoreos
    0.0.5
    | 
This class allows reading/writing INI style config files. More...
#include <configfile.h>


| Public Types | |
| typedef PtrList< ConfigDomain > | DomainList | 
| Public Member Functions | |
| ConfigFile () | |
| ~ConfigFile () | |
| void | clear () | 
| Reset everything stored in this config file.  More... | |
| void | load (SeekableReadStream &stream) | 
| void | save (WriteStream &stream) const | 
| bool | hasDomain (const UString &name) const | 
| const DomainList & | getDomains () const | 
| ConfigDomain * | getDomain (const UString &name) | 
| const ConfigDomain * | getDomain (const UString &name) const | 
| ConfigDomain * | addDomain (const UString &name) | 
| bool | removeDomain (const UString &name) | 
| bool | renameDomain (const UString &oldName, const UString &newName) | 
| Static Public Member Functions | |
| static bool | isValidName (const UString &name) | 
| Check whether the given string is a valid section or key name.  More... | |
| Private Types | |
| typedef std::map< UString, ConfigDomain *, UString::iless > | DomainMap | 
| Private Member Functions | |
| void | parseConfigLine (const UString &line, UString &domainName, UString &key, UString &value, UString &comment, int lineNumber) | 
| void | addDomainKey (ConfigDomain &domain, const UString &key, const UString &value, const UString &comment, int lineNumber) | 
| void | addDomain (ConfigDomain *domain, int lineNumber) | 
| Private Attributes | |
| DomainList | _domainList | 
| List of domains in order.  More... | |
| DomainMap | _domainMap | 
| Domains indexed by name.  More... | |
| UString | _prologue | 
| Comments on top of the file.  More... | |
| UString | _epilogue | 
| Comments at the bottom of the file.  More... | |
This class allows reading/writing INI style config files.
It is used by the ConfigManager for storage, but can also be used by other code if it needs to read/write custom INI files.
Lines starting with a '#' are ignored (i.e. treated as comments). Some effort is made to preserve comments, though.
Definition at line 113 of file configfile.h.
Definition at line 115 of file configfile.h.
| 
 | private | 
Definition at line 147 of file configfile.h.
| Common::ConfigFile::ConfigFile | ( | ) | 
Definition at line 257 of file configfile.cpp.
| Common::ConfigFile::~ConfigFile | ( | ) | 
Definition at line 260 of file configfile.cpp.
| ConfigDomain * Common::ConfigFile::addDomain | ( | const UString & | name | ) | 
Definition at line 575 of file configfile.cpp.
References _domainList, _domainMap, and getDomain().
Referenced by load().


| 
 | private | 
Definition at line 407 of file configfile.cpp.
References _domainList, _domainMap, Common::ConfigDomain::_name, Common::UString::c_str(), and hasDomain().

| 
 | private | 
Definition at line 380 of file configfile.cpp.
References Common::ConfigDomain::_keys, Common::ConfigDomain::_lines, Common::ConfigDomain::_name, Common::UString::c_str(), Common::ConfigDomain::Line::comment, Common::UString::empty(), and Common::ConfigDomain::Line::key.
Referenced by load().


| void Common::ConfigFile::clear | ( | ) | 
Reset everything stored in this config file.
Definition at line 275 of file configfile.cpp.
References _domainList, _domainMap, _epilogue, _prologue, Common::PtrList< T, Deallocator >::clear(), and Common::UString::clear().

| ConfigDomain * Common::ConfigFile::getDomain | ( | const UString & | name | ) | 
Definition at line 559 of file configfile.cpp.
References _domainMap.
Referenced by addDomain(), Engines::Jade::AreaLayout::currentRoom(), and Engines::Jade::AreaLayout::updateCamera().

| const ConfigDomain * Common::ConfigFile::getDomain | ( | const UString & | name | ) | const | 
Definition at line 567 of file configfile.cpp.
References _domainMap.
| const ConfigFile::DomainList & Common::ConfigFile::getDomains | ( | ) | const | 
Definition at line 555 of file configfile.cpp.
References _domainList.
| bool Common::ConfigFile::hasDomain | ( | const UString & | name | ) | const | 
Definition at line 551 of file configfile.cpp.
References _domainMap.
Referenced by addDomain().

| 
 | static | 
Check whether the given string is a valid section or key name.
For that, it must only consist of letters, numbers, dashes and underscores. In particular, "#", "=", "[", "]" are not valid!
Definition at line 263 of file configfile.cpp.
References Common::UString::begin(), Common::UString::end(), and Common::UString::isASCII().
Referenced by load().


| void Common::ConfigFile::load | ( | SeekableReadStream & | stream | ) | 
Definition at line 283 of file configfile.cpp.
References _epilogue, _prologue, addDomain(), addDomainKey(), Common::UString::c_str(), Common::UString::clear(), Common::UString::empty(), Common::ReadStream::eos(), Common::ScopedPtrBase< T, Deallocator >::get(), isValidName(), Common::kEncodingUTF8, parseConfigLine(), Common::readStringLine(), Common::ScopedPtrBase< T, Deallocator >::release(), and Common::ScopedPtrBase< T, Deallocator >::reset().
Referenced by Engines::Jade::AreaLayout::loadART(), and Engines::NWN::Tileset::Tileset().


| 
 | private | 
Definition at line 421 of file configfile.cpp.
References Common::UString::begin(), Common::UString::empty(), Common::UString::end(), and Common::UString::trim().
Referenced by load().


| bool Common::ConfigFile::removeDomain | ( | const UString & | name | ) | 
Definition at line 590 of file configfile.cpp.
References _domainList, _domainMap, and Common::PtrList< T, Deallocator >::remove().

Definition at line 603 of file configfile.cpp.
References _domainMap, and Common::ConfigDomain::_name.
| void Common::ConfigFile::save | ( | WriteStream & | stream | ) | const | 
Definition at line 492 of file configfile.cpp.
References _domainList, _epilogue, _prologue, Common::UString::empty(), Common::WriteStream::flush(), Common::WriteStream::writeByte(), and Common::WriteStream::writeString().

| 
 | private | 
List of domains in order.
Definition at line 149 of file configfile.h.
Referenced by addDomain(), clear(), getDomains(), removeDomain(), and save().
| 
 | private | 
Domains indexed by name.
Definition at line 150 of file configfile.h.
Referenced by addDomain(), clear(), getDomain(), hasDomain(), removeDomain(), and renameDomain().
| 
 | private | 
Comments at the bottom of the file.
Definition at line 153 of file configfile.h.
| 
 | private | 
Comments on top of the file.
Definition at line 152 of file configfile.h.
 1.8.14
 1.8.14