liblcf
|
#include <inireader.h>
Public Member Functions | |
INIReader (std::string filename) | |
int | ParseError () const |
std::string | Get (std::string section, std::string name, std::string default_value) |
long | GetInteger (std::string section, std::string name, long default_value) |
Static Private Member Functions | |
static std::string | MakeKey (std::string section, std::string name) |
static int | ValueHandler (void *user, const char *section, const char *name, const char *value) |
Private Attributes | |
int | _error |
std::map< std::string, std::string > | _values |
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.)
Definition at line 45 of file inireader.h.
INIReader::INIReader | ( | std::string | filename | ) |
Construct INIReader and parse given filename. See ini.h for more info about the parsing.
Definition at line 42 of file inireader.cpp.
References _error, ini_parse(), and ValueHandler().
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.
Definition at line 52 of file inireader.cpp.
References _values, and MakeKey().
Referenced by ReaderUtil::GetEncoding(), and 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.
Definition at line 58 of file inireader.cpp.
References Get().
|
staticprivate |
Definition at line 68 of file inireader.cpp.
Referenced by Get(), and ValueHandler().
int INIReader::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.
Definition at line 47 of file inireader.cpp.
References _error.
Referenced by ReaderUtil::GetEncoding().
|
staticprivate |
Definition at line 77 of file inireader.cpp.
References _values, and MakeKey().
Referenced by INIReader().
|
private |
Definition at line 73 of file inireader.h.
Referenced by INIReader(), and ParseError().
|
private |
Definition at line 74 of file inireader.h.
Referenced by Get(), and ValueHandler().