ae.utils.sini

Structured INI

Members

Aliases

makeStructuredIniHandler
deprecated alias makeStructuredIniHandler = makeIniHandler
Undocumented in source.
parseStructuredIni
deprecated alias parseStructuredIni = parseIni
Undocumented in source.

Enums

isIniHandler
eponymoustemplate isIniHandler(H, S)

Evaluates to true if H is a valid INI handler for a string type S.

Functions

formatIni
S formatIni(T value, size_t delegate(S[] path) getSectionLength)

Formats a data structure as a structured .ini file.

iniHandler
IniHandler!S iniHandler(void delegate(S) leafHandler, IniHandler!S delegate(S) nodeHandler)

Helper which creates an INI handler out of delegates.

iniHandler
IniHandler!S iniHandler(void delegate(S, S) leafHandler, IniThickLeafHandler!S delegate(S) nodeHandler)

Helper which creates an IniThinkLeafHandler.

lexIniLine
IniLine!S lexIniLine(S line)

Lexer implementation.

loadIni
S loadIni(string fileName)

Convenience function to load a struct from an INI file. Returns .init if the file does not exist.

loadInis
S loadInis(char[][] fileNames)

As above, though loads several INI files (duplicate values appearing in later INI files override any values from earlier files).

makeIniHandler
IniHandler!S makeIniHandler(U v)

Construct an IniHandler which parses an INI file into v.

parseIni
void parseIni(R r, H rootHandler)

Parse a structured INI from a range of lines, through the given handler.

parseIni
T parseIni(R r)
parseIniInto
void parseIniInto(R r, T result)

Parse structured INI lines from a range of strings, into a user-defined struct.

prettifyIni
string prettifyIni(string ini)

Insert a blank line before each section

updateIni
void updateIni(S[] lines, S name, S value)

Adds or updates a value in an INI file.

updateIni
void updateIni(S[] lines, T value)

Updates an entire INI file. Like formatIni, but tries to preserve existing field order and comments.

updateIniFile
void updateIniFile(string fileName, S name, S value)

Like updateIni, but updates a file on disk.

Structs

IniFragment
struct IniFragment(S)

Utility sponge type which absorbs any INI data. Can be later deserialized into a concrete type.

IniHandler
struct IniHandler(S)

Represents the user-defined behavior for handling a node in a structured INI file's hierarchy.

IniLine
struct IniLine(S)

Lexer output.

IniThickLeafHandler
struct IniThickLeafHandler(S)

Alternative API for IniHandler, where each leaf accepts name/value pairs instead of single values.

IniWriter
struct IniWriter(O)

Simple convenience formatter for writing INI files.

Templates

visitWithPath
template visitWithPath(alias visitor, S = string)

Walks a data structure and calls visitor with each field and its path.

Meta

License

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Authors

Vladimir Panteleev <ae@cy.md>