Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Types | Private Attributes | List of all members
IniParser Class Reference

A simple parser for ini files, it implements only some basic features. More...

#include <IniParser.h>

Public Member Functions

int Read (const std::string &file)
 Reads the given ini file. More...
 
bool HasKey (const std::string &section, const std::string &key) const
 Checks if given section/key exists. More...
 
std::string GetKey (const std::string &section, const std::string &key, const std::string &defaultValue) const
 returns the value of the given section/key or default value if it does not exists More...
 
int GetKey (const std::string &section, const std::string &key, const int defaultValue) const
 
bool GetKey (const std::string &section, const std::string &key, const bool defaultValue) const
 
std::vector< std::string > GetSections () const
 returns a vector of all know sections More...
 
std::vector< std::string > GetKeys (const std::string &section) const
 returns a vector of all know keys in given section More...
 
void PrintValues () const
 for debugging purpose, print all values More...
 

Private Types

typedef std::map< std::string,
std::string > 
IniValues
 stores the key/values pairs for each section More...
 

Private Attributes

std::map< std::string, IniValuesm_iniValues
 map to store the information from different sections More...
 

Detailed Description

A simple parser for ini files, it implements only some basic features.

Definition at line 37 of file IniParser.h.

Member Typedef Documentation

typedef std::map<std::string, std::string> IniParser::IniValues
private

stores the key/values pairs for each section

Definition at line 61 of file IniParser.h.

Member Function Documentation

std::string IniParser::GetKey ( const std::string &  section,
const std::string &  key,
const std::string &  defaultValue 
) const

returns the value of the given section/key or default value if it does not exists

Definition at line 100 of file IniParser.cpp.

References m_iniValues.

Referenced by ProcessSection().

int IniParser::GetKey ( const std::string &  section,
const std::string &  key,
const int  defaultValue 
) const

Definition at line 113 of file IniParser.cpp.

References m_iniValues, and hugin_utils::stringToInt().

bool IniParser::GetKey ( const std::string &  section,
const std::string &  key,
const bool  defaultValue 
) const

Definition at line 131 of file IniParser.cpp.

References m_iniValues, and hugin_utils::toupper().

std::vector< std::string > IniParser::GetKeys ( const std::string &  section) const

returns a vector of all know keys in given section

Definition at line 168 of file IniParser.cpp.

References m_iniValues.

Referenced by ProcessSection().

std::vector< std::string > IniParser::GetSections ( ) const

returns a vector of all know sections

Definition at line 157 of file IniParser.cpp.

References m_iniValues.

Referenced by ReadPanoramaOptionsFromIni().

bool IniParser::HasKey ( const std::string &  section,
const std::string &  key 
) const

Checks if given section/key exists.

Definition at line 87 of file IniParser.cpp.

References m_iniValues.

Referenced by ProcessSection().

void IniParser::PrintValues ( ) const

for debugging purpose, print all values

Definition at line 182 of file IniParser.cpp.

References m_iniValues.

int IniParser::Read ( const std::string &  file)

Reads the given ini file.

Append the result to existings values return 0 if succesful

Definition at line 34 of file IniParser.cpp.

References celeste::line, m_iniValues, and hugin_utils::StrTrim().

Referenced by ReadPanoramaOptionsFromIni().

Member Data Documentation

std::map<std::string, IniValues> IniParser::m_iniValues
private

map to store the information from different sections

Definition at line 63 of file IniParser.h.

Referenced by GetKey(), GetKeys(), GetSections(), HasKey(), PrintValues(), and Read().


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