Re: [gtk-list] ANNOUNCE: C++ wrapper for glib (sorta)



Some Guy wrote:

> A couple days ago I saw a message asking about a C++ wrapper (or port?)
> for glib, like gtk--.  I took the liberty of writing a simple C program
> that reads a (somewhat modified) glib.h file, parses the basic structures
> (like GList) then creates a header and a source file per new class
> (G_List.cc, G_List.h).  Here is a sample from hdr and src file G_List.h +
> G_List.cc to clarify:
>
> G_List.h (only part):
> class G_List {
>     GList   *pobj

are you ever using pobj? (I can't see it. If not you might as well
delete it!)

> public:
>     GList* alloc(void);
>     void free(GList *list);
>     void free_1(GList *list);
>     GList* append(GList *list, gpointer data);
>     GList* prepend(GList *list, gpointer data);
> ...
>
> G_List.cc (only part):
> GList* G_List::alloc(void)
>     { return g_list_alloc(); }
> void G_List::free(GList *list)
>     { g_list_free(list); }
> void G_List::free_1(GList *list)
>     { g_list_free_1(list); }
> GList* G_List::append(GList *list, gpointer data)
>     { return g_list_append(list, data); }
> GList* G_List::prepend(GList *list, gpointer data)

>    { return g_list_prepend(list, data); }

This all looks like introducing just a new namespace (which is
definitely a
good thing). Am I guessing right?

> Granted this is pretty sloppy (alloc/free should be contructor/destructor,
> maybe others) but if anyone wants to test it out, talk to me.  I only
> understand how to use GList and GSList, so I wouldn't do very good testing
> it :).

 This looks not too bad, I also tried some C++ wrapper for GList but
failed in
the first and second attempt (I tried to be too object oriented) (though
I'm
really expert about Gtk-- and C++!).

Of course I'm interested in your code! Please send it to me!

Another Guy (Christof)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]