Hatch Game Engine Documentation v1.4.0
The documentation for the Hatch Game Engine
Loading...
Searching...
No Matches
Settings Class Reference

Reading and writing the application's settings from and into INI files. More...

Public Member Functions

void Load (string filename)
 Loads the config from the specified filename. Calling this does not save the current settings.
void Save ()
 Saves the settings.
void Save (string filename)
 Saves the settings with the specified filename.
void SetFilename (string filename)
 Sets the filepath of the settings.
string GetString (string section, string property)
 Looks for a property in a section, and returns its value, as a string.
integer GetNumber (string section, string property)
 Looks for a property in a section, and returns its value, as a number.
integer GetInteger (string section, string property)
 Looks for a property in a section, and returns its value, as an integer.
boolean GetBool (string section, string property)
 Looks for a property in a section, and returns its value, as a boolean.
void SetString (string section, string property, string value)
 Sets a property in a section to a string value.
void SetNumber (string section, string property, number value)
 Sets a property in a section to a decimal value.
void SetInteger (string section, string property, integer value)
 Sets a property in a section to an integer value.
void SetBool (string section, string property, boolean value)
 Sets a property in a section to a boolean value.
void AddSection (string section)
 Creates a section.
void RemoveSection (string section)
 Removes a section.
boolean SectionExists (string section)
 Checks if a section exists.
integer GetSectionCount ()
 Returns how many sections exist in the settings.
boolean PropertyExists (string section, string property)
 Checks if a property exists.
void RemoveProperty (string section, string property)
 Removes a property from a section.
integer GetPropertyCount (string section)
 Returns how many properties exist in the section.

Detailed Description

Reading and writing the application's settings from and into INI files.

Member Function Documentation

◆ AddSection()

void Settings.AddSection ( string section)

Creates a section.

Parameters
sectionThe section name.

◆ GetBool()

boolean Settings.GetBool ( string section,
string property )

Looks for a property in a section, and returns its value, as a boolean.

Parameters
sectionThe section where the property resides. If this is null, the global section is used instead.
propertyThe property to look for.
Returns
Returns the property as a boolean, or null if the section or property aren't valid.

◆ GetInteger()

integer Settings.GetInteger ( string section,
string property )

Looks for a property in a section, and returns its value, as an integer.

Parameters
sectionThe section where the property resides. If this is null, the global section is used instead.
propertyThe property to look for.
Returns
Returns the property as an integer, or null if the section or property aren't valid.

◆ GetNumber()

integer Settings.GetNumber ( string section,
string property )

Looks for a property in a section, and returns its value, as a number.

Parameters
sectionThe section where the property resides. If this is null, the global section is used instead.
propertyThe property to look for.
Returns
Returns the property as a number, or null if the section or property aren't valid.

◆ GetPropertyCount()

integer Settings.GetPropertyCount ( string section)

Returns how many properties exist in the section.

Parameters
sectionThe section. If this is null, the global section is used instead.
Returns
The total section count, as an integer.

◆ GetSectionCount()

integer Settings.GetSectionCount ( )

Returns how many sections exist in the settings.

Returns
Returns the total section count.

◆ GetString()

string Settings.GetString ( string section,
string property )

Looks for a property in a section, and returns its value, as a string.

Parameters
sectionThe section where the property resides. If this is null, the global section is used instead.
propertyThe property to look for.
Returns
Returns the property as a string, or null if the section or property aren't valid.

◆ Load()

void Settings.Load ( string filename)

Loads the config from the specified filename. Calling this does not save the current settings.

Parameters
filenameFilepath of config.

◆ PropertyExists()

boolean Settings.PropertyExists ( string section,
string property )

Checks if a property exists.

Parameters
sectionThe section where the property resides. If this is null, the global section is used instead.
propertyThe property name.
Returns
Returns whether the property exists.

◆ RemoveProperty()

void Settings.RemoveProperty ( string section,
string property )

Removes a property from a section.

Parameters
sectionThe section where the property resides. If this is null, the global section is used instead.
propertyThe property to remove.

◆ RemoveSection()

void Settings.RemoveSection ( string section)

Removes a section.

Parameters
sectionThe section name.

◆ Save()

void Settings.Save ( string filename)

Saves the settings with the specified filename.

Parameters
filenameFilepath of config. This does not change the filepath of the current settings; use Settings.SetFilename to do that.

◆ SectionExists()

boolean Settings.SectionExists ( string section)

Checks if a section exists.

Parameters
sectionThe section name.
Returns
Returns whether the section exists.

◆ SetBool()

void Settings.SetBool ( string section,
string property,
boolean value )

Sets a property in a section to a boolean value.

Parameters
sectionThe section where the property resides. If the section doesn't exist, it will be created. If this is null, the global section is used instead.
propertyThe property to set.
valueThe value of the property.

◆ SetFilename()

void Settings.SetFilename ( string filename)

Sets the filepath of the settings.

Parameters
filenameFilepath of config. This does not save the current settings.

◆ SetInteger()

void Settings.SetInteger ( string section,
string property,
integer value )

Sets a property in a section to an integer value.

Parameters
sectionThe section where the property resides. If the section doesn't exist, it will be created. If this is null, the global section is used instead.
propertyThe property to set.
valueThe value of the property.

◆ SetNumber()

void Settings.SetNumber ( string section,
string property,
number value )

Sets a property in a section to a decimal value.

Parameters
sectionThe section where the property resides. If the section doesn't exist, it will be created. If this is null, the global section is used instead.
propertyThe property to set.
valueThe value of the property.

◆ SetString()

void Settings.SetString ( string section,
string property,
string value )

Sets a property in a section to a string value.

Parameters
sectionThe section where the property resides. If the section doesn't exist, it will be created. If this is null, the global section is used instead.
propertyThe property to set.
valueThe value of the property.