gmplClassStatement
- Mark Juras
Owned by Mark Juras
Class Statement Summary
Class is a terminal or nonterminal declaration statement that occurs primarily in reference scripts. It is also a metalanguage statement that is used to define not only classes in the source language VB6, but also classes in the gmBasic languages themselves. The terminal form of the Class statement is used to deal with the forward reference problems in library declarations. It is often the case that a component in one class has the type of another type defining component that has not yet been defined. Rather than trying to sort the definitions into a "reference" order, gmBasic. when it authors the declarations, adds a set of terminal Class statements to the front of the library declaration with only the Id attribute specified. The later Class statements with the same Id then specify the remaining attributes and substatements. The attributes of the Class statement are as follows:Attribute | Description |
Id | This attribute is the identifier of the class. It must be unique with the scope of the library containing the class. The identifier is not case-sensitive. This attribute must be specified on all declarations, be they terminal or nonterminal. |
Parent | This attribute is the identifier of the parent class of the class being declared. If omitted the class has no direct parent within the library. |
Default | This attribute is the identifier of some property or method within the class that is the "default". This is usually a property but may be an accessor or even a method. The default component allows the source code to reference class instances in singleton form -- i.e., not followed by ".member" -- in value contexts. These references are then assumed to be "instance.default" if a default was specified. |
MigName | This attribute supplies the name to be used for the class in the target translations. |
MigStatus | This attribute is a MigStatus attribute as discussed on the Declaration page. It contains generalized migration settings for the component. |
Creatable | This is an On/Off flag attribute. The Off setting sets the Noncreatable status flag On. It means that the component class objects cannot be created. When declaring objects of this class simply NULL them as opposed to using new to create an instance. |
Role | This attribute contains an optional keyword describing the overall role of the class: Unknown, Property, Method, Define, Utility, Command, Constant, Function, Event, Control, Collection, Resource, Index, or Migclass. The default is None. |
Casttype | This is an On/Off flag attribute. The Off setting sets the Casttype status flag On. This means that the class does not require type casts when setting its values. |
AppObject | This identifier attribute sets the AppObject status flag on and stores the identifier in the description table of the class. It means that the class has an application wide singleton object which requires that special AppObject code be authored for it. |
Static | This is a deprecated On/Off flag attribute. The On setting sets the External status flag On. It has been replaced by the External attribute. |
Canbenull | This is an On/Off flag attribute. The On setting sets the Canbenull status flag On. This means that when instances of this class are being for checked for empty, they must be checked for Null as well. |
Module | This is an On/Off flag attribute. The On setting sets the Module status flag On. This means that is was a module in VB6 as opposed to a class or Form, so its members may be referenced as singletons. |
Opcode | This identifier attribute is only used for metalanguage classes. It is the identifier of the operation code in the intermediate language that the members of this class emit. |
Vectorsize | This integer attribute is only used for metalanguage classes that are declaring gmSL object structures. It specifies the size of the structure associated with the object type. |
Interfaces | This attribute is a comma-delimited string of class identifiers that list the components that are implemented by the class being declared. |
Implemented | This is an On/Off flag attribute. The On setting sets the Implemented status flag On. It means the that class is implemented by another class in the current migration group. |
External | This is an On/Off flag attribute. The On setting sets the External status flag On. This means that the class is external to the library in the target implementation to which it was assigned in the source implementation. Therefore, when authoring the identifier of the class do not precede it with its source parent membership information. |
NetName | This identifier supplies a second name to be used for the class in the target translations. It allows the logic associated with generating migration support code to support multiple NameSpaces. |
The declarations within the Class statement are as follows:
Substatement | Description |
Property | Declares a property within a class |
Field | Declares a property in a class whose origin was a class variable as opposed to a property. |
Method | Declares a method within a class |
Accessor | Declares a property that with both set and get access that has arguments. |
Event | Declares a event within a class |
Constant | Declares a constant within a class |
Enumeration | Declares an enumeration within a class |
Structure | Declares a structure within a class |
Attribute | Declares an attribute within a metalanguage class |
The script errors associated with the Class statement are as follows:
Error | Description |
1048 | Class command missing required id attribute. |
1049 | Unable to store CLASS INTERFACE vector: %1d |
1050 | Unable to find parent CLASS: %1d |
1051 | The role keyword [%1d] is not recognized. |
1052 | The opcode cannot be found. |
1053 | Encountered following when expecting class component: %1d |
1054 | The default property [%1d] cannot be located. |
Table of Contents