#include <ConfigFile.h>
Classes | |
struct | file_not_found |
struct | key_not_found |
Public Member Functions | |
template<class T > | |
void | add (string key, const T &value) |
ConfigFile (string filename, string delimiter="=", string comment="#", string sentry="EndConfigFile") | |
ConfigFile () | |
string | getComment () const |
string | getDelimiter () const |
string | getSentry () const |
bool | keyExists (const string &key) const |
template<class T > | |
T | read (const string &key) const |
template<class T > | |
T | read (const string &key, const T &value) const |
template<class T > | |
bool | readInto (T &var, const string &key) const |
template<class T > | |
bool | readInto (T &var, const string &key, const T &value) const |
void | remove (const string &key) |
string | setComment (const string &s) |
string | setDelimiter (const string &s) |
Protected Types | |
typedef std::map< string, string >::const_iterator | mapci |
typedef std::map< string, string >::iterator | mapi |
Static Protected Member Functions | |
template<class T > | |
static T | string_as_T (const string &s) |
template<class T > | |
static string | T_as_string (const T &t) |
static void | trim (string &s) |
Protected Attributes | |
string | myComment |
std::map< string, string > | myContents |
string | myDelimiter |
string | mySentry |
Friends | |
std::ostream & | operator<< (std::ostream &os, const ConfigFile &cf) |
std::istream & | operator>> (std::istream &is, ConfigFile &cf) |
Definition at line 54 of file ConfigFile.h.
typedef std::map<string,string>::const_iterator ConfigFile::mapci [protected] |
Definition at line 63 of file ConfigFile.h.
typedef std::map<string,string>::iterator ConfigFile::mapi [protected] |
Definition at line 62 of file ConfigFile.h.
ConfigFile::ConfigFile | ( | string | filename, |
string | delimiter = "=" , |
||
string | comment = "#" , |
||
string | sentry = "EndConfigFile" |
||
) |
Definition at line 7 of file ConfigFile.cpp.
Definition at line 21 of file ConfigFile.cpp.
void ConfigFile::add | ( | string | key, |
const T & | value | ||
) |
Definition at line 224 of file ConfigFile.h.
string ConfigFile::getComment | ( | ) | const [inline] |
Definition at line 89 of file ConfigFile.h.
string ConfigFile::getDelimiter | ( | ) | const [inline] |
Definition at line 88 of file ConfigFile.h.
string ConfigFile::getSentry | ( | ) | const [inline] |
Definition at line 90 of file ConfigFile.h.
bool ConfigFile::keyExists | ( | const string & | key | ) | const |
Definition at line 36 of file ConfigFile.cpp.
T ConfigFile::read | ( | const string & | key | ) | const |
Definition at line 174 of file ConfigFile.h.
T ConfigFile::read | ( | const string & | key, |
const T & | value | ||
) | const |
Definition at line 184 of file ConfigFile.h.
bool ConfigFile::readInto | ( | T & | var, |
const string & | key | ||
) | const |
Definition at line 195 of file ConfigFile.h.
bool ConfigFile::readInto | ( | T & | var, |
const string & | key, | ||
const T & | value | ||
) | const |
Definition at line 208 of file ConfigFile.h.
void ConfigFile::remove | ( | const string & | key | ) |
Definition at line 28 of file ConfigFile.cpp.
string ConfigFile::setComment | ( | const string & | s | ) | [inline] |
Definition at line 93 of file ConfigFile.h.
string ConfigFile::setDelimiter | ( | const string & | s | ) | [inline] |
Definition at line 91 of file ConfigFile.h.
bool ConfigFile::string_as_T< bool > | ( | const string & | s | ) | [inline, static, protected] |
Definition at line 133 of file ConfigFile.h.
string ConfigFile::T_as_string | ( | const T & | t | ) | [static, protected] |
Definition at line 121 of file ConfigFile.h.
void ConfigFile::trim | ( | string & | s | ) | [static, protected] |
Definition at line 45 of file ConfigFile.cpp.
std::ostream& operator<< | ( | std::ostream & | os, |
const ConfigFile & | cf | ||
) | [friend] |
Definition at line 54 of file ConfigFile.cpp.
std::istream& operator>> | ( | std::istream & | is, |
ConfigFile & | cf | ||
) | [friend] |
Definition at line 68 of file ConfigFile.cpp.
string ConfigFile::myComment [protected] |
Definition at line 58 of file ConfigFile.h.
std::map<string,string> ConfigFile::myContents [protected] |
Definition at line 60 of file ConfigFile.h.
string ConfigFile::myDelimiter [protected] |
Definition at line 57 of file ConfigFile.h.
string ConfigFile::mySentry [protected] |
Definition at line 59 of file ConfigFile.h.