SubItem(SubIndex: Integer): IForeSub;
SubItem(SubIndex: Integer): Prognoz.Platform.Interop.Fore.IForeSub;
SubIndex. Procedure/function index. The index value is specified in the [0, SubsCount-1] range.
The SubItem method returns information about procedure/function with the specified index.
Executing the example requires that repository contains an assembly with the ASSM_TEST identifier.
Add a link to the Fore, Metabase system assembly.
Sub UserProc;
Var
ForeService: IForeServices;
Runtime: IForeRuntime;
Assm: IForeAssembly;
FSub: IForeSub;
i, j: Integer;
Begin
ForeService := MetabaseClass.Active As IForeServices;
Runtime := ForeService.GetRuntime;
//Load assembly
Runtime.LoadAssembly("ASSM_TEST");
Assm := Runtime.BindToAssembly("ASSM_TEST");
//Get information about procedures/functions implemented in assembly global namesapce
j := Assm.SubsCount - 1;
For i := 0 To j Do
FSub := Assm.SubItem(i);
If FSub.IsResult Then
Debug.Write("Function: ");
Else
Debug.Write("Procedure: ");
End If;
Debug.Write(FSub.Name);
Debug.Write("; Access modifier: ");
Select Case FSub.SubAccessSpecificatorKind
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;
End For;
End Sub UserProc;
Imports Prognoz.Platform.Interop.Fore;
Imports Prognoz.Platform.Interop.Metabase;
Public Shared Sub Main(Params: StartParams);
Var
ForeService: IForeServices;
Runtime: IForeRuntime;
Assm: IForeAssembly;
FSub: IForeSub;
i, j: Integer;
Begin
ForeService := Params.Metabase As IForeServices;
Runtime := ForeService.GetRuntime();
//Load assembly
Runtime.LoadAssembly("ASSM_TEST");
Assm := Runtime.BindToAssembly("ASSM_TEST");
//Get information about procedures/functions implemented in assembly global namesapce
j := Assm.SubsCount() - 1;
For i := 0 To j Do
FSub := Assm.SubItem(i);
If FSub.IsResult Then
System.Diagnostics.Debug.Write("Function: ");
Else
System.Diagnostics.Debug.Write("Procedure: ");
End If;
System.Diagnostics.Debug.Write(FSub.Name);
System.Diagnostics.Debug.Write("; Access modifier: ");
Select Case FSub.SubAccessSpecificatorKind
Case AccessSpecificatorKind.ackPublic: System.Diagnostics.Debug.WriteLine("Public");
Case AccessSpecificatorKind.ackPrivate: System.Diagnostics.Debug.WriteLine("Private");
Case AccessSpecificatorKind.ackProtected: System.Diagnostics.Debug.WriteLine("Protected");
Case AccessSpecificatorKind.ackFriend: System.Diagnostics.Debug.WriteLine("Friend");
Case AccessSpecificatorKind.ackProtectedFriend: System.Diagnostics.Debug.WriteLine("ProtectedFriend");
End Select;
End For;
End Sub;
On executing the example, the repository assembly with the specified identifier will be loaded to the execution environment. The development environment console will display a list of procedures/functions implemented in assembly global namespace.
See also: