Exiv2
Loading...
Searching...
No Matches
Public Member Functions | List of all members
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.
 
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").
 
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().
 
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).
 

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()

string 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

Referenced by GetBoolean(), GetInteger(), GetReal(), and Exiv2::Internal::readExiv2Config().

◆ GetBoolean()

bool 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

References Get().

◆ GetInteger()

long 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

References Get().

◆ GetReal()

double 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

References Get().


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