wsdlpull svntrunk
Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Types | Static Protected Member Functions | Protected Attributes | Friends | List of all members
ConfigFile Class Reference

#include <ConfigFile.h>

Classes

struct  file_not_found
 
struct  key_not_found
 

Public Member Functions

 ConfigFile (string filename, bool isList=false, string delimiter="=", string comment="##", string sentry="EndConfigFile")
 
 ConfigFile ()
 
template<class T >
read (const string &key) const
 
template<class 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, bool store=false)
 
template<class T >
void add (const T &key, bool store=false)
 
void remove (const string &key)
 
template<class T >
void remove (const T &key)
 
bool keyExists (const string &key) const
 
template<class T >
bool keyExists (const T &key) const
 
string getDelimiter () const
 
string getComment () const
 
string getSentry () const
 
string setDelimiter (const string &s)
 
string setComment (const string &s)
 
void load (string filename, bool isList=false)
 
void save ()
 

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)
 
template<>
string string_as_T (const string &s)
 
template<>
bool string_as_T (const string &s)
 

Protected Attributes

string myDelimiter
 
string myComment
 
string mySentry
 
std::map< string, string > myContents
 
std::string file
 
bool listmode
 

Friends

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

Detailed Description

Definition at line 54 of file ConfigFile.h.

Member Typedef Documentation

◆ mapi

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

Definition at line 62 of file ConfigFile.h.

◆ mapci

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

Definition at line 63 of file ConfigFile.h.

Constructor & Destructor Documentation

◆ ConfigFile() [1/2]

ConfigFile::ConfigFile ( string  filename,
bool  isList = false,
string  delimiter = "=",
string  comment = "##",
string  sentry = "EndConfigFile" 
)

Definition at line 7 of file ConfigFile.cpp.

◆ ConfigFile() [2/2]

ConfigFile::ConfigFile ( )

Definition at line 21 of file ConfigFile.cpp.

Member Function Documentation

◆ read() [1/2]

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

Definition at line 184 of file ConfigFile.h.

References myContents.

◆ read() [2/2]

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

Definition at line 194 of file ConfigFile.h.

References myContents.

◆ readInto() [1/2]

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

Definition at line 205 of file ConfigFile.h.

References myContents.

◆ readInto() [2/2]

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

Definition at line 218 of file ConfigFile.h.

References myContents.

◆ add() [1/2]

template<class T >
void ConfigFile::add ( string  key,
const T &  value,
bool  store = false 
)

Definition at line 234 of file ConfigFile.h.

References file, myContents, myDelimiter, T_as_string(), and trim().

◆ add() [2/2]

template<class T >
void ConfigFile::add ( const T &  key,
bool  store = false 
)

Definition at line 253 of file ConfigFile.h.

References file, keyExists(), myContents, T_as_string(), and trim().

◆ remove() [1/2]

void ConfigFile::remove ( const string &  key)

Definition at line 47 of file ConfigFile.cpp.

References myContents.

◆ remove() [2/2]

template<class T >
void ConfigFile::remove ( const T &  key)

Definition at line 270 of file ConfigFile.h.

References keyExists(), myContents, save(), T_as_string(), and trim().

◆ keyExists() [1/2]

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

Definition at line 55 of file ConfigFile.cpp.

References myContents.

Referenced by add(), and remove().

◆ keyExists() [2/2]

template<class T >
bool ConfigFile::keyExists ( const T &  key) const

Definition at line 281 of file ConfigFile.h.

References myContents, and T_as_string().

◆ getDelimiter()

string ConfigFile::getDelimiter ( ) const
inline

Definition at line 95 of file ConfigFile.h.

References myDelimiter.

◆ getComment()

string ConfigFile::getComment ( ) const
inline

Definition at line 96 of file ConfigFile.h.

References myComment.

◆ getSentry()

string ConfigFile::getSentry ( ) const
inline

Definition at line 97 of file ConfigFile.h.

References mySentry.

◆ setDelimiter()

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

Definition at line 98 of file ConfigFile.h.

References myDelimiter.

◆ setComment()

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

Definition at line 100 of file ConfigFile.h.

References myComment.

◆ load()

void ConfigFile::load ( string  filename,
bool  isList = false 
)

Definition at line 28 of file ConfigFile.cpp.

References file, and listmode.

◆ save()

void ConfigFile::save ( )

Definition at line 39 of file ConfigFile.cpp.

References file.

Referenced by remove().

◆ T_as_string()

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

Definition at line 131 of file ConfigFile.h.

Referenced by add(), add(), keyExists(), and remove().

◆ string_as_T() [1/3]

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

Definition at line 143 of file ConfigFile.h.

◆ trim()

void ConfigFile::trim ( string &  s)
staticprotected

Definition at line 64 of file ConfigFile.cpp.

Referenced by add(), add(), and remove().

◆ string_as_T() [2/3]

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

Definition at line 156 of file ConfigFile.h.

◆ string_as_T() [3/3]

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

Definition at line 166 of file ConfigFile.h.

Friends And Related Symbol Documentation

◆ operator<<

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

Definition at line 73 of file ConfigFile.cpp.

◆ operator>>

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

Definition at line 92 of file ConfigFile.cpp.

Member Data Documentation

◆ myDelimiter

string ConfigFile::myDelimiter
protected

Definition at line 57 of file ConfigFile.h.

Referenced by add(), getDelimiter(), and setDelimiter().

◆ myComment

string ConfigFile::myComment
protected

Definition at line 58 of file ConfigFile.h.

Referenced by getComment(), and setComment().

◆ mySentry

string ConfigFile::mySentry
protected

Definition at line 59 of file ConfigFile.h.

Referenced by getSentry().

◆ myContents

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

Definition at line 60 of file ConfigFile.h.

Referenced by add(), add(), keyExists(), keyExists(), read(), read(), readInto(), readInto(), remove(), and remove().

◆ file

std::string ConfigFile::file
protected

Definition at line 64 of file ConfigFile.h.

Referenced by add(), add(), load(), and save().

◆ listmode

bool ConfigFile::listmode
protected

Definition at line 65 of file ConfigFile.h.

Referenced by load().


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