INI-Konfigurationsdateien parsen und schreiben. Unterstützt Sektionen ([Database]), Kommentare (# und ;), typisierte Getter (GetString, GetInt, GetBool, GetFloat mit Default-Wert) und Setter, Schlüssel-/Sektionstests, Iteration über Sektionen und Schlüssel sowie Datei-Load/Save. Kapazität: bis zu 64 Sektionen, 128 Einträge pro Sektion.
Einsatzbereiche: Anwendungskonfiguration, Serverdienste, Embedded-Systeme, Migrations-Scripts; überall wo eine einfache, lesbare Key-Value-Konfiguration ohne XML/JSON-Overhead benötigt wird.
Autor: Andreas Röne
Copyright: 2024-2025 Andreas Röne
| Name | Typ | Wert | Sichtbarkeit |
|---|---|---|---|
MAX_SECTIONS | int64 | 64 | pub |
MAX_ENTRIES_PER_SECTION | int64 | 128 | pub |
MAX_KEY_LENGTH | int64 | 64 | pub |
MAX_VALUE_LENGTH | int64 | 256 | pub |
MAX_LINE_LENGTH | int64 | 512 | pub |
ERR_INI_OK | int64 | 0 | priv |
ERR_INI_INVALID | int64 | 1 | priv |
ERR_INI_NOT_FOUND | int64 | 2 | priv |
ERR_INI_WRITE_ERROR | int64 | 3 | priv |
ERR_INI_BUFFER_TOO_SMALL | int64 | 4 | priv |
INI_BUFFER_SIZE | int64 | 65536 | pub |
| Signatur | Sichtbarkeit | Beschreibung |
|---|---|---|
skipWhitespace(s: pchar, pos: int64): int64 | priv | Überspringt Leerzeichen intern beim Parsen |
isCommentChar(c: int64): bool | priv | Prüft ob Zeichen Kommentar-Start ist |
findLineEnd(s: pchar, pos: int64): int64 | priv | Findet Zeilenende-Position intern |
skipToNextLine(s: pchar, pos: int64): int64 | priv | Springt zur nächsten Zeile intern |
trimString(s: pchar, s_len: int64, output: pchar): int64 | priv | Entfernt führende und nachfolgende Leerzeichen |
findKeyValueSeparator(s: pchar, start: int64, end: int64): int64 | priv | Findet Trennzeichen zwischen Key und Value |
ParseString(input: pchar): int64 | pub | Parst INI-String und gibt Dokument-Handle zurück |
GetString(doc: int64, section: pchar, key: pchar, default_val: pchar): pchar | pub | Liest String-Wert mit Default-Fallback |
GetInt(doc: int64, section: pchar, key: pchar, default_val: int64): int64 | pub | Liest Integer-Wert mit Default-Fallback |
GetBool(doc: int64, section: pchar, key: pchar, default_val: bool): bool | pub | Liest Bool-Wert mit Default-Fallback |
GetFloat(doc: int64, section: pchar, key: pchar, default_val: f64): f64 | pub | Liest Float-Wert mit Default-Fallback |
WriteString(doc: int64, output: pchar, max_len: int64): int64 | pub | Serialisiert Dokument als INI-String |
WriteFile(doc: int64, path: pchar): bool | pub | Schreibt Dokument direkt in Datei |
SetString(doc: int64, section: pchar, key: pchar, value: pchar): void | pub | Setzt oder überschreibt String-Wert |
SetInt(doc: int64, section: pchar, key: pchar, value: int64): void | pub | Setzt oder überschreibt Integer-Wert |
SetBool(doc: int64, section: pchar, key: pchar, value: bool): void | pub | Setzt oder überschreibt Bool-Wert |
SetFloat(doc: int64, section: pchar, key: pchar, value: f64): void | pub | Setzt oder überschreibt Float-Wert |
DeleteKey(doc: int64, section: pchar, key: pchar): bool | pub | Löscht Schlüssel aus Sektion |
DeleteSection(doc: int64, section: pchar): bool | pub | Löscht gesamte Sektion aus Dokument |
LoadFile(path: pchar): int64 | pub | Lädt INI-Datei und gibt Handle zurück |
SaveFile(doc: int64, path: pchar): bool | pub | Speichert Dokument in Datei |
HasSection(doc: int64, section: pchar): bool | pub | Prüft ob Sektion im Dokument existiert |
HasKey(doc: int64, section: pchar, key: pchar): bool | pub | Prüft ob Schlüssel in Sektion existiert |
GetSectionCount(doc: int64): int64 | pub | Gibt Anzahl der Sektionen zurück |
GetSections(doc: int64, output: pchar, max_count: int64): int64 | pub | Listet alle Sektionsnamen ins Array |
GetKeyCount(doc: int64, section: pchar): int64 | pub | Gibt Schlüsselanzahl in Sektion zurück |
GetKeys(doc: int64, section: pchar, output: pchar, max_count: int64): int64 | pub | Listet alle Schlüssel einer Sektion |
AddSectionComment(doc: int64, section: pchar, comment: pchar): void { } | pub | Fügt Kommentar zu Sektion hinzu |
AddKeyComment(doc: int64, section: pchar, key: pchar, comment: pchar): void { } | pub | Fügt Kommentar zu Schlüssel hinzu |
EscapeValue(input: pchar, output: pchar): int64 | pub | Maskiert Sonderzeichen in INI-Wert |
UnescapeValue(input: pchar, output: pchar): int64 | pub | Entmaskiert Sonderzeichen in INI-Wert |
IsValidSectionName(name: pchar): bool | pub | Prüft Gültigkeit eines Sektionsnamens |
IsValidKeyName(key: pchar): bool | pub | Prüft Gültigkeit eines Schlüsselnamens |
BuildKeyValueLine(key: pchar, value: pchar, output: pchar): int64 | pub | Erstellt formatierte Key=Value-Zeile |
BuildSectionHeader(section: pchar, output: pchar): int64 | pub | Erstellt formatierte [Sektion]-Kopfzeile |
ParseLine(line: pchar, line_len: int64, key_out: pchar, value_out: pchar): bool | pub | Parst einzelne Key=Value-Zeile |
IsSectionLine(line: pchar, line_len: int64): bool | pub | Prüft ob Zeile eine Sektionszeile ist |
ParseSectionLine(line: pchar, line_len: int64, output: pchar): int64 | pub | Extrahiert Sektionsname aus Sektionszeile |