Am Freitag, 9. Mai 2008 12:17:43 schrieb Freddie Witherden:
> On Fri, 9 May 2008 10:38:54 +0200, Dennis Schridde <[EMAIL PROTECTED]>
> wrote:
> > Just something I experimented with:
> > #define CALL(OBJECT, METHOD) ((OBJECT)->vtable->METHOD)
> > CALL(xob, xme)(p1, p2);
>
> Currently the way virtual methods (i.e., those which use the vtable) are
> called is exactly the same as that of non-virtual methods:
> <className><methodName>, so: wigetSetLayout(...).
So the API will be "C-style"? I somehow assumed it was intended to provide a 
object oriented syntax, i.e. via GET_VTABLE().

> This is somewhat useful, as in the virtual method functions (e.g.
> widgetDoDraw), which is a pure virtual method, we can ASSERT that
> object->vtable->method is NOT NULL. A macro may complicate this somewhat.
So the idea is that there are wrapper functions, like widgetDoDraw(), which 
call widget->vtable->method, which may point to buttonDoDraw()?

> It may seem a bit strange, if, in the code we get:
> button *btn = buttonCreate(...);
> widget *root = widgetGetRoot(WIDGET(btn));
> CALL(btn, setLayout)(...);
Just wanted to mention this, since we talked about that recently.
I got the idea that the above way might work, tested, and it did work.
And since I saw some GET_VTABLE(obj)->method in the code, I thought I might 
also tell you what I tested.

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev

Reply via email to