FConfigIniFile
- Module
- Core
- Header
#include "Core/ConfigIni.h"- Namespace
Mowo
Properties
| Type | Name | Description |
|---|---|---|
std::vector<FConfigIniSection> | Sections | Sections in first-seen order; entries in written order. |
Public functions
| Returns | Name | Description |
|---|---|---|
bool | Combine | Applies text on top of what this file holds, with the array operators above. |
bool | CombineFile | |
std::string | Write | Sections in order, keys in order, arrays as +Key= lines. |
bool | WriteFile | |
const FConfigIniSection* | FindSection | |
FConfigIniSection& | FindOrAddSection | |
bool | GetString | |
void | ToDocument | The file as a Config document: section a.b becomes the Section chain a > b, so every existing dotted reader (rendering.graphics_api) reads an INI the way it read an MDF. |
FConfigIniFile | FromDocument | The inverse, for Config::Save on an .ini path. |
std::string | FormatValue | One value as an INI line spells it, and back — the typing ToDocument uses. |
MDF::MdfValue | ParseValue | |
bool | LooksLikeIni | True when the text's first meaningful line is a [section] header. |
std::string | ReplaceArrayInText | text with every key line of section replaced by values as +key= lines, and everything else — comments, blank lines, other keys and sections — left as written. |
Function details
Combine
bool Combine(const std::string& text, std::string* error = nullptr)Applies text on top of what this file holds, with the array operators above. A plain Key= drops what lower layers gave the key once per combine, so repeated plain lines in one file still build a list.
CombineFile
bool CombineFile(const std::filesystem::path& path, std::string* error = nullptr)Write
std::string Write() constSections in order, keys in order, arrays as +Key= lines. Keys before the first section header belong to the section named "".
WriteFile
bool WriteFile(const std::filesystem::path& path) constFindSection
const FConfigIniSection* FindSection(const std::string& name) constFindOrAddSection
FConfigIniSection& FindOrAddSection(const std::string& name)GetString
bool GetString(const std::string& section, const std::string& key, std::string& out) constToDocument
void ToDocument(MDF::MdfDocument& out) constThe file as a Config document: section a.b becomes the Section chain a > b, so every existing dotted reader (rendering.graphics_api) reads an INI the way it read an MDF. Values are typed by their spelling: True/False, integers, floats, (X=,Y=,Z=[,W=]) vectors; quoted text stays text; a list becomes an array.
FromDocument
static FConfigIniFile FromDocument(const MDF::MdfDocument& doc)The inverse, for Config::Save on an .ini path.
FormatValue
static std::string FormatValue(const MDF::MdfValue& value, bool& quoted)One value as an INI line spells it, and back — the typing ToDocument uses. quoted says the text must be written in quotes to read back as text (it would otherwise read as a number or a bool).
ParseValue
static MDF::MdfValue ParseValue(const std::string& text, bool quoted)LooksLikeIni
static bool LooksLikeIni(const std::string& text)True when the text's first meaningful line is a [section] header. A reader handed a path it did not resolve — a cook argument, a packaged legacy name — tells an INI from the MDF document it replaced this way.
ReplaceArrayInText
static std::string ReplaceArrayInText(const std::string& text, const std::string& section, const std::string& key, const std::vector<std::string>& values)text with every key line of section replaced by values as +key= lines, and everything else — comments, blank lines, other keys and sections — left as written. A file a machine rewrites but a person also edits keeps the person's lines; the section is appended when missing.