SimpleClass v1.0 

 The Simple Development Library [incr Tcl] classes declaration 

Project: the Simple Development Library.

Table of contents

1. Package description
   1.1 Overview
   1.2 Usage
   1.3 Examples
   1.4 History
   1.5 Copyright
2. Package public API
   2.1 Types
   2.2 Options
      2.2.1 -debug
   2.3 Namespaces
   2.4 Commands
      2.4.1 ::Simple::Class::cget ?-debug?
      2.4.2 ::Simple::Class::configure ?-debug extbool?
      2.4.3 declare-class class ?-version version? ?-project string? ?-synopsis string? ?-overview string? ?-usage string? ?-api string? ?-keywords list? ?-examples string? ?-classtype type? ?-stereotype choice? ?-extends qualifiedname-list? ?-debug extbool? ?-error declaration? ?-variable declaration? ?-attribute declaration? ?-itkoption declaration? ?-itkcomponent declaration? ?-command declaration? ?-method declaration? ?-assumptions string? ?-resources string? ?-limitations string? ?-effects string? ?-details string? ?-references string? ?-remarks string? ?-todo string? ?-history string? ?-copyright string? ?-body script?
      2.4.4 ::Simple::Class::delete class
      2.4.5 ::Simple::Class::information aliases class
      2.4.6 ::Simple::Class::information api class
      2.4.7 ::Simple::Class::information attributes class ?-access choice?
      2.4.8 ::Simple::Class::information classes ?pattern?
      2.4.9 ::Simple::Class::information commands class
      2.4.10 ::Simple::Class::information errors class
      2.4.11 ::Simple::Class::information exists class
      2.4.12 ::Simple::Class::information exportedcommands class
      2.4.13 ::Simple::Class::information itkcomponents class
      2.4.14 ::Simple::Class::information itkoptions class
      2.4.15 ::Simple::Class::information metadata class
      2.4.16 ::Simple::Class::information methods class
      2.4.17 ::Simple::Class::information objects ?-class name? ?-isa name? ?pattern?
      2.4.18 ::Simple::Class::information variables class ?-access choice?
      2.4.19 ::Simple::ItkComponent::information access class itkcomponent
      2.4.20 ::Simple::ItkComponent::information description class itkcomponent
      2.4.21 ::Simple::ItkComponent::information ignore class itkcomponent
      2.4.22 ::Simple::ItkComponent::information keep class itkcomponent
      2.4.23 ::Simple::ItkComponent::information rename class itkcomponent
      2.4.24 ::Simple::ItkComponent::information resourceclass class itkcomponent
      2.4.25 ::Simple::ItkOption::information choices class itkoption
      2.4.26 ::Simple::ItkOption::information default class itkoption
      2.4.27 ::Simple::ItkOption::information defaultgiven class itkoption
      2.4.28 ::Simple::ItkOption::information description class itkoption
      2.4.29 ::Simple::ItkOption::information monitortype class itkoption
      2.4.30 ::Simple::ItkOption::information resourceclass class itkoption
      2.4.31 ::Simple::ItkOption::information resourcename class itkoption
      2.4.32 ::Simple::ItkOption::information type class itkoption
   2.5 Errors
      2.5.1 ::Simple::Class::CONFIGBODY-FOR-NON-PUBLIC-ATTRIBUTE
      2.5.2 ::Simple::Class::CONFIGBODY-FOR-ARRAY-ATTRIBUTE
      2.5.3 ::Simple::Class::CLASS-COMMAND-CONSTRUCTOR-OR-DESTRUCTOR
      2.5.4 ::Simple::Class::CLASS-COMMAND-AND-METHOD-SHARE-BASE-COMMAND
      2.5.5 ::Simple::Class::SUBCOMMANDS-WITH-DIFFERENT-ACCESS
      2.5.6 ::Simple::Class::NON-EXISTING-ITKITEM
      2.5.7 ::Simple::Class::SUBMETHODS-WITH-DIFFERENT-ACCESS
      2.5.8 ::Simple::Class::SHALL-EXTEND-ITK-ARCHETYPE
      2.5.9 ::Simple::Class::MULTIPLE-OBJECTS-FOR-SINGLETON-CLASS
      2.5.10 ::Simple::Class::OBJECT-FOR-ABSTRACT-CLASS
      2.5.11 ::Simple::Class::PUBLIC-METHOD-WITH-BODY-FOR-ABSTRACT-CLASS
      2.5.12 ::Simple::Class::CONSTRUCTOR-OR-DESTRUCTOR-FOR-ABSTRACT-CLASS
      2.5.13 ::Simple::Class::VIRTUAL-METHOD-CALLED
      2.5.14 ::Simple::Class::UNDECLARED
3. Package further information
4. Package command details
   4.1 ::Simple::Class::cget ?-debug?
      4.1.1 Command description
      4.1.2 Command public API
   4.2 ::Simple::Class::configure ?-debug extbool?
      4.2.1 Command description
      4.2.2 Command public API
   4.3 declare-class class ?-version version? ?-project string? ?-synopsis string? ?-overview string? ?-usage string? ?-api string? ?-keywords list? ?-examples string? ?-classtype type? ?-stereotype choice? ?-extends qualifiedname-list? ?-debug extbool? ?-error declaration? ?-variable declaration? ?-attribute declaration? ?-itkoption declaration? ?-itkcomponent declaration? ?-command declaration? ?-method declaration? ?-assumptions string? ?-resources string? ?-limitations string? ?-effects string? ?-details string? ?-references string? ?-remarks string? ?-todo string? ?-history string? ?-copyright string? ?-body script?
      4.3.1 Command description
         4.3.1.1 Overview
         4.3.1.2 Examples
      4.3.2 Command public API
      4.3.3 Command further information
         4.3.3.1 Details
         4.3.3.2 References
         4.3.3.3 Remarks
   4.4 ::Simple::Class::delete class
      4.4.1 Command description
         4.4.1.1 Overview
      4.4.2 Command public API
      4.4.3 Command further information
         4.4.3.1 References
   4.5 ::Simple::Class::information aliases class
      4.5.1 Command description
      4.5.2 Command public API
      4.5.3 Command further information
         4.5.3.1 References
   4.6 ::Simple::Class::information api class
      4.6.1 Command description
         4.6.1.1 Overview
      4.6.2 Command public API
      4.6.3 Command further information
         4.6.3.1 References
         4.6.3.2 Remarks
   4.7 ::Simple::Class::information attributes class ?-access choice?
      4.7.1 Command description
      4.7.2 Command public API
   4.8 ::Simple::Class::information classes ?pattern?
      4.8.1 Command description
         4.8.1.1 Overview
      4.8.2 Command public API
      4.8.3 Command further information
         4.8.3.1 References
   4.9 ::Simple::Class::information commands class
      4.9.1 Command description
      4.9.2 Command public API
      4.9.3 Command further information
         4.9.3.1 References
         4.9.3.2 Remarks
   4.10 ::Simple::Class::information errors class
      4.10.1 Command description
      4.10.2 Command public API
   4.11 ::Simple::Class::information exists class
      4.11.1 Command description
      4.11.2 Command public API
   4.12 ::Simple::Class::information exportedcommands class
      4.12.1 Command description
      4.12.2 Command public API
      4.12.3 Command further information
         4.12.3.1 References
   4.13 ::Simple::Class::information itkcomponents class
      4.13.1 Command description
      4.13.2 Command public API
   4.14 ::Simple::Class::information itkoptions class
      4.14.1 Command description
      4.14.2 Command public API
   4.15 ::Simple::Class::information metadata class
      4.15.1 Command description
         4.15.1.1 Overview
      4.15.2 Command public API
   4.16 ::Simple::Class::information methods class
      4.16.1 Command description
      4.16.2 Command public API
      4.16.3 Command further information
         4.16.3.1 References
         4.16.3.2 Remarks
   4.17 ::Simple::Class::information objects ?-class name? ?-isa name? ?pattern?
      4.17.1 Command description
         4.17.1.1 Overview
      4.17.2 Command public API
      4.17.3 Command further information
         4.17.3.1 References
   4.18 ::Simple::Class::information variables class ?-access choice?
      4.18.1 Command description
      4.18.2 Command public API
   4.19 ::Simple::ItkComponent::information access class itkcomponent
      4.19.1 Command description
      4.19.2 Command public API
   4.20 ::Simple::ItkComponent::information description class itkcomponent
      4.20.1 Command description
      4.20.2 Command public API
   4.21 ::Simple::ItkComponent::information ignore class itkcomponent
      4.21.1 Command description
      4.21.2 Command public API
   4.22 ::Simple::ItkComponent::information keep class itkcomponent
      4.22.1 Command description
      4.22.2 Command public API
   4.23 ::Simple::ItkComponent::information rename class itkcomponent
      4.23.1 Command description
      4.23.2 Command public API
   4.24 ::Simple::ItkComponent::information resourceclass class itkcomponent
      4.24.1 Command description
      4.24.2 Command public API
   4.25 ::Simple::ItkOption::information choices class itkoption
      4.25.1 Command description
      4.25.2 Command public API
   4.26 ::Simple::ItkOption::information default class itkoption
      4.26.1 Command description
      4.26.2 Command public API
      4.26.3 Command further information
         4.26.3.1 References
   4.27 ::Simple::ItkOption::information defaultgiven class itkoption
      4.27.1 Command description
      4.27.2 Command public API
      4.27.3 Command further information
         4.27.3.1 References
   4.28 ::Simple::ItkOption::information description class itkoption
      4.28.1 Command description
      4.28.2 Command public API
   4.29 ::Simple::ItkOption::information monitortype class itkoption
      4.29.1 Command description
      4.29.2 Command public API
      4.29.3 Command further information
         4.29.3.1 References
   4.30 ::Simple::ItkOption::information resourceclass class itkoption
      4.30.1 Command description
      4.30.2 Command public API
   4.31 ::Simple::ItkOption::information resourcename class itkoption
      4.31.1 Command description
      4.31.2 Command public API
   4.32 ::Simple::ItkOption::information type class itkoption
      4.32.1 Command description
      4.32.2 Command public API

1. Package description

Synopsis: the Simple Development Library [incr Tcl] classes declaration.

Keywords: object oriented, class, method, [incr Tcl], [incr Tk], widget and megawidget.

1.1 Overview

This package provides a way to declare [incr Tcl] classes and [incr Tk] megawidgets in an homogeneous, easily parseable, fully introspectable way. It allows to substitute the comment block which is usually placed on top of each declaration by Tcl-handled text.

Classes are declared with a single command (declare-class). Every single component needed to either make the class work (such as its attributes or methods) or to document it (metadata, such as the class synopsis) is provided as arguments to that command. Components can be fully introspected, but metadata is only available if The Simple Development Library -storemetadata option is set when the class is declared.

Procedures are provided to declare and delete classes and get information about them.

1.2 Usage

Use declare-class to declare a class. Declared classes metadata can be obtained via the ::Simple::Class::information metadata procedure. Other subcommands of this procedure provide information about declared classes: exists, classes, objects, errors, exportedcommands, aliases, variables, attributes, itkoptions, itkcomponents, commands, methods and api. The ::Simple::ItkOption::information and ::Simple::ItkComponent::information procedures provide subcommand to quet information about the [incr Tk] options and components of an [incr Tk] megawidget, respectively.

Use ::Simple::Class::delete to delete the class.

1.3 Examples

1.4 History

Date Reason
22-mar-2003 Added -body to method declaration, version 0.5.1
15-jul-2003 Method declaration added to declare-class, version 0.5.2
20-jan-2004 Comments allowed before embedded declarations in declare-class, version 0.5.3
28-jan-2004 Added -itkoption and -itkcomponent to declare-class, version 0.5.4
26-oct-2004 Added -error to declare-class, version 0.5.5
04-apr-2005 Added debug method and -debug option, version 0.5.6
22-jun-2005 The Simple Development Library version 1.0

1.5 Copyright

Copyright (C) 1999-2005, Juan C. Gil (jgil@gmv.es).

2. Package public API

Paradigm: procedural.

Requisites: SimpleDeclare 1.0 and Itcl.

2.1 Types

None.

2.2 Options

2.2.1 -debug

Type: extbool.

Value: false.

Description: whether to create a %debug% debug method for every class.

2.3 Namespaces

  1. ::Simple::Class

  2. ::Simple::Class::Priv

  3. ::Simple::ItkOption

  4. ::Simple::ItkComponent

2.4 Commands

2.4.1 ::Simple::Class::cget ?-debug?

Synopsis: gets the package options.

Details: see section 4.1.

2.4.2 ::Simple::Class::configure ?-debug extbool?

Synopsis: configures the package options.

Details: see section 4.2.

2.4.3 declare-class class ?-version version? ?-project string? ?-synopsis string? ?-overview string? ?-usage string? ?-api string? ?-keywords list? ?-examples string? ?-classtype type? ?-stereotype choice? ?-extends qualifiedname-list? ?-debug extbool? ?-error declaration? ?-variable declaration? ?-attribute declaration? ?-itkoption declaration? ?-itkcomponent declaration? ?-command declaration? ?-method declaration? ?-assumptions string? ?-resources string? ?-limitations string? ?-effects string? ?-details string? ?-references string? ?-remarks string? ?-todo string? ?-history string? ?-copyright string? ?-body script?

Synopsis: declares a class.

Details: see section 4.3.

2.4.4 ::Simple::Class::delete class

Synopsis: deletes an [incr Tcl] class.

Details: see section 4.4.

2.4.5 ::Simple::Class::information aliases class

Synopsis: returns a class list of aliases.

Details: see section 4.5.

2.4.6 ::Simple::Class::information api class

Synopsis: returns a class public API signature.

Details: see section 4.6.

2.4.7 ::Simple::Class::information attributes class ?-access choice?

Synopsis: returns a class list of attributes matching the given access level.

Details: see section 4.7.

2.4.8 ::Simple::Class::information classes ?pattern?

Synopsis: returns the list of classes matching the pattern.

Details: see section 4.8.

2.4.9 ::Simple::Class::information commands class

Synopsis: returns a class current list of public and exported commands.

Details: see section 4.9.

2.4.10 ::Simple::Class::information errors class

Synopsis: returns a class list of errors.

Details: see section 4.10.

2.4.11 ::Simple::Class::information exists class

Synopsis: returns whether a class exists.

Details: see section 4.11.

2.4.12 ::Simple::Class::information exportedcommands class

Synopsis: returns a class list of exported commands.

Details: see section 4.12.

2.4.13 ::Simple::Class::information itkcomponents class

Synopsis: returns a class list of [incr Tk] components.

Details: see section 4.13.

2.4.14 ::Simple::Class::information itkoptions class

Synopsis: returns a class list of [incr Tk] options.

Details: see section 4.14.

2.4.15 ::Simple::Class::information metadata class

Synopsis: returns a class metadata.

Details: see section 4.15.

2.4.16 ::Simple::Class::information methods class

Synopsis: returns a class current list of public methods.

Details: see section 4.16.

2.4.17 ::Simple::Class::information objects ?-class name? ?-isa name? ?pattern?

Synopsis: returns the list of objects matching the pattern.

Details: see section 4.17.

2.4.18 ::Simple::Class::information variables class ?-access choice?

Synopsis: returns a class list of variables matching the given access level.

Details: see section 4.18.

2.4.19 ::Simple::ItkComponent::information access class itkcomponent

Synopsis: returns an [incr Tk] component access mode.

Details: see section 4.19.

2.4.20 ::Simple::ItkComponent::information description class itkcomponent

Synopsis: returns an [incr Tk] component description.

Details: see section 4.20.

2.4.21 ::Simple::ItkComponent::information ignore class itkcomponent

Synopsis: returns an [incr Tk] component list of ignored options.

Details: see section 4.21.

2.4.22 ::Simple::ItkComponent::information keep class itkcomponent

Synopsis: returns an [incr Tk] component list of kept options.

Details: see section 4.22.

2.4.23 ::Simple::ItkComponent::information rename class itkcomponent

Synopsis: returns an [incr Tk] component list of renamed options.

Details: see section 4.23.

2.4.24 ::Simple::ItkComponent::information resourceclass class itkcomponent

Synopsis: returns an [incr Tk] component resource class.

Details: see section 4.24.

2.4.25 ::Simple::ItkOption::information choices class itkoption

Synopsis: returns an [incr Tk] option choices.

Details: see section 4.25.

2.4.26 ::Simple::ItkOption::information default class itkoption

Synopsis: returns an [incr Tk] option default value.

Details: see section 4.26.

2.4.27 ::Simple::ItkOption::information defaultgiven class itkoption

Synopsis: returns whether an [incr Tk] option has a default value.

Details: see section 4.27.

2.4.28 ::Simple::ItkOption::information description class itkoption

Synopsis: returns an [incr Tk] option description.

Details: see section 4.28.

2.4.29 ::Simple::ItkOption::information monitortype class itkoption

Synopsis: returns whether an [incr Tk] option is being monitored.

Details: see section 4.29.

2.4.30 ::Simple::ItkOption::information resourceclass class itkoption

Synopsis: returns an [incr Tk] option resource class.

Details: see section 4.30.

2.4.31 ::Simple::ItkOption::information resourcename class itkoption

Synopsis: returns an [incr Tk] option resource name.

Details: see section 4.31.

2.4.32 ::Simple::ItkOption::information type class itkoption

Synopsis: returns an [incr Tk] option type.

Details: see section 4.32.

2.5 Errors

2.5.1 ::Simple::Class::CONFIGBODY-FOR-NON-PUBLIC-ATTRIBUTE

Message: -configbody given for non-public attribute "attribute".

Explanation: the declaration of attribute attribute failed because "-configbody" was provided for a non-public attribute, but that is not allowed.

Corrective action: either remove the "-configbody" or make the attribute public.

2.5.2 ::Simple::Class::CONFIGBODY-FOR-ARRAY-ATTRIBUTE

Message: -configbody given for array attribute "attribute".

Explanation: the declaration of attribute attribute failed because "-configbody" was provided for an attribute whose type is a derived array type, but that is not allowed.

Corrective action: either remove the "-configbody" or change the attribute type.

2.5.3 ::Simple::Class::CLASS-COMMAND-CONSTRUCTOR-OR-DESTRUCTOR

Message: class commands can not be named "constructor or destructor".

Explanation: the declaration of a class failed because class command constructor or destructor is named "constructor" or "destructor", but that is not allowed.

Corrective action: use a different name for the class command.

2.5.4 ::Simple::Class::CLASS-COMMAND-AND-METHOD-SHARE-BASE-COMMAND

Message: class command and method share the same base command "base command".

Explanation: the declaration of a class failed because a class command and a method are both subcommands sharing the same base command base command, but that is not allowed.

Corrective action: use different base commands for class commands and methods.

2.5.5 ::Simple::Class::SUBCOMMANDS-WITH-DIFFERENT-ACCESS

Message: class subcommands "class subcommand 1" and "class cubcommand 2" have different access modes.

Explanation: the declaration of a class failed because two class subcommands (class subcommand 1 and class cubcommand 2) corresponding to the same base command have different access modes, but that is not allowed.

Corrective action: declare all subcommands for a given base command with the same access mode.

2.5.6 ::Simple::Class::NON-EXISTING-ITKITEM

Message: class "class" doesn't have an option or a component "bad [incr Tk] option".

Explanation: class class does not have an option or a component named bad [incr Tk] option.

2.5.7 ::Simple::Class::SUBMETHODS-WITH-DIFFERENT-ACCESS

Message: submethods "class" and "submethod 1" of class "submethod 2" have different access modes.

Explanation: the declaration of class class failed because two class submethods (submethod 1 and submethod 2) corresponding to the same base method have different access modes, but that is not allowed.

Corrective action: declare all submethods for a given base method with the same access mode.

2.5.8 ::Simple::Class::SHALL-EXTEND-ITK-ARCHETYPE

Message: class class with option or component shall extend ::itk::Archetype.

Explanation: class class is a megawidget because it has an [incr Tk] option or component, and so shall extend ::itk::Archetype. Notice that ::itk::Widget and ::itk::Toplevel already extend ::itk::Archetype.

2.5.9 ::Simple::Class::MULTIPLE-OBJECTS-FOR-SINGLETON-CLASS

Message: multiple objects for singleton class "class".

Explanation: more than one object is being created for singleton class class, but that is not allowed.

2.5.10 ::Simple::Class::OBJECT-FOR-ABSTRACT-CLASS

Message: object for abstract class "class".

Explanation: an object for abstrac class class is being created, but that is not allowed.

2.5.11 ::Simple::Class::PUBLIC-METHOD-WITH-BODY-FOR-ABSTRACT-CLASS

Message: public method "method" with body for abstract class "class".

Explanation: a public method method with body is being declared for abstract class class, but that is not allowed.

2.5.12 ::Simple::Class::CONSTRUCTOR-OR-DESTRUCTOR-FOR-ABSTRACT-CLASS

Message: constructor or destructor for abstract class "class".

Explanation: a constructor or destructor has been provided for abstract class class, but that is not allowed.

2.5.13 ::Simple::Class::VIRTUAL-METHOD-CALLED

Message: virtual method "method" called.

Explanation: a virtual method method (an abstract class method with no body) has been called, usually from a derived class.

Corrective action: provide an implementation for the method in the derived class.

2.5.14 ::Simple::Class::UNDECLARED

Message: undeclared class "class".

Explanation: class class is undeclared, but a declared class is required.

3. Package further information

None.

4. Package command details

4.1 ::Simple::Class::cget ?-debug?

4.1.1 Command description

Synopsis: gets the package options.

Access mode: public.

4.1.2 Command public API

Arguments: (flag parsing disabled)

Argument Type Default value/ choices Description
-debug boolflag (n/a) Gets whether to create a debug method for every class

Returns: the requested option value or the whole list of options if none specified.

4.2 ::Simple::Class::configure ?-debug extbool?

4.2.1 Command description

Synopsis: configures the package options.

Access mode: public.

4.2.2 Command public API

Arguments: (flag parsing disabled)

Argument Type Default value/ choices Description
?-debug? extbool false Whether to create a debug method for every class

Returns: the empty string.

4.3 declare-class class ?-version version? ?-project string? ?-synopsis string? ?-overview string? ?-usage string? ?-api string? ?-keywords list? ?-examples string? ?-classtype type? ?-stereotype choice? ?-extends qualifiedname-list? ?-debug extbool? ?-error declaration? ?-variable declaration? ?-attribute declaration? ?-itkoption declaration? ?-itkcomponent declaration? ?-command declaration? ?-method declaration? ?-assumptions string? ?-resources string? ?-limitations string? ?-effects string? ?-details string? ?-references string? ?-remarks string? ?-todo string? ?-history string? ?-copyright string? ?-body script?

(Exported from ::Simple::Class).

4.3.1 Command description

Synopsis: declares a class.

Access mode: exported.

4.3.1.1 Overview

This procedure provides a way to declare [incr Tcl] classes and [incr Tk] megawidgets.

The -synopsis flag is mandatory.

The -classtype flag specifies a type whose allowed values are objects of the class. This type can then be used whenever a type is required, such as for the arguments of another class commands or methods.

The -stereotype flag specifies the class stereotype among one of multiobject (the default), abstract or singleton. Multiobject classes support an arbitrary number of objects. Abstract classes support no objects (they are intended to be extended). Finally, singleton classes can be instantiated just once.

The -extends flag specifies the list of classes from which this one inherits.

The -variable flag allows to create class variables (class variables in object-oriented parlance; common variables for [incr Tcl]). Its argument is a variable declaration intended to be the arguments of a call to ::Simple::Variable::declare, except for the added argument -access, whose value must be one of public (the default), protected or private; this argument specifies the variable access mode. This flag can be given multiple times.

The -attribute flag allows to create class attributes (class instance variables in object-oriented parlance; variables for [incr Tcl]). Its argument is an attribute declaration intended to be the arguments of a call to ::Simple::Variable::declare, except for the added argument -access, equivalent to that for class variables, and -configbody, valid for public attributes only, used to specify the attribute configuration script (see the configbody [incr Tcl] command). This flag can be given multiple times.

The -error flag allows to declare class errors. Its argument is an error declaration intended to be the arguments of a call to ::Simple::Error::declare. This flag can be given multiple times.

The -command flag allows to declare class commands (class or static functions in object-oriented parlance; common procedures for [incr Tcl]). Its argument is a command declaration intended to be the arguments of a call to ::Simple::Declare::declare-proc, except for the added argument -access, whose value must be one of public (the default), private, or exported; this argument specifies the command access mode. This flag can be given multiple times.

The -method flag allows to declare class methods (class instance functions or methods in object-oriented parlance; methods for [incr Tcl]). Its argument is a method declaration intended to be the arguments of a call to ::Simple::Declare::declare-proc, except for the fact that -alias is not allowed for methods, and the added argument -access, whose value must be one of public (the default), protected or private; this argument specifies the method access mode. This flag can be given multiple times.

If the method name is constructor, it corresponds to the class constructor. In this case, -synopsis is not allowed (it is hardcoded to "Class constructor"), and the added argument -init, the script used invoke base class constructors, can be specified.

If the method name is destructor, it corresponds to the class destructor. In this case, -synopsis is not allowed (it is hardcoded to "Class destructor"). The destructor default access mode is "private".

The -body flag specifies the class body, a script evaluated when the class is declared.

The -debug flag allows to override the package option of the same name for the class being declared. This option controls whether to create a %debug% debug method. This method has a single argument: a script which gets evaluated in the object scope.

The -itkoption and -itkcomponent flags provide support for the definition of [incr Tk] megawidgets as follows.

The -itkoption flag allows to create options for [incr Tk] megawidgets. Its argument is an [incr Tk] option declaration intended to be the arguments of a call to ::Simple::Variable::declare, except for the added argument -configbody, equivalent to that for attributes, and -resourcename and -resourceclass: see the itk_option define [incr Tk] command. This flag can be given multiple times.

The -itkcomponent flag allows to create components for [incr Tk] megawidgets. Its argument is an [incr Tk] component declaration which shall start by the component name and be followed by the following optional flags (see the itk_component add [incr Tk] command):

The usual command within the itk_component add [incr Tk] command is not supported. The -itkcomponents flag can be given multiple times.

All other arguments are metadata, and are stored or ignored depending on whether The Simple Development Library -storemetadata option is set when the class is declared, but for the -api and -body flags which are never stored.

4.3.1.2 Examples

4.3.2 Command public API

Arguments: (flag parsing disabled)

Argument Type Default value/ choices Description
class name (n/a) Class name
?-version? version 1.0 Class version
?-project? string (empty string) Class project
?-synopsis? string (empty string) Class synopsis
?-overview? string (empty string) Class overview
?-usage? string (empty string) Class usage message
?-api? string (empty string) Class API
?-keywords? list (empty string) Class keywords
?-examples? string (empty string) Class usage examples
?-classtype? type (n/a) Class type name
?-stereotype? choice multiobject, abstract or singleton Class stereotype
?-extends? qualifiedname-list (empty string) List of classes from which this one inherits
?-debug? extbool false Whether to create a debug method
?-error? declaration (empty string) Class error declaration
?-variable? declaration (empty string) Class variable declaration
?-attribute? declaration (empty string) Class attribute declaration
?-itkoption? declaration (empty string) [incr Tk] option declaration
?-itkcomponent? declaration (empty string) [incr Tk] component declaration
?-command? declaration (empty string) Class command declaration
?-method? declaration (empty string) Class method declaration
?-assumptions? string (empty string) Class assumptions
?-resources? string (empty string) Class required resources
?-limitations? string (empty string) Class limitations
?-effects? string (empty string) Class effects
?-details? string (empty string) Class implementation details
?-references? string (empty string) Class references
?-remarks? string (empty string) Class remarks
?-todo? string (empty string) Class to do list
?-history? string (empty string) Class history
?-copyright? string (empty string) Class copyright notice
?-body? script (empty string) Class body

Returns: the empty string.

Effects:

4.3.3 Command further information

4.3.3.1 Details

4.3.3.2 References

4.3.3.3 Remarks

4.4 ::Simple::Class::delete class

4.4.1 Command description

Synopsis: deletes an [incr Tcl] class.

Access mode: public.

4.4.1.1 Overview

This procedure deletes the given class together with its class type, if any.

4.4.2 Command public API

Arguments:

Argument Type Default value/ choices Description
class name (n/a) Class name

Returns: the empty string.

Effects:

4.4.3 Command further information

4.4.3.1 References

4.5 ::Simple::Class::information aliases class

4.5.1 Command description

Synopsis: returns a class list of aliases.

Access mode: public.

4.5.2 Command public API

Arguments:

Argument Type Default value/ choices Description
class name (n/a) Class name

Returns: the class list of aliases.

4.5.3 Command further information

4.5.3.1 References

4.6 ::Simple::Class::information api class

4.6.1 Command description

Synopsis: returns a class public API signature.

Access mode: public.

4.6.1.1 Overview

This procedure returns a string containing a class public API signatures.

The class public and exported commands are included, as well as the public constructor, public destructor and public methods.

4.6.2 Command public API

Arguments:

Argument Type Default value/ choices Description
class name (n/a) Class name

Returns: the given class public API signatures as follows:

4.6.3 Command further information

4.6.3.1 References

4.6.3.2 Remarks

4.7 ::Simple::Class::information attributes class ?-access choice?

4.7.1 Command description

Synopsis: returns a class list of attributes matching the given access level.

Access mode: public.

4.7.2 Command public API

Arguments:

Argument Type Default value/ choices Description
class name (n/a) Class name
?-access? choice public, protected or private Attributes access mode

Returns: the class list of attributes matching the given access level.

4.8 ::Simple::Class::information classes ?pattern?

4.8.1 Command description

Synopsis: returns the list of classes matching the pattern.

Access mode: public.

4.8.1.1 Overview

This procedure wraps the ::itcl::find classes [incr Tcl] command. The following is an excerpt from that command manual page:

This procedure returns a list of classes. Classes in the current namespace are listed first, followed by classes in all other namespaces in the interpreter. If the optional pattern is specified, then only those classes whose name match the pattern are returned.

If a class resides in the current namespace context, this command reports its unqualified. However, if the pattern contains namespace qualifiers, or if the class resides in another context, this command reports its qualified name.

4.8.2 Command public API

Arguments:

Argument Type Default value/ choices Description
?pattern? pattern (empty string) Pattern

Returns: the list of classes matching the pattern.

4.8.3 Command further information

4.8.3.1 References

4.9 ::Simple::Class::information commands class

4.9.1 Command description

Synopsis: returns a class current list of public and exported commands.

Access mode: public.

4.9.2 Command public API

Arguments:

Argument Type Default value/ choices Description
class name (n/a) Class name

Returns: the class current list of public and exported commands.

4.9.3 Command further information

4.9.3.1 References

4.9.3.2 Remarks

4.10 ::Simple::Class::information errors class

4.10.1 Command description

Synopsis: returns a class list of errors.

Access mode: public.

4.10.2 Command public API

Arguments:

Argument Type Default value/ choices Description
class name (n/a) Class name

Returns: the class list of errors.

4.11 ::Simple::Class::information exists class

4.11.1 Command description

Synopsis: returns whether a class exists.

Access mode: public.

4.11.2 Command public API

Arguments:

Argument Type Default value/ choices Description
class name (n/a) Class name

Returns: whether the given class exists.

4.12 ::Simple::Class::information exportedcommands class

4.12.1 Command description

Synopsis: returns a class list of exported commands.

Access mode: public.

4.12.2 Command public API

Arguments:

Argument Type Default value/ choices Description
class name (n/a) Class name

Returns: the class list of exported commands.

4.12.3 Command further information

4.12.3.1 References

4.13 ::Simple::Class::information itkcomponents class

4.13.1 Command description

Synopsis: returns a class list of [incr Tk] components.

Access mode: public.

4.13.2 Command public API

Arguments:

Argument Type Default value/ choices Description
class name (n/a) Class name

Returns: the class list of [incr Tk] components.

4.14 ::Simple::Class::information itkoptions class

4.14.1 Command description

Synopsis: returns a class list of [incr Tk] options.

Access mode: public.

4.14.2 Command public API

Arguments:

Argument Type Default value/ choices Description
class name (n/a) Class name

Returns: the class list of [incr Tk] options.

4.15 ::Simple::Class::information metadata class

4.15.1 Command description

Synopsis: returns a class metadata.

Access mode: public.

4.15.1.1 Overview

This procedure returns a list of pairs suitable to be given as argument to the array set command. Each element is one of the flags given to declare-class upon class declaration (with no hypen), but for the -api and -body flags (which are not stored), and the item declarations (-error, -variable, -attribute, -itkoption, -itkcomponent, -command and -method); these are obtained using the corresponding ::Simple::Class::information subcommand.

Thus, the actual list of flags is: -version, -project, -synopsis, -overview, -usage, -keywords, -examples, -classtype, -stereotype, -extends, -assumptions, -resources, -limitations, -effects, -details, -references, -remarks, -todo, -history and -copyright.

Notice that no data is returned unless The Simple Development Library -storemetadata option is set when the class is declared.

If a particular flag was not given in the class declaration, the empty string is returned as that flag contents.

4.15.2 Command public API

Arguments:

Argument Type Default value/ choices Description
class name (n/a) Class name

Returns: the class metadata as an item/contents pairs list.

4.16 ::Simple::Class::information methods class

4.16.1 Command description

Synopsis: returns a class current list of public methods.

Access mode: public.

4.16.2 Command public API

Arguments:

Argument Type Default value/ choices Description
class name (n/a) Class name

Returns: the class current list of public methods.

4.16.3 Command further information

4.16.3.1 References

4.16.3.2 Remarks

4.17 ::Simple::Class::information objects ?-class name? ?-isa name? ?pattern?

4.17.1 Command description

Synopsis: returns the list of objects matching the pattern.

Access mode: public.

4.17.1.1 Overview

This procedure wraps the ::itcl::find classes [incr Tcl] command. The order of the arguments is different due to a limitation in The Simple Development Library (and Tcl) which forces the optional arguments to be the last ones. The following is an excerpt from that command manual page:

This procedure returns a list of objects. Objects in the current namespace are listed first, followed by objects in all other namespaces in the interpreter. If the optional pattern is specified, then only those objects whose name match the pattern are returned.

If the optional -class flag is given, this list is restricted to objects whose most-specific class is the one given as parameter to that flag. If the -isa flag is given, this list is further restricted to objects having the class given as paramter to that flag anywhere in their heritage.

If an object resides in the current namespace context, this command reports its unqualified name. However, if the pattern contains namespace qualifiers, or if the object resides in another context, this command reports its fully-qualified name.

4.17.2 Command public API

Arguments:

Argument Type Default value/ choices Description
?-class? name (n/a) Class name
?-isa? name (n/a) Base class name
?pattern? pattern (empty string) Pattern

Returns: the list of objects matching the pattern.

4.17.3 Command further information

4.17.3.1 References

4.18 ::Simple::Class::information variables class ?-access choice?

4.18.1 Command description

Synopsis: returns a class list of variables matching the given access level.

Access mode: public.

4.18.2 Command public API

Arguments:

Argument Type Default value/ choices Description
class name (n/a) Class name
?-access? choice public, protected or private Variables access mode

Returns: the class list of variables matching the given access level.

4.19 ::Simple::ItkComponent::information access class itkcomponent

4.19.1 Command description

Synopsis: returns an [incr Tk] component access mode.

Access mode: public.

4.19.2 Command public API

Arguments:

Argument Type Default value/ choices Description
class name (n/a) Class name
itkcomponent unqualifiedname (n/a) [incr Tk] component

Returns: the [incr Tk] component access mode.

4.20 ::Simple::ItkComponent::information description class itkcomponent

4.20.1 Command description

Synopsis: returns an [incr Tk] component description.

Access mode: public.

4.20.2 Command public API

Arguments:

Argument Type Default value/ choices Description
class name (n/a) Class name
itkcomponent unqualifiedname (n/a) [incr Tk] component

Returns: the [incr Tk] component description.

4.21 ::Simple::ItkComponent::information ignore class itkcomponent

4.21.1 Command description

Synopsis: returns an [incr Tk] component list of ignored options.

Access mode: public.

4.21.2 Command public API

Arguments:

Argument Type Default value/ choices Description
class name (n/a) Class name
itkcomponent unqualifiedname (n/a) [incr Tk] component

Returns: the [incr Tk] component list of ignored options.

4.22 ::Simple::ItkComponent::information keep class itkcomponent

4.22.1 Command description

Synopsis: returns an [incr Tk] component list of kept options.

Access mode: public.

4.22.2 Command public API

Arguments:

Argument Type Default value/ choices Description
class name (n/a) Class name
itkcomponent unqualifiedname (n/a) [incr Tk] component

Returns: the [incr Tk] component list of kept options.

4.23 ::Simple::ItkComponent::information rename class itkcomponent

4.23.1 Command description

Synopsis: returns an [incr Tk] component list of renamed options.

Access mode: public.

4.23.2 Command public API

Arguments:

Argument Type Default value/ choices Description
class name (n/a) Class name
itkcomponent unqualifiedname (n/a) [incr Tk] component

Returns: the [incr Tk] component list of renamed options.

4.24 ::Simple::ItkComponent::information resourceclass class itkcomponent

4.24.1 Command description

Synopsis: returns an [incr Tk] component resource class.

Access mode: public.

4.24.2 Command public API

Arguments:

Argument Type Default value/ choices Description
class name (n/a) Class name
itkcomponent unqualifiedname (n/a) [incr Tk] component

Returns: the [incr Tk] component resource class.

4.25 ::Simple::ItkOption::information choices class itkoption

4.25.1 Command description

Synopsis: returns an [incr Tk] option choices.

Access mode: public.

4.25.2 Command public API

Arguments:

Argument Type Default value/ choices Description
class name (n/a) Class name
itkoption flag (n/a) [incr Tk] option

Returns: the [incr Tk] option choices.

4.26 ::Simple::ItkOption::information default class itkoption

4.26.1 Command description

Synopsis: returns an [incr Tk] option default value.

Access mode: public.

4.26.2 Command public API

Arguments:

Argument Type Default value/ choices Description
class name (n/a) Class name
itkoption flag (n/a) [incr Tk] option

Returns: the [incr Tk] option default value.

4.26.3 Command further information

4.26.3.1 References

4.27 ::Simple::ItkOption::information defaultgiven class itkoption

4.27.1 Command description

Synopsis: returns whether an [incr Tk] option has a default value.

Access mode: public.

4.27.2 Command public API

Arguments:

Argument Type Default value/ choices Description
class name (n/a) Class name
itkoption flag (n/a) [incr Tk] option

Returns: whether the [incr Tk] option has a default value.

4.27.3 Command further information

4.27.3.1 References

4.28 ::Simple::ItkOption::information description class itkoption

4.28.1 Command description

Synopsis: returns an [incr Tk] option description.

Access mode: public.

4.28.2 Command public API

Arguments:

Argument Type Default value/ choices Description
class name (n/a) Class name
itkoption flag (n/a) [incr Tk] option

Returns: the [incr Tk] option description.

4.29 ::Simple::ItkOption::information monitortype class itkoption

4.29.1 Command description

Synopsis: returns whether an [incr Tk] option is being monitored.

Access mode: public.

4.29.2 Command public API

Arguments:

Argument Type Default value/ choices Description
class name (n/a) Class name
itkoption flag (n/a) [incr Tk] option

Returns: whether an [incr Tk] option is being monitored.

4.29.3 Command further information

4.29.3.1 References

4.30 ::Simple::ItkOption::information resourceclass class itkoption

4.30.1 Command description

Synopsis: returns an [incr Tk] option resource class.

Access mode: public.

4.30.2 Command public API

Arguments:

Argument Type Default value/ choices Description
class name (n/a) Class name
itkoption flag (n/a) [incr Tk] option

Returns: the [incr Tk] option resource class.

4.31 ::Simple::ItkOption::information resourcename class itkoption

4.31.1 Command description

Synopsis: returns an [incr Tk] option resource name.

Access mode: public.

4.31.2 Command public API

Arguments:

Argument Type Default value/ choices Description
class name (n/a) Class name
itkoption flag (n/a) [incr Tk] option

Returns: the [incr Tk] option resource name.

4.32 ::Simple::ItkOption::information type class itkoption

4.32.1 Command description

Synopsis: returns an [incr Tk] option type.

Access mode: public.

4.32.2 Command public API

Arguments:

Argument Type Default value/ choices Description
class name (n/a) Class name
itkoption flag (n/a) [incr Tk] option

Returns: the [incr Tk] option type.