TIni
Represents the contents of an ini file.
The global section index is defined by INI_GLOBAL_SECTION. You should call Free() when you are finished working with it, to allow it to clean up any resources it is using.
Constructors
Method New()
Creates a new empty TIni instance.
Methods
Method Save(path:String)
Saves the ini file to the specified path.
Method Save(stream:TStream)
Saves the ini file to the specified stream.
Does not close the TStream.
Method CountSections:Int()
Returns the number of sections.
There's at least one section in an ini file (the global section), but there can be many more,
each specified in the file by the section name wrapped in square brackets [ ]
Method GetSection:TIniSection(index:Int)
Returns the section at the given index, or Null if the index is out of bounds.
INI_GLOBAL_SECTION can be used to get the global section.
Method FindSection:TIniSection(name:String)
Finds a section by name.
Returns
The named section, or Null if not found.
Method AddSection:TIniSection(name:String)
Adds a section with the specified name.
There is no check done to see if a section with the specified name already exists - multiple sections of the same name are allowed.
Method RemoveSection(index:Int)
Removes a section at the given index.
Method Set(section:String, name:String, value:String)
Sets the value for the property with the given section and name.
If the section or property does not exist, it is created.
Method Set(name:String, value:String)
Sets the value for the property with the given name in the global section.
If the property does not exist, it is created.
Method Get:String(section:String, name:String)
Returns the value for the property with the given section and name, or Null if not found.
Method Get:String(name:String)
Returns the value for the property with the given name in the global section, or Null if not found.
Method TryGet:Int(section:String, name:String, value:String Var)
Attempts to get the property value with the given section and name.
Returns
True if the property was found and has a value, otherwise False.
Method TryGet:Int(name:String, value:String Var)
Attempts to get the property value with the given name in the global section.
Returns
True if the property was found and has a value, otherwise False.
Method Has:Int(section:String, name:String)
Returns True if a property with the given section and name exists, otherwise False.
Method Has:Int(name:String)
Returns True if a property with the given name exists in the global section, otherwise False.
Method Free()
Frees instance and associated data.
Functions
Function Load:TIni(path:String)
Loads an ini file at the given path.
Returns
The loaded ini file, or Null if the file could not be loaded.
Function Load:TIni(stream:TStream)
Loads an ini file from the given stream.
Does not close the TStream.
Returns
The loaded ini file from the stream, or Null if the file could not be loaded.
