Hugin trunk 0.1
Loading...
Searching...
No Matches
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.
 
bool HasKey (const std::string &section, const std::string &key) const
 Checks if given section/key exists.
 
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
 
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
 
std::vector< std::string > GetKeys (const std::string &section) const
 returns a vector of all know keys in given section
 
void PrintValues () const
 for debugging purpose, print all values
 

Private Types

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

Private Attributes

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

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

◆ IniValues

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

◆ GetKey() [1/3]

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, threshold(), and hugin_utils::toupper().

◆ GetKey() [2/3]

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, hugin_utils::stringToInt(), and threshold().

◆ GetKey() [3/3]

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, and threshold().

◆ GetKeys()

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, and threshold().

◆ GetSections()

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, and threshold().

◆ HasKey()

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, and threshold().

◆ PrintValues()

void IniParser::PrintValues ( ) const

for debugging purpose, print all values

Definition at line 182 of file IniParser.cpp.

References m_iniValues, and threshold().

◆ Read()

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 m_iniValues, hugin_utils::StrTrim(), and threshold().

Referenced by ReadPanoramaOptionsFromIni().

Member Data Documentation

◆ m_iniValues

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(), GetKey(), GetKey(), GetKeys(), GetSections(), HasKey(), PrintValues(), and Read().


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