[Gambas-devel] Fwd: Re: "Overriding" virtual classes

Benoît Minisini gambas at ...1...
Fri Jul 11 20:09:52 CEST 2014

Le 10/07/2014 23:32, Tobias Boege a écrit :
>> 1) Can you commit your code?
> It's not really done yet (and by "it" I mean just the interface).  It's the
> examination period currently for me, so I will take entire days off to work
> on Gambas but afterwards entire weeks to prepare.
> Tomorrow noon, I'll begin a Gambas day again and can hopefully incorporate
> the suggestions from gambas-user into my mind map :-)
>> 2) Do you want the user to implement its own graph class in Gambas or in
>> C/C++?
> In Gambas! I succeeded to implement a Graph which is implicitly defined by
> an Image object (in pure Gambas), by inheriting native virtual classes (with
> the _Virtual_ClassName naming scheme, i.e. with underscores instead of dots,
> so that the appropriate source files can actually be created and used in
> Gambas code). I'll commit tomorrow, I hope.
> Regards,
> Tobi

Maybe you should do differently, like I did to implement the Paint class.

1) You implement only one set of classes, but they use an internal 
"graph" interface that is just a structure of function pointers that do 
the real job you need.

See 'cpaint_impl.cpp' in 'gb.qt4/src' for the syntax of the interface, 
and 'CImage.cpp' to see how I declare using it in the Image class.

2) Then you must handle the special case of a Graph interface written in 
Gambas, by making a dedicated interface that just calls the Gambas 
functions, and an option to tell that you are using a Gambas class as 
interface, and not a native one.

You have something like that with the highlighting method of the Editor 
class. If you want to highlight Gambas code, an internal C function is 
called. Otherwise a Gambas function is called.

Maybe I was not very clear, but you will ask me!


Benoît Minisini

More information about the Devel mailing list