Exiv2::INIReader Class Reference

Read an INI file into easy-to-access name/value pairs. (Note that I've gone for simplicity here rather than speed, but it should be pretty decent.) More...

#include <ini.hpp>

Public Member Functions

 INIReader (const std::string &filename)
 Construct INIReader and parse given filename. See ini.h for more info about the parsing.
 
int ParseError ()
 Return the result of ini_parse(), i.e., 0 on success, line number of first error on parse error, or -1 on file open error.
 
std::string Get (std::string section, std::string name, std::string default_value)
 Get a string value from INI file, returning default_value if not found. More...
 
long GetInteger (std::string section, std::string name, long default_value)
 Get an integer (long) value from INI file, returning default_value if not found or not a valid integer (decimal "1234", "-1234", or hex "0x4d2"). More...
 
double GetReal (std::string section, std::string name, double default_value)
 Get a real (floating point double) value from INI file, returning default_value if not found or not a valid floating point value according to strtod(). More...
 
bool GetBoolean (std::string section, std::string name, bool default_value)
 Get a boolean value from INI file, returning default_value if not found or if not a valid true/false value. Valid true values are "true", "yes", "on", "1", and valid false values are "false", "no", "off", "0" (not case sensitive). More...
 

Detailed Description

Read an INI file into easy-to-access name/value pairs. (Note that I've gone for simplicity here rather than speed, but it should be pretty decent.)

Member Function Documentation

◆ Get()

std::string Exiv2::INIReader::Get ( std::string  section,
std::string  name,
std::string  default_value 
)

Get a string value from INI file, returning default_value if not found.

Parameters
sectionname of section
namename of key
default_valuedefault if not found
Returns
value

◆ GetBoolean()

bool Exiv2::INIReader::GetBoolean ( std::string  section,
std::string  name,
bool  default_value 
)

Get a boolean value from INI file, returning default_value if not found or if not a valid true/false value. Valid true values are "true", "yes", "on", "1", and valid false values are "false", "no", "off", "0" (not case sensitive).

Parameters
sectionname of section
namename of key
default_valuedefault if not found
Returns
value

◆ GetInteger()

long Exiv2::INIReader::GetInteger ( std::string  section,
std::string  name,
long  default_value 
)

Get an integer (long) value from INI file, returning default_value if not found or not a valid integer (decimal "1234", "-1234", or hex "0x4d2").

Parameters
sectionname of section
namename of key
default_valuedefault if not found
Returns
value

◆ GetReal()

double Exiv2::INIReader::GetReal ( std::string  section,
std::string  name,
double  default_value 
)

Get a real (floating point double) value from INI file, returning default_value if not found or not a valid floating point value according to strtod().

Parameters
sectionname of section
namename of key
default_valuedefault if not found
Returns
value

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