tcl-quill 0.3.0: Quill Project Automation System for Tcl/Tk

parmset(n): Parameter Set -- quill(n)

SYNOPSIS
DESCRIPTION
COMMANDS
INSTANCE COMMAND
AUTHOR
SEE ALSO

SYNOPSIS

package require quill 0.3.0
namespace import ::quill::*
parmset obj ?options...?
obj cget option
obj clear
obj configure ?option value?...
obj define name ptype value
obj exists name
obj get name
obj getdefault name
obj list ?pattern?
obj load filename ?mode?
obj names ?pattern?
obj save filename ?header?
obj set name value
obj type name

DESCRIPTION

parmset(n) is an object type which manages a set of parameters with typed values. Clients can define parameters, set and get their values, and query them in several ways. Parameters are typically arranged in an implicit hierarchy, using periods as separators, e.g., app.this and app.that.

COMMANDS

parmset(n) defines the following commands:

parmset obj ?options...?
Creates a new parmset(n) object called obj. The parmset(n) is initially empty; new parameters can be defined with define.

The parmset(n) may be created with the following option:

-notifycmd command
Specifies a command to be called when one or more parameter values are set. The command is called with one additional argument:

  • When a single parameter value is set, the command is called with the name of the parameter.

  • When load or clear is called, the command is called with the empty string.

Note that the command is called whether or not any parameter values actually changed.

INSTANCE COMMAND

Each instance of parmset(n) has the following subcommands.

obj cget option
Returns the value of the named option. See above for the list of options.

obj clear
Sets all parameters to their default values.

obj configure ?option value?...
This method sets the value of one or more options. See above for the list of options.

obj define name ptype value
Defines a new parameter called name of type ptype, with the specified default value. The ptype needs to be a validation type command, e.g., snit::boolean. See the section on validation types in the Snit man page.

obj exists name
Returns 1 if the parmset(n) contains a parameter called name, and 0 otherwise.

obj get name
Returns the value of the named parameter.

obj getdefault name
Returns the default value of the named parameter.

obj list ?pattern?
Returns a two-column list of the parameter names and values in obj. If given, pattern should be a glob-style wildcard pattern; only parameters whose names which match the pattern will be included.

obj load filename ?mode?
Loads the file named filename into the parmset. If the load is successful, any parameters set in the file will have the values specified there; any parameters not set in the file will have their default values. If the load is unsuccessful, e.g., if one of the values is invalid, or if there is an unrecognized parameter, or there is some other error in the file, then an error will be thrown and the parmset's current contents will be unchanged.

The mode may be set to -strict (the default) or -forgiving. If mode is -forgiving, then parmset(n) will completely ignore unrecognized parameters and invalid parameter values, and will load whatever valid parameter values it finds.

obj names ?pattern?
Returns a list of the parameter names in dictionary order. By default, the list includes all names. If given, pattern should be a glob-style wildcard pattern; only names which match the pattern will be returned.

obj save filename ?header?
Saves the parameter set's data to a file called filename; any existing file with that name will be overwritten. The header comment in the file will contain the specified header string; it defaults to "Parameter values".

obj set name value
Sets the value of parameter name. The value must belong to the parameter's type.

obj type name
Returns the type of the named parameter.

AUTHOR

Will Duquette.

SEE ALSO

quill(n).
Generated from parmset.manpage on Sat Nov 08 09:29:59 PST 2014