8#ifndef HPP_ALIB_CONFIG_INIFILE
9#define HPP_ALIB_CONFIG_INIFILE 1
18namespace alib {
namespace config {
222 std::pair<Section*, Entry*>,
264 if( section.Name.IsNotEmpty() && section.Comments.IsNull() )
266 "Hint: New section {!Q} , which was programmatically added to\n"
267 " INI-file {!Q}, has no comments.",
328 if( section ==
nullptr )
lang::system::PathString FileName
The file name.
ALIB_API void AddComments(String &dest, const String &comments, const String &prefix=A_CHAR("# "))
List< MonoAllocator, Section > Sections
The list of sections.
ALIB_API void Reset()
Clears all data, resets the internal mono allocator.
ALIB_API Section * CreateSection(const String &name)
ALIB_API std::pair< Section *, bool > SearchOrCreateSection(const String §ionName)
String FileComments
The file header which will be written out as a comment lines with "# " prefixes.
HashMap< MonoAllocator, EntryKey, std::pair< Section *, Entry * >, EntryKey::Hash, EntryKey::EqualTo > entryTable
MonoAllocator Allocator
A monotonic allocator used for allocating sections and entries.
ALIB_API void Write(const lang::system::PathString &path=lang::system::NULL_PATH)
ALIB_API Entry * CreateEntry(Section *section, const String &name)
ALIB_API Section * DeleteSection(const String &name)
ALIB_API Section * SearchSection(const String §ionName)
IniFile(const lang::system::Path &path)
ALIB_API Entry * DeleteEntry(Section *section, const String &name)
Entry * DeleteEntry(const String §ionName, const String &name)
List< MonoAllocator, integer > LinesWithReadErrors
ALIB_API integer Read(const lang::system::CPathString &path)
ALIB_API IniFile()
Default constructor.
bool startsWithCommentSymbol(String &subs)
ALIB_API std::pair< Section *, Entry * > SearchEntry(const String §ion, const String &name)
constexpr bool IsEmpty() const
std::size_t HashcodeIgnoreCase() const
bool Equals(const TString< TChar > &rhs) const
#define ALIB_WARNING(...)
static constexpr PathString NULL_PATH
A nulled path string.
strings::compatibility::std::StringWriter StringWriter
Type alias in namespace alib.
monomem::TMonoAllocator< lang::HeapAllocator > MonoAllocator
constexpr String NULL_STRING
A nulled string of the default character type.
lang::integer integer
Type alias in namespace alib.
Equality functor for nodes hashed in field entryTable.
bool operator()(const EntryKey &lhs, const EntryKey &rhs) const
Hash functor for nodes hashed in field entryTable.
std::size_t operator()(const EntryKey &key) const
Hash functor for nodes hashed in field entryTable. Ignores letter case.
const String & EntryName
The name of the entry.
const String & SectionName
The name of the section.
EntryKey(const String §ionName, const String &entryName)
String Comments
The entry's comments.
String NewValue
If this value is set, RawValue will ignored on writing.
String Name
The entry's name.
bool WriteBack
If given, a write back indicator was found for this entry.
A section of the INI-file.
Section(MonoAllocator &monoAllocator)
String Comments
The comment lines of the section.
String Name
The name of the section.
bool WriteBack
If given, a write back indicator was found for this entry.
List< MonoAllocator, Entry, Recycling::None > Entries
The list of variables of the section.