ISKernel:dataset (Data Type)

From Lavish Software Wiki
Revision as of 20:42, 16 September 2005 by Beefalo (talk | contribs)
Jump to navigation Jump to search

Description

This data type provides and changes information about sets of data, generally used for XML settings.

Members

  • string Name: Name of the data set
  • float GetFloat[setting]: Retrieves a setting value, as a float
  • float GetFloat[setting,default]: Retrieves a setting value, as a float. Uses the value of default if the value does not exist
  • int GetInt[setting]: Retrieves an setting value, as an int
  • int GetInt[setting,default]: Retrieves an setting value, as an int. Uses the value of default if the value does not exist
  • string GetString[setting]: Retrieves a setting value, as a string
  • string GetString[setting,default]: Retrieves a setting value, as a string. Uses the value of default if the value does not exist
  • int Keys: Total number of keys (and values)
  • string Key[#]: Retrieves the nth key from the list (1-based)
  • int Sets: Total number of sets
  • string Set[#]: Retrieves the name of the nth subset (1-based)
  • dataset Set[name]: Retrieves the subset with the given name

Methods

  • Clear: Clears the data set
  • SetName[name]: Changes the name of the data set
  • Set[setting,value]: Sets (creating if necessary) a setting in this data set
  • UnSet[setting]: Deletes a setting in this data set
  • Clear: Clears the set
  • AddSet[name]: Adds a subset
  • RemoveSet[name]: Deletes a subset
  • Save: Saves the set in its original "setting file" (if any)
  • Save[filename]: Exports the set to the given filename
  • Unload: Unloads the set, dropping any unsaved changes


Returns

Same as Name

Examples

Create an empty XML file

  • SettingXML[test.xml]:Save
test.xml
<?xml version='1.0'?>
<InnerSpaceSettings>
</InnerSpaceSettings>

Unload an XML file

  • SettingXML[test.xml]:Unload
This command will Unload an XML file

Add a subset

  • SettingXML[test.xml]:AddSet[Food]
This command will add a set named "Food" in the XML file "text.xml"

Create a second level subset

  • SettingXML[test.xml].Set[Food]:AddSet[Fruit]
This command will add a set named "Fruit" inside the set named "Food" in the XML file "test.xml"

Create settings in second level subset

  • SettingXML[test.xml].Set[Food].Set[Fruit]:Set[Peach,0]
  • SettingXML[test.xml].Set[Food].Set[Fruit]:Set[Apple,0]
  • SettingXML[test.xml].Set[Food].Set[Fruit]:Set[Orange,0]
  • SettingXML[test.xml].Set[Food].Set[Fruit]:Set[Banana,0]
test.xml
<?xml version='1.0'?>
<InnerSpaceSettings>
       	<Set Name="Food">
	        	<Set Name="Fruit">
			  <Setting Name="Peach">0</Setting>
			  <Setting Name="Apple">0</Setting>
			  <Setting Name="Orange">0</Setting>
			  <Setting Name="Banana">0</Setting>
		        </Set>
	</Set>
</InnerSpaceSettings>

See Also