27 return not filename_.empty();
32 return not firstSection;
35inline IniFile::Section::Section(
const AnyString& name):
41IniFile::Property::Property(
const AnyString& key,
const U& value):
65 lastProperty->next = p;
74 if (value.has_value())
76 return add(key, value.value());
81template<
class U,
class StringT>
84 auto*
property =
find(key);
85 return (property ? property->value.template to<U>() : defValue);
98template<
class CallbackT>
101 for (
auto* section = firstSection; section; section = section->
next)
107template<
class CallbackT>
110 for (
auto* section = firstSection; section; section = section->
next)
116template<
class CallbackT>
119 for (
auto* property = firstProperty; property;
property =
property->next)
125template<
class CallbackT>
128 for (
auto* property = firstProperty; property;
property =
property->next)
134template<
class CallbackT>
137 for (
auto* section = firstSection; section; section = section->
next)
139 for (
auto* property = section->firstProperty; property; property = property->next)
146template<
class CallbackT>
149 for (
auto* section = firstSection; section; section = section->
next)
151 for (
auto* property = section->firstProperty; property; property = property->next)
A single entry in an INI file.
Definition inifile.h:43
A single section, with all its keys.
Definition inifile.h:67
Property * add(const AnyString &key, const U &value)
Add a new property.
IniFile::Property * firstProperty
The first property of the section.
Definition inifile.h:154
void each(const CallbackT &callback)
Iterate through all properties.
Definition inifile.hxx:117
Section * next
The next section.
Definition inifile.h:158
U read(const StringT &key, const U &defValue) const
Try to read a property.
Definition inifile.hxx:82
bool empty() const
Get if the section is empty.
Definition inifile.hxx:50
bool empty() const
Get if the inifile is empty.
Definition inifile.hxx:30
void each(const CallbackT &callback)
Iterate through all sections.
Definition inifile.hxx:99
Section * addSection(const AnyString &name)
Create a new section.
Definition inifile.hxx:88
Section * add(Section *s)
Add an existing section into the INI structure.
Definition inifile.cpp:109
const std::string & filename() const
Get the last filename saved or loaded.
Definition inifile.hxx:93
Section * find(const AnyString &name)
Try to find a section by its name.
Definition inifile.cpp:327
bool loaded() const
Get if the INI file has been loaded/written.
Definition inifile.hxx:25
void properties(const CallbackT &callback)
Iterate through all properties of all sections.
Definition inifile.hxx:135