DataConfig
INI file format config parser with similar functions to Python version except for multiline values.
Types
VectorOfSections* = SetStr.ElementVector;
Parser* = RECORD
sections* : SetStr.Set;
entries* : DictStrStr.Dictionary;
END;
Procedures
InitParser
PROCEDURE InitParser*(VAR parser : Parser);
Parser.Dispose
Deallocate data
PROCEDURE (VAR this : Parser) Dispose*();
Parser.Clear
Clear data
PROCEDURE (VAR this : Parser) Clear*();
Parser.Get
Get config value. Return TRUE if success.
PROCEDURE (VAR this- : Parser) Get*(VAR value : String.STRING; section-, key- : ARRAY OF CHAR) : BOOLEAN;
Parser.Set
Set config value and add section if missing. Return TRUE if success.
PROCEDURE (VAR this : Parser) Set*(section-, key-, value- : ARRAY OF CHAR) : BOOLEAN;
Parser.Delete
Delete config value. Return TRUE if success.
PROCEDURE (VAR this : Parser) Delete*(section-, key- : ARRAY OF CHAR) : BOOLEAN;
Parser.HasSection
Return TRUE if section exists
PROCEDURE (VAR this- : Parser) HasSection*(section- : ARRAY OF CHAR): BOOLEAN;
Parser.Sections
Extract Vector of sections
PROCEDURE (VAR this- : Parser) Sections*(): VectorOfSections;
Parser.Write
Write data to Stream
PROCEDURE (VAR this- : Parser) Write*(VAR fh : Type.Stream): BOOLEAN;
Parser.Read
Read from Stream. Return 0 on success. Positive return value indicate line with error. Negative return value indicate internal error. This operation will try to append the new data. Clear the data before operation if this is not intended.
PROCEDURE (VAR this : Parser) Read*(VAR fh : Type.Stream): INTEGER;