DzSettings Class Reference

Class for storing and passing simple sets of settings. More...

Inheritance diagram for DzSettings:

QObject Object DzFileIOSettings DzPaneSettings DzPropertySettings List of all members.

Enumerations



enum  Type { StringValue, IntValue, BoolValue, FloatValue }

Constructors

 DzSettings ()

Methods

Boolean fromString (String settings)
Boolean getBoolValue (String key, Boolean def=false)
Number getFloatValue (String key, Number def=0.0)
Number getIntValue (String key, Number def=0)
String getKey (Number which)
Number getNumValues ()
Number getSettingIndex (String key)
DzSettings getSettingsValue (String key)
String getStringValue (String key, String def="")
String getValue (Number which)
Type getValueType (Number which)
void removeValue (String key)
void setBoolValue (String key, Boolean value)
void setFloatValue (String key, Number value)
void setIntValue (String key, Number value)
DzSettings setSettingsValue (String key)
DzSettings setSettingsValue (String key, DzSettings settings)
void setStringValue (String key, String value)
void toScript (String varName, DzScript script, Number indent, Boolean writeCreatation=false)
String toString ()

Detailed Description

Class for storing and passing simple sets of settings.


Member Enumeration Documentation

enum DzSettings::Type

Enumerated types of the values stored in the DzSettings class.

Enumerator:
StringValue  A String value
IntValue  An Integer value
BoolValue  A Boolean value
FloatValue  A Floating-point value


Constructor & Destructor Documentation

DzSettings::DzSettings (  ) 

Constructor


Member Function Documentation

Boolean DzSettings::fromString ( String  settings  ) 

Populates this settings object with the data encoded by the given string.

Parameters:
settings The settings string to load the data from.
Returns:
true if the data was read successfully, otherwise false.

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

Gets a boolean value from the settings.

Parameters:
key The key string.
def The default value that is returned if the key does not exist.
Returns:
The value of the setting.

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

Gets a float value from the settings.

Parameters:
key The key string.
def The default value that is returned if the key does not exist.
Returns:
The value of the setting.

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

Gets an integer value from the settings.

Parameters:
key The key string.
def The default value that is returned if the key does not exist.
Returns:
The value of the setting.

String DzSettings::getKey ( Number  which  ) 

Parameters:
which The index of the value to get the key for.
Returns:
The key string for the setting at the given index.

Number DzSettings::getNumValues (  ) 

Returns:
The number of values stored in the settings.

Number DzSettings::getSettingIndex ( String  key  ) 

Parameters:
key The key of the value to find
Returns:
The index of the setting with the given key, or NULL if no match was found. NOTE: This index is only valid while this object remains unchanged. Once a value is added or removed, this index may become invalid.

DzSettings DzSettings::getSettingsValue ( String  key  ) 

Gets a float value from the settings.

Parameters:
key The key string.
Returns:
The value of the setting or null if the key is not found or not a DzSettings value

String DzSettings::getStringValue ( String  key,
String  def = "" 
)

Gets a string value from the settings.

Parameters:
key The key string.
def The default value that is returned if the key does not exist.
Returns:
The value of the setting.

String DzSettings::getValue ( Number  which  ) 

Parameters:
which The index of the value to get.
Returns:
The value of the setting at the given index in string form.

Type DzSettings::getValueType ( Number  which  ) 

Parameters:
which The index of the value to get the type of.
Returns:
The type of the setting at the given index.

void DzSettings::removeValue ( String  key  ) 

Removes a value

Parameters:
key The key string to remove

void DzSettings::setBoolValue ( String  key,
Boolean  value 
)

Adds a boolean value.

Parameters:
key The key string.
value The value for the setting.

void DzSettings::setFloatValue ( String  key,
Number  value 
)

Adds a float value.

Parameters:
key The key string.
value The value for the setting.

void DzSettings::setIntValue ( String  key,
Number  value 
)

Adds an integer value.

Parameters:
key The key string.
value The value for the setting.

void DzSettings::setSettingsValue ( String  key  ) 

Adds a float value.

Parameters:
key The key string.
return An empty created settings object at the given key

void DzSettings::setSettingsValue ( String  key,
DzSettings  settings 
)

Adds a float value.

Parameters:
key The key string.
settings The value for the setting. A local copy is made of this setting
return The created settings or NULL if setting if settings was null

void DzSettings::setStringValue ( String  key,
String  value 
)

Adds a string value.

Parameters:
key The key string.
value The value for the setting.

void DzSettings::toScript ( String  varName,
DzScript  script,
Number  indent,
Boolean  writeCreatation = false 
)

Writes this DzSetting to the handed script file. After the lines it adds there will be a valid script object by name varName that is equal to this DzSettings object.

Parameters:
varName The name of the variable to set the settings on
script Script to write these settings to.
ident Indent level for the generated lines.
writeCreatation Writes the creation statement at the top, if this is false it is the caller's reposibility to make sure there is script object by varName that points to a legal DzSettings object.

String DzSettings::toString (  ) 

Returns:
A string representation of the data. The string will contain XML encoding, if writing to an XML file, it is recommended that you use the toDOM() and fromDOM() functions instead.

Reimplemented from Object.


Generated on Thu Sep 24 12:21:15 2009

Copyright © 2002 - 2009 DAZ 3D, Inc.