Exiv2
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 () const
 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 (const std::string &section, const std::string &name, const std::string &default_value)
 Get a string value from INI file, returning default_value if not found. More...
 
long GetInteger (const std::string &section, const 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 (const std::string &section, const 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 (const std::string &section, const 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()

string INIReader::Get ( const std::string &  section,
const std::string &  name,
const 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 ( const std::string &  section,
const 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 ( const std::string &  section,
const 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 ( const std::string &  section,
const 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: