User Tools

Site Tools


DzAppSettings

Provides cross-platform support for persistent application settings.

More...

Inherits :

Constructors

DAZ Script
DzAppSettings ()
DzAppSettings ( String startPath )

Methods

Detailed Description

Application Settings are used to store and retrieve settings that persist from one execution of the application to the next. On Windows, the settings are saved in the registry. On Mac, these settings are saved via Mac preference plist files.

You can create an instance of this class any time you need to read or write persistent settings. This class is a replacement for DzAppSettingsMgr as it is easier and safer to use. Since each instance is separate, the current path of one instance will not affect the rest of the application. It is also not necessary to call popPath() to put this class back into its previous state.

Constructors


DzAppSettings()

Default Constructor - creates a new settings object that starts out at the default application path.


DzAppSettings( String startPath )

Constructor - creates a new settings object that pushes the given path onto the default application path. This is the same as using the default constructor and then calling pushPath() with the given path.

Methods


Boolean : containsValue( String key )

Parameter(s):

  • key - The name of the value to check.

Return Value:

  • true if this settings contains the named value, otherwise false.

Boolean : getBoolValue( String key, Boolean def=false )

Read a boolean value from the given key.

Parameter(s):

  • key - The name of the value to read.
  • def - Default value - this value is returned if the named value fails to be read.

Return Value:

  • The value of the requested key.

See Also:


Color : getColorValue( String key, Color def=Color )

Read a color value from the given key.

Parameter(s):

  • key - The name of the value to read.
  • def - Default value - this value is returned if the named value fails to be read.

Return Value:

  • The value of the requested key.

See Also:


DzFloatColor : getFloatColorValue( String key, DzFloatColor def=DzFloatColor )

Read a float color value from the given key.

Parameter(s):

  • key - The name of the value to read.
  • def - Default value - this value is returned if the named value fails to be read.

Return Value:

  • The value of the requested key.

See Also:


Number : getFloatValue( String key, Number def=0.0 )

Read a floating point value from the given key.

Parameter(s):

  • key - The name of the value to read.
  • def - Default value - this value is returned if the named value fails to be read.

Return Value:

  • The value of the requested key.

See Also:


Number : getIntValue( String key, Number def=0 )

Read a integer value from the given key.

Parameter(s):

  • key - The name of the value to read.
  • def - Default value - this value is returned if the named value fails to be read.

Return Value:

  • The value of the requested key.

See Also:


String : getStringValue( String key, String def=“” )

Read a string value from the given key.

Parameter(s):

  • key - The name of the value to read.
  • def - Default value - this value is returned if the named value fails to be read.

Return Value:

  • The value of the requested key.

See Also:


void : popPath()

Pops a temporary key path off the top of the stack.


void : pushPath( String path )

Sets the current key path temporarily to the given path; popPath() can be called to remove this path.

Parameter(s):

  • path - The sub-path to add to the current key path.

Boolean : removeKey( String key )

Removes a key (and all values, sub-keys/ by name.

Parameter(s):

  • key - The name of the key to remove.

Since:

  • 4.15.0.30

Boolean : removeValue( String key )

Removes a setting by name.

Parameter(s):

  • key - The name of the key to remove.

Return Value:

  • true if the key/value existed and was successfully removed, otherwise false.

Boolean : setBoolValue( String key, Boolean setting )

Sets a key with a boolean value.

Parameter(s):

  • key - The name of the key to write.
  • setting - The value to set.

Return Value:

  • true if the key/value was successfully set, otherwise false.

See Also:


Boolean : setColorValue( String key, Color setting )

Sets a key with a color value.

Parameter(s):

  • key - The name of the key to write.
  • setting - The value to set.

Return Value:

  • true if the key/value was successfully set, otherwise false.

See Also:


Boolean : setFloatColorValue( String key, DzFloatColor setting )

Sets a key with a float color value.

Parameter(s):

  • key - The name of the key to write.
  • setting - The value to set.

Return Value:

  • true if the key/value was successfully set, otherwise false.

See Also:


Boolean : setFloatValue( String key, Number setting )

Sets a key with a floating point value.

Parameter(s):

  • key - The name of the key to write.
  • setting - The value to set.

Return Value:

  • true if the key/value was successfully set, otherwise false.

See Also:


Boolean : setIntValue( String key, Number setting )

Sets a key with a integer value.

Parameter(s):

  • key - The name of the key to write.
  • setting - The value to set.

Return Value:

  • true if the key/value was successfully set, otherwise false.

See Also:


Boolean : setStringValue( String key, String setting )

Sets a key with a string value.

Parameter(s):

  • key - The name of the key to write.
  • setting - The value to set.

Return Value:

  • true if the key/value was successfully set, otherwise false.

See Also: