Anklang 0.3.0-460-gc4ef46ba
ASE — Anklang Sound Engine (C++)
« « « Anklang Documentation |
Class to parse INI configuration file sections and values. More...
#include "inifile.hh"
Public Member Functions | |
IniFile (const String &name, const String &inidata) | |
Load INI file from immediate data . | |
IniFile (Blob blob) | |
Load INI file from Blob. | |
IniFile (const IniFile &source) | |
Copy constructor. | |
IniFile & | operator= (const IniFile &source) |
Assignment operator. | |
bool | has_sections () const |
Checks if IniFile is non-empty. | |
StringS | sections () const |
List all sections. | |
bool | has_section (const String §ion) const |
Check presence of a section. | |
StringS | attributes (const String §ion) const |
List all attributes available in section . | |
bool | has_attribute (const String §ion, const String &key) const |
Return if section contains key . | |
bool | has_raw_value (const String &dotpath, String *valuep=NULL) const |
Check and possibly retrieve raw value if present. | |
String | raw_value (const String &dotpath) const |
Retrieve raw (uncooked) value of section.attribute[locale]. | |
StringS | raw_values () const |
List all section.attribute=value pairs. | |
String | value_as_string (const String &dotpath) const |
Retrieve value of section.attribute[locale]. | |
bool | has_value (const String &dotpath, String *valuep=NULL) const |
Check and possibly retrieve value if present. | |
Static Public Member Functions | |
static String | cook_string (const String &input_string) |
Unquote contents of input_string | |
Class to parse INI configuration file sections and values.
This class parses configuration files, commonly known as INI files. The files contain "[Section]" markers and "attribute=value" definitions. Comment lines are preceeded by a hash "#" sign. For a detailed reference, see: http://wikipedia.org/wiki/INI_file
To write INI files, refer to the IniWriter class. Localization of attributes is supported with the "attribute[locale]=value" syntax, in accordance with the desktop file spec: http://freedesktop.org/Standards/desktop-entry-spec
Example:
Definition at line 11 of file inifile.hh.
Load INI file from immediate data
.
Definition at line 321 of file inifile.cc.
References std::map::empty(), and Ase::string_to_cquote().
|
explicit |
Load INI file from Blob.
Definition at line 328 of file inifile.cc.
References std::map::empty(), Ase::Blob::name(), Ase::Blob::string(), and Ase::string_to_cquote().
|
explicit |
Copy constructor.
Definition at line 336 of file inifile.cc.
List all attributes available in section
.
Definition at line 381 of file inifile.cc.
References std::map::end(), std::map::find(), and std::vector::push_back().
Unquote contents of input_string
Definition at line 444 of file inifile.cc.
References std::string::c_str(), and Ase::string_from_cquote().
Referenced by has_value(), and value_as_string().
Return if section
contains key
.
Definition at line 392 of file inifile.cc.
References std::string::data(), std::map::end(), std::map::find(), memcmp(), and std::string::size().
Check and possibly retrieve raw value if present.
Definition at line 414 of file inifile.cc.
References std::string::c_str(), memcmp(), std::string::size(), std::vector::size(), strrchr(), and std::string::substr().
Referenced by has_value(), and raw_value().
Check presence of a section.
Definition at line 365 of file inifile.cc.
References std::map::end(), and std::map::find().
bool Ase::IniFile::has_sections | ( | ) | const |
Checks if IniFile is non-empty.
Definition at line 349 of file inifile.cc.
References std::map::empty().
Check and possibly retrieve value if present.
Definition at line 483 of file inifile.cc.
References cook_string(), and has_raw_value().
Assignment operator.
Definition at line 342 of file inifile.cc.
Retrieve raw (uncooked) value of section.attribute[locale].
Definition at line 436 of file inifile.cc.
References has_raw_value().
Referenced by value_as_string().
StringS Ase::IniFile::raw_values | ( | ) | const |
List all section.attribute=value pairs.
Definition at line 404 of file inifile.cc.
References std::vector::push_back().
StringS Ase::IniFile::sections | ( | ) | const |
Retrieve value of section.attribute[locale].
Definition at line 492 of file inifile.cc.
References cook_string(), and raw_value().