Class: Fox::FXSettings
- Defined in:
- rdoc-sources/FXSettings.rb,
lib/fox16/core.rb,
lib/fox16/settings.rb
Overview
The Settings class manages a key-value database. This is normally used as part of Registry, but can also be used separately in applications that need to maintain a key-value database in a file of their own. String values can contain any character, and will be escaped when written to the file.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from FXDict
Instance Method Summary collapse
-
#data(pos) ⇒ Object
Obtain the string dictionary (an FXStringDict instance) for the requested section number.
-
#deleteEntry(section, key) ⇒ Object
Delete the registry entry for the specified section and key.
-
#deleteSection(section) ⇒ Object
Delete an entire section from this settings database.
-
#each_section ⇒ Object
Iterate over sections (where each section is a dictionary).
-
#existingEntry?(section, key) ⇒ Boolean
Returns
true
if a registry entry exists for the specified section and key. -
#existingSection?(section) ⇒ Boolean
Returns
true
if the named section exists. -
#find(section) ⇒ Object
Find a section given its name.
-
#initialize ⇒ FXSettings
constructor
Return an initialized FXSettings instance.
-
#modified=(mdfy = true) ⇒ Object
Mark as changed.
-
#modified? ⇒ Boolean
Returns
true
if this settings object has been modified. -
#parseFile(filename, mark) ⇒ Object
Parse a file containing a settings database.
-
#readBoolEntry(section, key, default = false) ⇒ Object
Read a boolean registry entry from the specified section and key.
-
#readColorEntry(section, key, default = 0) ⇒ Object
Read a color value registry entry from the specified section and key.
-
#readIntEntry(section, key, default = 0) ⇒ Object
Read an integer registry entry from the specified section and key.
-
#readRealEntry(section, key, default = 0.0) ⇒ Object
Read a double-precision floating point registry entry from the specified section and key.
-
#readStringEntry(section, key, default = "") ⇒ Object
Read a string registry entry from the specified section and key.
-
#readUnsignedEntry(section, key, default = 0) ⇒ Object
Read an unsigned integer registry entry from the specified section and key.
-
#unparseFile(filename) ⇒ Object
Unparse settings database into given file.
-
#writeBoolEntry(section, key, value) ⇒ Object
Write a boolean registry value to the specified section and key.
-
#writeColorEntry(section, key, value) ⇒ Object
Write a color registry value to the specified section and key.
-
#writeIntEntry(section, key, value) ⇒ Object
Write an integer registry value to the specified section and key.
-
#writeRealEntry(section, key, value) ⇒ Object
Write a double-precision floating point registry value to the specified section and key.
-
#writeStringEntry(section, key, value) ⇒ Object
Write a string registry value to the specified section and key.
-
#writeUnsignedEntry(section, key, value) ⇒ Object
Write an unsigned integer registry value to the specified section and key.
Methods inherited from FXDict
#clear, #each_key, #empty?, #has_key?, #key, #keys, #marked?, #next, #prev
Methods inherited from FXObject
#bind, #handle, #load, #save, subclasses
Constructor Details
#initialize ⇒ FXSettings
Return an initialized FXSettings instance.
13 14 |
# File 'rdoc-sources/FXSettings.rb', line 13 def initialize # :yields: theSettings end |
Instance Method Details
#data(pos) ⇒ Object
Obtain the string dictionary (an FXStringDict instance) for the requested section number.
Parameters:
pos
-
the section number of interest [Integer]
35 |
# File 'rdoc-sources/FXSettings.rb', line 35 def data(pos) ; end |
#deleteEntry(section, key) ⇒ Object
Delete the registry entry for the specified section and key. Returns true on success, false otherwise.
Parameters:
section
-
the section containing the key to be deleted [String]
key
-
the key to be deleted [String]
207 |
# File 'rdoc-sources/FXSettings.rb', line 207 def deleteEntry(section, key) ; end |
#deleteSection(section) ⇒ Object
Delete an entire section from this settings database. Returns true on success, false otherwise.
Parameters:
section
-
the name of the section to be deleted [String]
227 |
# File 'rdoc-sources/FXSettings.rb', line 227 def deleteSection(section) ; end |
#each_section ⇒ Object
Iterate over sections (where each section is a dictionary).
51 52 |
# File 'rdoc-sources/FXSettings.rb', line 51 def each_section # :yields: aStringDict end |
#existingEntry?(section, key) ⇒ Boolean
Returns true
if a registry entry exists for the specified section and key.
Parameters:
section
-
the section containing the key of interest [String]
key
-
the key of interest [String]
217 |
# File 'rdoc-sources/FXSettings.rb', line 217 def existingEntry?(section, key) ; end |
#existingSection?(section) ⇒ Boolean
Returns true
if the named section exists.
Parameters:
section
-
the name of the section of interest [String]
236 |
# File 'rdoc-sources/FXSettings.rb', line 236 def existingSection?(section) ; end |
#find(section) ⇒ Object
Find a section given its name. Returns the section (an FXStringDict instance) if found, otherwise returns nil.
Parameters:
section
-
the section name of interest [String]
46 |
# File 'rdoc-sources/FXSettings.rb', line 46 def find(section) ; end |
#modified=(mdfy = true) ⇒ Object
Mark as changed.
241 |
# File 'rdoc-sources/FXSettings.rb', line 241 def modified=(mdfy=true) ; end |
#modified? ⇒ Boolean
Returns true
if this settings object has been modified.
246 |
# File 'rdoc-sources/FXSettings.rb', line 246 def modified? ; end |
#parseFile(filename, mark) ⇒ Object
Parse a file containing a settings database. Returns true on success, false otherwise.
20 |
# File 'rdoc-sources/FXSettings.rb', line 20 def parseFile(filename, mark); end |
#readBoolEntry(section, key, default = false) ⇒ Object
Read a boolean registry entry from the specified section and key. If no value is found, the default value is returned.
124 |
# File 'rdoc-sources/FXSettings.rb', line 124 def readBoolEntry(section, key, default=false) ; end |
#readColorEntry(section, key, default = 0) ⇒ Object
Read a color value registry entry from the specified section and key. If no value is found, the default value is returned.
Parameters:
section
-
the section name [String]
key
-
the key for the setting of interest [String]
default
-
the default value to return if key is not found Fox::FXColor
112 |
# File 'rdoc-sources/FXSettings.rb', line 112 def readColorEntry(section, key, default=0) ; end |
#readIntEntry(section, key, default = 0) ⇒ Object
Read an integer registry entry from the specified section and key. If no value is found, the default value is returned.
Parameters:
section
-
the section name [String]
key
-
the key for the setting of interest [String]
default
-
the default value to return if key is not found [Integer]
76 |
# File 'rdoc-sources/FXSettings.rb', line 76 def readIntEntry(section, key, default=0) ; end |
#readRealEntry(section, key, default = 0.0) ⇒ Object
Read a double-precision floating point registry entry from the specified section and key. If no value is found, the default value is returned.
Parameters:
section
-
the section name [String]
key
-
the key for the setting of interest [String]
default
-
the default value to return if key is not found [Float]
100 |
# File 'rdoc-sources/FXSettings.rb', line 100 def readRealEntry(section, key, default=0.0) ; end |
#readStringEntry(section, key, default = "") ⇒ Object
Read a string registry entry from the specified section and key. If no value is found, the default value is returned.
Parameters:
section
-
the section name [String]
key
-
the key for the setting of interest [String]
default
-
the default value to return if key is not found [String]
64 |
# File 'rdoc-sources/FXSettings.rb', line 64 def readStringEntry(section, key, default="") ; end |
#readUnsignedEntry(section, key, default = 0) ⇒ Object
Read an unsigned integer registry entry from the specified section and key. If no value is found, the default value is returned.
Parameters:
section
-
the section name [String]
key
-
the key for the setting of interest [String]
default
-
the default value to return if key is not found [Integer]
88 |
# File 'rdoc-sources/FXSettings.rb', line 88 def readUnsignedEntry(section, key, default=0) ; end |
#unparseFile(filename) ⇒ Object
Unparse settings database into given file. Returns true on success, false otherwise.
26 |
# File 'rdoc-sources/FXSettings.rb', line 26 def unparseFile(filename) ; end |
#writeBoolEntry(section, key, value) ⇒ Object
Write a boolean registry value to the specified section and key.
196 |
# File 'rdoc-sources/FXSettings.rb', line 196 def writeBoolEntry(section, key, value) ; end |
#writeColorEntry(section, key, value) ⇒ Object
Write a color registry value to the specified section and key. Returns true on success, false otherwise.
Parameters:
section
-
the section name [String]
key
-
the key for this setting [String]
value
-
the value for this setting Fox::FXColor
184 |
# File 'rdoc-sources/FXSettings.rb', line 184 def writeColorEntry(section, key, value) ; end |
#writeIntEntry(section, key, value) ⇒ Object
Write an integer registry value to the specified section and key. Returns true on success, false otherwise.
Parameters:
section
-
the section name [String]
key
-
the key for this setting [String]
value
-
the value for this setting [Integer]
148 |
# File 'rdoc-sources/FXSettings.rb', line 148 def writeIntEntry(section, key, value) ; end |
#writeRealEntry(section, key, value) ⇒ Object
Write a double-precision floating point registry value to the specified section and key. Returns true on success, false otherwise.
Parameters:
section
-
the section name [String]
key
-
the key for this setting [String]
value
-
the value for this setting [Float]
172 |
# File 'rdoc-sources/FXSettings.rb', line 172 def writeRealEntry(section, key, value) ; end |
#writeStringEntry(section, key, value) ⇒ Object
Write a string registry value to the specified section and key. Returns true on success, false otherwise.
Parameters:
section
-
the section name [String]
key
-
the key for this setting [String]
value
-
the value for this setting [String]
136 |
# File 'rdoc-sources/FXSettings.rb', line 136 def writeStringEntry(section, key, value) ; end |
#writeUnsignedEntry(section, key, value) ⇒ Object
Write an unsigned integer registry value to the specified section and key. Returns true on success, false otherwise.
Parameters:
section
-
the section name [String]
key
-
the key for this setting [String]
value
-
the value for this setting [Integer]
160 |
# File 'rdoc-sources/FXSettings.rb', line 160 def writeUnsignedEntry(section, key, value) ; end |