Anklang 0.3.0-460-gc4ef46ba
ASE — Anklang Sound Engine (C++)

« « « Anklang Documentation
Loading...
Searching...
No Matches
inifile.hh
Go to the documentation of this file.
1 // This Source Code Form is licensed MPL-2.0: http://mozilla.org/MPL/2.0
2#ifndef __ASE_INIFILE_HH__
3#define __ASE_INIFILE_HH__
4
5#include <ase/blob.hh>
6
7namespace Ase {
8
9// == IniFile ==
11class IniFile {
13 SectionMap sections_;
14 void load_ini (const String &inputname, const String &data);
15 //bool set (const String &section, const String &key, const String &value, const String &locale = "");
16 //bool del (const String &section, const String &key, const String &locale = "*");
17 //bool value (const String &dotpath, const String &value);
18 const StringS& section (const String &name) const;
19public:
20 explicit IniFile (const String &name, const String &inidata);
21 explicit IniFile (Blob blob);
22 explicit IniFile (const IniFile &source);
23 IniFile& operator= (const IniFile &source);
24 //String get (const String &section, const String &key, const String &locale = "") const;
25 bool has_sections () const;
26 StringS sections () const;
27 bool has_section (const String &section) const;
28 StringS attributes (const String &section) const;
29 bool has_attribute (const String &section, const String &key) const;
30 bool has_raw_value (const String &dotpath,
31 String *valuep = NULL) const;
32 String raw_value (const String &dotpath) const;
33 StringS raw_values () const;
34 String value_as_string (const String &dotpath) const;
35 bool has_value (const String &dotpath,
36 String *valuep = NULL) const;
37 static String cook_string (const String &input_string);
38};
39
40
41// == IniWriter ==
43class IniWriter {
44 struct Section {
45 String name;
46 StringS entries;
47 };
48 std::vector<Section> sections_;
49 Section* find_section (String name, bool create);
50 size_t find_entry (Section &section, String name, bool create);
51public:
52 void set (String key, String value);
53 String output ();
54};
55
56} // Ase
57
58#endif // __ASE_INIFILE_HH__
Binary large object storage container.
Definition blob.hh:12
Class to parse INI configuration file sections and values.
Definition inifile.hh:11
bool has_value(const String &dotpath, String *valuep=NULL) const
Check and possibly retrieve value if present.
Definition inifile.cc:483
bool has_raw_value(const String &dotpath, String *valuep=NULL) const
Check and possibly retrieve raw value if present.
Definition inifile.cc:414
StringS attributes(const String &section) const
List all attributes available in section.
Definition inifile.cc:381
bool has_attribute(const String &section, const String &key) const
Return if section contains key.
Definition inifile.cc:392
IniFile & operator=(const IniFile &source)
Assignment operator.
Definition inifile.cc:342
bool has_sections() const
Checks if IniFile is non-empty.
Definition inifile.cc:349
bool has_section(const String &section) const
Check presence of a section.
Definition inifile.cc:365
static String cook_string(const String &input_string)
Unquote contents of input_string
Definition inifile.cc:444
StringS sections() const
List all sections.
Definition inifile.cc:372
String raw_value(const String &dotpath) const
Retrieve raw (uncooked) value of section.attribute[locale].
Definition inifile.cc:436
StringS raw_values() const
List all section.attribute=value pairs.
Definition inifile.cc:404
String value_as_string(const String &dotpath) const
Retrieve value of section.attribute[locale].
Definition inifile.cc:492
Class to write INI configuration file sections and values.
Definition inifile.hh:43
void set(String key, String value)
Set (or add) a value with INI file semantics: section.key = value.
Definition inifile.cc:541
String output()
Generate INI file syntax for all values store in the class.
Definition inifile.cc:557
The Anklang C++ API namespace.
Definition api.hh:9