Anklang-0.3.0.dev956+gd75ac925 anklang-0.3.0.dev956+gd75ac925
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#pragma once
3
4#include <ase/blob.hh>
5
6namespace Ase {
7
8// == IniFile ==
10class IniFile {
12 SectionMap sections_;
13 void load_ini (const String &inputname, const String &data);
14 //bool set (const String &section, const String &key, const String &value, const String &locale = "");
15 //bool del (const String &section, const String &key, const String &locale = "*");
16 //bool value (const String &dotpath, const String &value);
17 const StringS& section (const String &name) const;
18public:
19 explicit IniFile (const String &name, const String &inidata);
20 explicit IniFile (Blob blob);
21 explicit IniFile (const IniFile &source);
22 IniFile& operator= (const IniFile &source);
23 //String get (const String &section, const String &key, const String &locale = "") const;
24 bool has_sections () const;
25 StringS sections () const;
26 bool has_section (const String &section) const;
27 StringS attributes (const String &section) const;
28 bool has_attribute (const String &section, const String &key) const;
29 bool has_raw_value (const String &dotpath,
30 String *valuep = NULL) const;
31 String raw_value (const String &dotpath) const;
32 StringS raw_values () const;
33 String value_as_string (const String &dotpath) const;
34 bool has_value (const String &dotpath,
35 String *valuep = NULL) const;
36 static String cook_string (const String &input_string);
37};
38
39
40// == IniWriter ==
42class IniWriter {
43 struct Section {
44 String name;
45 StringS entries;
46 };
47 std::vector<Section> sections_;
48 Section* find_section (String name, bool create);
49 size_t find_entry (Section &section, String name, bool create);
50public:
51 void set (String key, String value);
52 String output ();
53};
54
55} // Ase
56
Binary large object storage container.
Definition blob.hh:11
Class to parse INI configuration file sections and values.
Definition inifile.hh:10
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:42
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:8