Dear Kjell. My initial idea was to wrap struct GdaServerOperationCreateTableArg as a class inside the Gda::ServerOperatio. It should look like: Gda::ServerOperation::CreateTableArg. To do so I used _CLASS_GENERIC macros. I wasn't successful. It may be implemented manually, but in that case, it will not be wrap. I see not option now how to transform C-style struct to C++ class. I am talking about struct to class conversion because in C API there are a set of functions that can logically be wrapped as methods for C++ class. However, simple macros will not give enough flexibility for expansion the class. Do you think it is a good idea to write a class from scratch (without using macroses) based on C API? I may try this route but I want to make sure it is not against *mm rules of porting.
I will play with your suggestion. Thanks, -Pavlo Solntsev On Thu, May 11, 2017 at 6:20 AM, Kjell Ahlstedt <kjellahlst...@gmail.com> wrote: > 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*>. > > > >
_______________________________________________ gtkmm-list mailing list gtkmm-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtkmm-list