ClassItem(ClassIndex: Integer): IForeClass;
ClassIndex. Index of structure implemented in assembly. The index value is specified in the [0, ClassesCount-1] range.
The ClassItem method returns information about assembly structure with the specified index.
Executing the example requires that the repository contains an assembly with the ASSM_TEST identifier. The assembly implements classes, interfaces, or enumerations.
Add links to the Fore, Metabase, and Xml system assemblies.
Sub UserProc;
Var
ForeService: IForeServices;
Runtime: IForeRuntime;
Assm: IForeAssembly;
FClass: IForeClass;
i, j: Integer;
Begin
ForeService := MetabaseClass.Active As IForeServices;
Runtime := ForeService.GetRuntime;
//Load assembly
Assm := Runtime.BindToAssembly("ASSM_TEST");
//Get information about interfaces, classes, enumerations
j := Assm.ClassesCount - 1;
For i := 0 To j Do
FClass := Assm.ClassItem(i);
Select Case FClass.ClassType
Case ForeClassType.Class_: Debug.Write("Class: ");
Case ForeClassType.Interface_: Debug.Write("Interface: ");
Case ForeClassType.Enum_: Debug.Write("Enumeration: ");
End Select;
Debug.Write(FClass.Name);
Debug.Write("; Access modifier: ");
Select Case FClass.ClassAccessSpecificatorKind
Case AccessSpecificatorKind.Public_: Debug.WriteLine("Public");
Case AccessSpecificatorKind.Private_: Debug.WriteLine("Private");
Case AccessSpecificatorKind.Protected_: Debug.WriteLine("Protected");
Case AccessSpecificatorKind.Friend_: Debug.WriteLine("Friend");
Case AccessSpecificatorKind.ProtectedFriend: Debug.WriteLine("ProtectedFriend");
End Select;
If FClass.XMLDocumentation <> Null Then
Debug.WriteLine("Comments:");
Debug.Indent;
PrintXml(FClass.XMLDocumentation);
Debug.Unindent;
End If;
If FClass.ParentName <> "" Then
Debug.WriteLine("Parent class/interface: " + FClass.ParentName);
End If;
End For;
End Sub UserProc;
Sub PrintXml(_doc: IXmlDomDocument);
Var
_nodes: IXmlDomNodeList;
_node: IXmlDomNode;
_elem: IXmlDomElement;
Begin
_elem := _doc.documentElement;
Debug.WriteLine("Root node: " + _elem.nodeName);
_nodes := _elem.childNodes;
Debug.WriteLine("Root child count: " + _nodes.length.ToString);
Debug.WriteLine("Nodes: ");
Debug.Indent;
_node := _nodes.nextNode;
While _node <> Null Do
Debug.WriteLine("Name: " + _node.nodeName + ", Text: " + _node.text);
_node := _nodes.nextNode;
End While;
Debug.Unindent;
End Sub PrintXml;
On executing the example, the repository assembly with the specified identifier will be loaded to the execution environment. The development environment console will display information about structures implemented in this assembly.
See also: