clockUtils  1.1
clockUtils::iniParser::IniParser Class Reference

this class is used for parsing configuration files More...

#include <iniParser.h>

Public Member Functions

 IniParser ()
 constructor More...
 
ClockError load (const std::string &file)
 loads given ini file More...
 
ClockError save (const std::string &file)
 saves to given ini file More...
 
template<typename T >
std::enable_if<!std::is_enum< T >::value, ClockError >::type getValue (const std::string &section, const std::string &field, T &value) const
 fetches value from parsed ini file More...
 
template<typename T >
std::enable_if< std::is_enum< T >::value, ClockError >::type getValue (const std::string &section, const std::string &field, T &value) const
 
template<typename T >
std::enable_if<!std::is_enum< T >::value, void >::type setValue (const std::string &section, const std::string &field, const T &value)
 sets value for a variable More...
 
template<typename T >
std::enable_if< std::is_enum< T >::value, void >::type setValue (const std::string &section, const std::string &field, const T &value)
 
void setValue (const std::string &section, const std::string &field, const std::string &value)
 
std::vector< std::string > getAllSections () const
 returns all sections that can be found in this config file More...
 
std::vector< std::string > getAllEntries (const std::string &section) const
 returns all entries of the given section More...
 
void removeEntry (const std::string &section, const std::string &entry)
 removes the given entry from the section if this was the last entry for this section, also the section is removed More...
 

Detailed Description

this class is used for parsing configuration files

Definition at line 44 of file iniParser.h.

Constructor & Destructor Documentation

§ IniParser()

clockUtils::iniParser::IniParser::IniParser ( )

constructor

Member Function Documentation

§ getAllEntries()

std::vector<std::string> clockUtils::iniParser::IniParser::getAllEntries ( const std::string &  section) const

returns all entries of the given section

§ getAllSections()

std::vector<std::string> clockUtils::iniParser::IniParser::getAllSections ( ) const

returns all sections that can be found in this config file

§ getValue() [1/2]

template<typename T >
std::enable_if<!std::is_enum<T>::value, ClockError>::type clockUtils::iniParser::IniParser::getValue ( const std::string &  section,
const std::string &  field,
T &  value 
) const
inline

fetches value from parsed ini file

Parameters
[in]sectionthe section of the variable
[in]fieldthe name of the variable
[out]valuethe variable the value should be stored in
Returns
ClockError::SUCCESS if value found, otherwise an error code. If the section or field was not found, value stays unchanged. Otherwise the streamoperator will be called

Definition at line 72 of file iniParser.h.

§ getValue() [2/2]

template<typename T >
std::enable_if<std::is_enum<T>::value, ClockError>::type clockUtils::iniParser::IniParser::getValue ( const std::string &  section,
const std::string &  field,
T &  value 
) const
inline

Definition at line 91 of file iniParser.h.

§ load()

ClockError clockUtils::iniParser::IniParser::load ( const std::string &  file)

loads given ini file

Returns
ClockError::SUCCESS if no problems occured, otherwise an error code

§ removeEntry()

void clockUtils::iniParser::IniParser::removeEntry ( const std::string &  section,
const std::string &  entry 
)

removes the given entry from the section if this was the last entry for this section, also the section is removed

§ save()

ClockError clockUtils::iniParser::IniParser::save ( const std::string &  file)

saves to given ini file

Returns
ClockError::SUCCESS if no problems occured, otherwise an error code

§ setValue() [1/3]

template<typename T >
std::enable_if<!std::is_enum<T>::value, void>::type clockUtils::iniParser::IniParser::setValue ( const std::string &  section,
const std::string &  field,
const T &  value 
)
inline

sets value for a variable

Parameters
[in]sectionthe section of the variable
[in]fieldthe name of the variable
[in]valuethe value to be stored

Definition at line 118 of file iniParser.h.

§ setValue() [2/3]

template<typename T >
std::enable_if<std::is_enum<T>::value, void>::type clockUtils::iniParser::IniParser::setValue ( const std::string &  section,
const std::string &  field,
const T &  value 
)
inline

Definition at line 125 of file iniParser.h.

§ setValue() [3/3]

void clockUtils::iniParser::IniParser::setValue ( const std::string &  section,
const std::string &  field,
const std::string &  value 
)
inline

Definition at line 131 of file iniParser.h.


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