Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
youbot::ConfigFile Class Reference

Reads and writes a configuration file. More...

#include <ConfigFile.hpp>

Public Member Functions

template<class T >
void add (string key, const T &value)
 
template<class T >
void add (string sectionKey, string key, const T &value)
 
 ConfigFile (string filename, string filepath="../config/", string delimiter="=", string comment="#", string sectionStartTag="[", string sectionEndTag="]", string sentry="EndConfigFile")
 
 ConfigFile ()
 
string getComment () const
 
string getDelimiter () const
 
string getSentry () const
 
bool keyExists (const string &key) const
 
bool keyExists (const string &sectionKey, const string &key)
 
template<class T >
read (const string &key, const T &value) const
 
template<class T >
read (const string &key) const
 
template<class T >
read (const string &sectionKey, const string &key)
 
template<class T >
bool readInto (T &var, const string &key) const
 
template<class T >
bool readInto (T &var, const string &sectionKey, const string &key)
 
template<class T >
bool readInto (T &var, const string &key, const T &value) const
 
void remove (const string &key)
 
void remove (const string &sectionKey, const string &key)
 
void save ()
 
bool sectionExists (const string &sectionKey)
 
string setComment (const string &s)
 
string setDelimiter (const string &s)
 
 ~ConfigFile ()
 

Protected Types

typedef std::map< string, string >::const_iterator mapci
 
typedef std::map< string, map< string, string > >::const_iterator mapciSect
 
typedef std::map< string, string >::iterator mapi
 

Protected Member Functions

template<>
string string_as_T (const string &s)
 
template<>
bool string_as_T (const string &s)
 

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 myFilepath
 
string mySectionEndTag
 
std::map< string, std::map< string, string > > mySectionRelatedContents
 
string mySectionStartTag
 
string mySentry
 
std::vector< SortTreeVectormySortVector
 
SortTreeVectormySortVectorObj
 

Friends

std::ostream & operator<< (std::ostream &os, ConfigFile &cf)
 
std::istream & operator>> (std::istream &is, ConfigFile &cf)
 

Detailed Description

Reads and writes a configuration file.

Definition at line 125 of file ConfigFile.hpp.

Member Typedef Documentation

typedef std::map<string, string>::const_iterator youbot::ConfigFile::mapci
protected

Definition at line 142 of file ConfigFile.hpp.

typedef std::map<string, map<string, string> >::const_iterator youbot::ConfigFile::mapciSect
protected

Definition at line 143 of file ConfigFile.hpp.

typedef std::map<string, string>::iterator youbot::ConfigFile::mapi
protected

Definition at line 141 of file ConfigFile.hpp.

Constructor & Destructor Documentation

youbot::ConfigFile::ConfigFile ( string  filename,
string  filepath = "../config/",
string  delimiter = "=",
string  comment = "#",
string  sectionStartTag = "[",
string  sectionEndTag = "]",
string  sentry = "EndConfigFile" 
)

Definition at line 9 of file ConfigFile.cpp.

youbot::ConfigFile::ConfigFile ( )

Definition at line 34 of file ConfigFile.cpp.

youbot::ConfigFile::~ConfigFile ( )
inline

Definition at line 157 of file ConfigFile.hpp.

Member Function Documentation

template<class T >
void youbot::ConfigFile::add ( string  key,
const T &  value 
)

Definition at line 355 of file ConfigFile.hpp.

template<class T >
void youbot::ConfigFile::add ( string  sectionKey,
string  key,
const T &  value 
)

Definition at line 370 of file ConfigFile.hpp.

string youbot::ConfigFile::getComment ( ) const
inline

Definition at line 211 of file ConfigFile.hpp.

string youbot::ConfigFile::getDelimiter ( ) const
inline

Definition at line 207 of file ConfigFile.hpp.

string youbot::ConfigFile::getSentry ( ) const
inline

Definition at line 215 of file ConfigFile.hpp.

bool youbot::ConfigFile::keyExists ( const string &  key) const

Definition at line 70 of file ConfigFile.cpp.

bool youbot::ConfigFile::keyExists ( const string &  sectionKey,
const string &  key 
)

Definition at line 76 of file ConfigFile.cpp.

template<class T >
T youbot::ConfigFile::read ( const string &  key,
const T &  value 
) const

Definition at line 308 of file ConfigFile.hpp.

template<class T >
T youbot::ConfigFile::read ( const string &  key) const

Definition at line 289 of file ConfigFile.hpp.

template<class T >
T youbot::ConfigFile::read ( const string &  sectionKey,
const string &  key 
)

Definition at line 296 of file ConfigFile.hpp.

template<class T >
bool youbot::ConfigFile::readInto ( T &  var,
const string &  key 
) const

Definition at line 317 of file ConfigFile.hpp.

template<class T >
bool youbot::ConfigFile::readInto ( T &  var,
const string &  sectionKey,
const string &  key 
)

Definition at line 333 of file ConfigFile.hpp.

template<class T >
bool youbot::ConfigFile::readInto ( T &  var,
const string &  key,
const T &  value 
) const
void youbot::ConfigFile::remove ( const string &  key)

Definition at line 39 of file ConfigFile.cpp.

void youbot::ConfigFile::remove ( const string &  sectionKey,
const string &  key 
)

Definition at line 45 of file ConfigFile.cpp.

void youbot::ConfigFile::save ( )

Definition at line 62 of file ConfigFile.cpp.

bool youbot::ConfigFile::sectionExists ( const string &  sectionKey)

Definition at line 87 of file ConfigFile.cpp.

string youbot::ConfigFile::setComment ( const string &  s)
inline

Definition at line 225 of file ConfigFile.hpp.

string youbot::ConfigFile::setDelimiter ( const string &  s)
inline

Definition at line 219 of file ConfigFile.hpp.

template<class T >
T youbot::ConfigFile::string_as_T ( const string &  s)
staticprotected

Definition at line 254 of file ConfigFile.hpp.

template<>
string youbot::ConfigFile::string_as_T ( const string &  s)
inlineprotected

Definition at line 265 of file ConfigFile.hpp.

template<>
bool youbot::ConfigFile::string_as_T ( const string &  s)
inlineprotected

Definition at line 273 of file ConfigFile.hpp.

template<class T >
string youbot::ConfigFile::T_as_string ( const T &  t)
staticprotected

Definition at line 244 of file ConfigFile.hpp.

void youbot::ConfigFile::trim ( string &  s)
staticprotected

Definition at line 97 of file ConfigFile.cpp.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
ConfigFile cf 
)
friend

Definition at line 104 of file ConfigFile.cpp.

std::istream& operator>> ( std::istream &  is,
ConfigFile cf 
)
friend

Definition at line 138 of file ConfigFile.cpp.

Member Data Documentation

string youbot::ConfigFile::myComment
protected

Definition at line 129 of file ConfigFile.hpp.

std::map<string, string> youbot::ConfigFile::myContents
protected

Definition at line 136 of file ConfigFile.hpp.

string youbot::ConfigFile::myDelimiter
protected

Definition at line 128 of file ConfigFile.hpp.

string youbot::ConfigFile::myFilepath
protected

Definition at line 133 of file ConfigFile.hpp.

string youbot::ConfigFile::mySectionEndTag
protected

Definition at line 131 of file ConfigFile.hpp.

std::map<string, std::map<string, string> > youbot::ConfigFile::mySectionRelatedContents
protected

Definition at line 137 of file ConfigFile.hpp.

string youbot::ConfigFile::mySectionStartTag
protected

Definition at line 130 of file ConfigFile.hpp.

string youbot::ConfigFile::mySentry
protected

Definition at line 132 of file ConfigFile.hpp.

std::vector<SortTreeVector> youbot::ConfigFile::mySortVector
protected

Definition at line 139 of file ConfigFile.hpp.

SortTreeVector* youbot::ConfigFile::mySortVectorObj
protected

Definition at line 134 of file ConfigFile.hpp.


The documentation for this class was generated from the following files:


youbot_driver
Author(s): Jan Paulus
autogenerated on Mon Jun 10 2019 15:46:27