[Gambas-user] List al the classes and symbols

Bruce Steers bsteers4 at gmail.com
Sun Jun 26 22:16:16 CEST 2022

On Sun, 26 Jun 2022 at 11:30, Martin <mbelmonte at belmotek.net> wrote:

> Hi,
> I want to list all the Gambas classes for all components.
> Public Function AllClases() As Collection
>    Dim cClass As New Collection
>    Dim obj As Object = ? ' what object would be here?
>    Dim MyClass As Class = Object.Class(obj)
>    Dim sSymbol As String
>    For Each sSymbol In MyClass.Symbols
>        Print MyClass.Name & ": " & sSymbol
>    Next
>    Return cClass
> End
> Best regards.
> Martin

Any gambas application only knows it's loaded classes, if you want ALL
other classes you could probably list the /usr/lib/gambas3 dir and load
each component manually with Component.Load().

Something like...
Dim sClasses As String[] = Dir("/usr/lib/gambas3", "*.gambas")

For Each s As String In sClasses

But you cannot load ALL the components as some are incompatible with others
so the above code won't work, maybe you can work with that?

With components loaded use the Classes array

*For Each hClass As Class In Classes*

*  For Each sSymbol As String In hClass.Symbols        Print hClass.Name &
": " & sSymbol    Next Next*

Maybe you could use a script (or make an exe) to load a component and list
its clases/symbols by running it with a component name (comining the above

*#!/usr/bin/env gbs3' Gambas script file' *List classes before loading

*Dim sList As New String[]For Each cl As Class In ClassessList.Add(cl.name

*' *load component from arg


*' *List the classes/symbols again and report what's new

*For Each cl As Class In ClassesIf Not sList.Exist(cl.name
<http://cl.name>) Then Print cl.Name  For Each sSymbol As String In
cl.Symbols     Print cl.Name & ": " & sSymbol  NextEndifNext*

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20220626/878abc34/attachment.htm>

More information about the User mailing list