class iniFile

superclass(es) object
subclass(es) -
description The iniFile class can be used to write and read strings or integers to or from an .ini file.

tasks

An instance of the iniFile class must be initialised before it can be used, this is done by calling the method init/1 to specify the name of a file.
When a string or an integer is read a default value must be supplied, this default value is returned if the requested parameter could not be read.

methods

init(Name)

func Set the filename of the file to use for reading or writing.
pre The variable Name must contain a string value.
post The name of the file was stored.

name(Output)

func Get the filename of iniFile instance.
pre TRUE
post The name of the file was assigned to Output, if the instance was not initialised by init/1 then no value was assigned to Output.

writeString(Section, Parameter, Value, Output)

func Write a string value to a file. The result of writing the string looks like:
[Section]
Parameter = Value
pre The variables Section, Parameter and Value must contain a string value.
post If the parameter value was written successfully then true was assigned to Output, else was false assigned.

readString(Section, Parameter, DefaultValue, Output)

func Read a string value from the file. If the parameter could not be read the value of the parameter DefaultValue is returned.
pre The variables Section, Parameter and DefaultValue must contain a string value.
post The string value that was read was assigned to Output.

writeInt(Section, Parameter, Value, Output)

func Write an integer value to a file. The result of writing the string looks like:
[Section]
Parameter = Value
pre The variables Section and Parameter must contain a string value. The variable Value must contain an integer value.
post If the parameter value was written successfully then true was assigned to Output, else was false assigned.

readInt(Section, Parameter, DefaultValue, Output)

func Read an integer value from the file. If the parameter could not be read the value of the parameter DefaultValue is returned.
pre The variables Section and Parameter must contain a string value. The variable DefaultValue must contain an integer value.
post The integer value that was read was assigned to Output.

deleteSection(Section)

func Delete an entire section from the file.
pre The variable Section must contain a string value.
post If there was a section in the file with the same name as the value of the variable Section then that complete section was removed.

deleteParameter(Section, Parameter)

func Delete a single parameter from a section from the file.
pre The variables Section and Parameter must contain a string value.
post If there was a parameter in the specified section in the file then that parameter was removed.