IBR-DTNSuite
0.8
|
#include <ConfigFile.h>
Classes | |
struct | file_not_found |
struct | key_not_found |
Public Member Functions | |
ConfigFile (string filename, string delimiter="=", string comment="#", string sentry="EndConfigFile") | |
ConfigFile () | |
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 |
template<class T > | |
void | add (string key, const T &value) |
void | remove (const string &key) |
bool | keyExists (const string &key) const |
string | getDelimiter () const |
string | getComment () const |
string | getSentry () const |
string | setDelimiter (const string &s) |
string | setComment (const string &s) |
Protected Types | |
typedef std::map< string, string >::iterator | mapi |
typedef std::map< string, string >::const_iterator | mapci |
Static Protected Member Functions | |
template<class T > | |
static string | T_as_string (const T &t) |
template<class T > | |
static T | string_as_T (const string &s) |
static void | trim (string &s) |
Protected Attributes | |
string | myDelimiter |
string | myComment |
string | mySentry |
std::map< string, string > | myContents |
Friends | |
std::ostream & | operator<< (std::ostream &os, const ConfigFile &cf) |
std::istream & | operator>> (std::istream &is, ConfigFile &cf) |
Definition at line 56 of file ConfigFile.h.
typedef std::map<string,string>::const_iterator ibrcommon::ConfigFile::mapci [protected] |
Definition at line 65 of file ConfigFile.h.
typedef std::map<string,string>::iterator ibrcommon::ConfigFile::mapi [protected] |
Definition at line 64 of file ConfigFile.h.
ibrcommon::ConfigFile::ConfigFile | ( | string | filename, |
string | delimiter = "=" , |
||
string | comment = "#" , |
||
string | sentry = "EndConfigFile" |
||
) |
Definition at line 8 of file ConfigFile.cpp.
Definition at line 22 of file ConfigFile.cpp.
void ibrcommon::ConfigFile::add | ( | string | key, |
const T & | value | ||
) |
Definition at line 226 of file ConfigFile.h.
References myContents, T_as_string(), and trim().
Referenced by dtn::daemon::Configuration::load().
string ibrcommon::ConfigFile::getComment | ( | ) | const [inline] |
Definition at line 91 of file ConfigFile.h.
References myComment.
string ibrcommon::ConfigFile::getDelimiter | ( | ) | const [inline] |
Definition at line 90 of file ConfigFile.h.
References myDelimiter.
string ibrcommon::ConfigFile::getSentry | ( | ) | const [inline] |
Definition at line 92 of file ConfigFile.h.
References mySentry.
bool ibrcommon::ConfigFile::keyExists | ( | const string & | key | ) | const |
Definition at line 37 of file ConfigFile.cpp.
References myContents.
Referenced by dtn::daemon::Configuration::Statistic::enabled(), and dtn::daemon::Configuration::Network::load().
T ibrcommon::ConfigFile::read | ( | const string & | key | ) | const |
Definition at line 176 of file ConfigFile.h.
References myContents.
Referenced by dtn::daemon::Configuration::Discovery::address(), dtn::daemon::Configuration::Statistic::address(), dtn::daemon::Configuration::Discovery::announce(), dtn::daemon::Configuration::getAPIInterface(), dtn::daemon::Configuration::getAPISocket(), dtn::daemon::Configuration::getGID(), dtn::daemon::Configuration::getLimit(), dtn::daemon::Configuration::getNodename(), dtn::daemon::Configuration::getNotifyCommand(), dtn::daemon::Configuration::getPath(), dtn::daemon::Configuration::getStorage(), dtn::daemon::Configuration::getTimezone(), dtn::daemon::Configuration::getUID(), dtn::daemon::Configuration::getUser(), dtn::daemon::Configuration::Statistic::interval(), dtn::daemon::Configuration::Discovery::load(), dtn::daemon::Configuration::Logger::load(), dtn::daemon::Configuration::Network::load(), dtn::daemon::Configuration::Security::load(), dtn::daemon::Configuration::TimeSync::load(), dtn::daemon::Configuration::DHT::load(), dtn::daemon::Configuration::Statistic::logfile(), dtn::daemon::Configuration::Discovery::port(), dtn::daemon::Configuration::Statistic::port(), dtn::daemon::Configuration::Discovery::shortbeacon(), dtn::daemon::Configuration::Statistic::type(), and dtn::daemon::Configuration::Discovery::version().
T ibrcommon::ConfigFile::read | ( | const string & | key, |
const T & | value | ||
) | const |
Definition at line 186 of file ConfigFile.h.
References myContents.
bool ibrcommon::ConfigFile::readInto | ( | T & | var, |
const string & | key | ||
) | const |
Definition at line 197 of file ConfigFile.h.
References myContents.
bool ibrcommon::ConfigFile::readInto | ( | T & | var, |
const string & | key, | ||
const T & | value | ||
) | const |
Definition at line 210 of file ConfigFile.h.
References myContents.
void ibrcommon::ConfigFile::remove | ( | const string & | key | ) |
Definition at line 29 of file ConfigFile.cpp.
References myContents.
string ibrcommon::ConfigFile::setComment | ( | const string & | s | ) | [inline] |
Definition at line 95 of file ConfigFile.h.
References myComment.
string ibrcommon::ConfigFile::setDelimiter | ( | const string & | s | ) | [inline] |
Definition at line 93 of file ConfigFile.h.
References myDelimiter.
bool ibrcommon::ConfigFile::string_as_T< bool > | ( | const string & | s | ) | [inline, static, protected] |
Definition at line 135 of file ConfigFile.h.
string ibrcommon::ConfigFile::T_as_string | ( | const T & | t | ) | [static, protected] |
Definition at line 123 of file ConfigFile.h.
Referenced by add().
void ibrcommon::ConfigFile::trim | ( | string & | s | ) | [static, protected] |
Definition at line 46 of file ConfigFile.cpp.
Referenced by add(), and ibrcommon::operator>>().
std::ostream& operator<< | ( | std::ostream & | os, |
const ConfigFile & | cf | ||
) | [friend] |
Definition at line 55 of file ConfigFile.cpp.
std::istream& operator>> | ( | std::istream & | is, |
ConfigFile & | cf | ||
) | [friend] |
Definition at line 69 of file ConfigFile.cpp.
string ibrcommon::ConfigFile::myComment [protected] |
Definition at line 60 of file ConfigFile.h.
Referenced by getComment(), ibrcommon::operator>>(), and setComment().
std::map<string,string> ibrcommon::ConfigFile::myContents [protected] |
Definition at line 62 of file ConfigFile.h.
Referenced by add(), keyExists(), ibrcommon::operator<<(), ibrcommon::operator>>(), read(), readInto(), and remove().
string ibrcommon::ConfigFile::myDelimiter [protected] |
Definition at line 59 of file ConfigFile.h.
Referenced by getDelimiter(), ibrcommon::operator<<(), ibrcommon::operator>>(), and setDelimiter().
string ibrcommon::ConfigFile::mySentry [protected] |
Definition at line 61 of file ConfigFile.h.
Referenced by getSentry(), and ibrcommon::operator>>().