Re: prepare_create_table wrapping - part2



Glib::ListHandler uses a type traits class. It's a second template argument with a default value. The default type traits class is not suitable for your case, even though it might be considered the most elementary case: Convert a std::vector<T*> to GList with T* elements.

First decide if you will use GdaServerOperationCreateTableArg pointers directly in libgdamm, or if you want to to wrap them in a Gda::ServerOperationCreateTableArg class. Then make a type traits class suitable for either std::vector<GdaServerOperationCreateTableArg*> or std::vector<Gda::ServerOperationCreateTableArg>. You can find some examples of type traits classes in glibmm/gio/src/resolver.ccg, gtkmm/gtk/src/iconview.hg, gtkmm/gtk/src/papersize.hg.

RefPtr is not useful here. It contains a pointer to a C++ object with reference() and unreference() methods.

Den 2017-05-09 kl. 21:19, skrev Pavlo Solntsev:
Dear Kjell.

I tried your suggestions and some problems are gone. However, I see
some type conversion issue. It looks like
_GdaServerOperationCreateTableArg type is not visible. I tried using
RefPtr instead of plain pointers - same effect. I attached g++ output
and patch. Thanks for any comments. 




On Tue, 2017-05-09 at 19:05 +0200, Kjell Ahlstedt wrote:
Den 2017-05-09 kl. 05:18, skrev Pavlo Solntsev:
hi,
I found some mistakes in my code and fixed them. However, I can't
figure out where is the problem. I included new patch for my
changes as
well as log from the compiler. Could someone take a look?
Thanks.


The description of gda_server_operation_prepare_create_table() says
that 
the "arguments" parameter is a list of
GdaServerOperationCreateTableArg, 
but if you look at the code in gda-server-operation.c, you'll see
that 
it's really a list of GdaServerOperationCreateTableArg*, i.e. a list
of 
pointers. GdaServerOperationCreateTableArg is defined in 
gda-server-operation.c, hidden from your code. You must use a 
std::vector<GdaServerOperationCreateTableArg*>.




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