Skip to content

gmplClassStatement

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:

AttributeDescription
IdThis 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.
ParentThis attribute is the identifier of the parent class of the class being declared. If omitted the
class has no direct parent within the library.
DefaultThis 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.
MigNameThis attribute supplies the name to be used for the class in the target translations.
MigStatusThis attribute is a MigStatus attribute as discussed on the Declaration page. It
contains generalized migration settings for the component.
CreatableThis 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.
RoleThis 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.
CasttypeThis 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.
AppObjectThis 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.
StaticThis is a deprecated On/Off flag attribute. The On setting sets the External status
flag On. It has been replaced by the External attribute.
CanbenullThis 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.
ModuleThis 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.
OpcodeThis 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.
VectorsizeThis 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.
InterfacesThis attribute is a comma-delimited string of class identifiers that list the components that are implemented
by the class being declared.
ImplementedThis 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.
ExternalThis 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.
NetNameThis 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:

SubstatementDescription
PropertyDeclares a property within a class
FieldDeclares a property in a class whose origin was a class variable as opposed to a property.
MethodDeclares a method within a class
AccessorDeclares a property that with both set and get access that has arguments.
EventDeclares a event within a class
ConstantDeclares a constant within a class
EnumerationDeclares an enumeration within a class
StructureDeclares a structure within a class
AttributeDeclares an attribute within a metalanguage class

The script errors associated with the Class statement are as follows:

ErrorDescription
1048Class command missing required id attribute.
1049Unable to store CLASS INTERFACE vector: %1d
1050Unable to find parent CLASS: %1d
1051The role keyword [%1d] is not recognized.
1052The opcode cannot be found.
1053Encountered following when expecting class component: %1d
1054The default property [%1d] cannot be located.