Model Railroad System 2.2.2
Functions
ReadConfiguration Namespace Reference

The Read Configuration File code is contained in this namespace. More...

Functions

 ReadConfiguration (filename, configurationArrayName)
 This procedure reads in the configuration file named by the filename into the array named by configurationArrayName. More...
 
 IsEven (i)
 Checks if its argument is an even number. More...
 
 WriteConfiguration (filename, configurationArrayName)
 This procedure writes the configuration contianed in configurationArrayName to the file named by the filename. More...
 
 ConfigurationType (...)
 This macro defines the body of a snit::type that implements a program's global configuration (or preferences). More...
 

Detailed Description

The Read Configuration File code is contained in this namespace.

Author
Robert Heller <heller@deepsoft.com>

Package provided

ReadConfiguration 1.0

Function Documentation

◆ ConfigurationType()

ReadConfiguration::ConfigurationType (   ...)

This macro defines the body of a snit::type that implements a program's global configuration (or preferences).

The argument list is a set of configuration variable defination lists. Each list contains four elements: the label, the key list name (a one or two element list), the type (one of directory, infile, outfile, string, enumerated, integer, double, or color), and the default value. Enumerated types have an additional (fifth) element, the set of possible values. Numerical types (double and integer) have a range of values as a fifth element. This macro should only be called inside a snit::type defination.

The configuration (aka preferences) are stored in the user's home directory. The file name under UNIX (including MacOSX) starts with a dot and contains the application rootname (from argv0). Under MS-Windows, the file name does not start with a dot. Instead .rc is appended.

Parameters
...The configuration variable definitions.

Type methods defined:

  • load Load the configuration.
  • save Save the configuration.
  • edit Edit the configuration with a popup dialog.
  • getkeyoption Get a keyed option. Takes two arguments.
  • getoption Get a non-keyed option. Takes one argument.
  • getanonoymous Gets the anonoymous option. Takes no arguments.
Author
Robert Heller <heller@deepsoft.com>

References FileEntry::cget(), ReadConfiguration(), and WriteConfiguration().

◆ IsEven()

ReadConfiguration::IsEven ( i  )

Checks if its argument is an even number.

Parameters
iValue to check.
Author
Robert Heller <heller@deepsoft.com>

◆ ReadConfiguration()

ReadConfiguration::ReadConfiguration ( filename  ,
configurationArrayName   
)

This procedure reads in the configuration file named by the filename into the array named by configurationArrayName.

Parameters
filenameThe name of the configuration file.
configurationArrayNameThe name of the array to hold the configuration.
Author
Robert Heller <heller@deepsoft.com>

Referenced by ConfigurationType().

◆ WriteConfiguration()

ReadConfiguration::WriteConfiguration ( filename  ,
configurationArrayName   
)

This procedure writes the configuration contianed in configurationArrayName to the file named by the filename.

Parameters
filenameThe name of the configuration file.
configurationArrayNameThe name of the array holding the configuration.
Author
Robert Heller <heller@deepsoft.com>

Referenced by ConfigurationType().