Re: [gnome-db] GValue and GdaValue implementation



After a periot of understanding the GType, with test and error
procedure, I finaly make a GValue can hold any of the values stored in
GdaValue, then now I can modify the implementation of GdaValue to be
use GValue as the container then the definition of GdaValue could be:

typedef struct _GdaValue GdaValue;
struct _GdaValue {
	GType type;
	GValue value;
	glong binary_length;
};

And the metods can use GValue value, as the container of all types
that GdaValue can do today.

This could be the begening of properly working of GDA in Mono.

But I have a question, that the gtk-list or gtk-app-list don't
unswer/want to answer, and is that some kind of types are fundamental
types like:

gshort, gushort, tinyint (char) and tinyuint (uchar).

Then to have this types to be holder by a GValue, must be derive from
the fundamental types that allready exist (int, uint, char and uchar,
respectibely).

To do so, I need to define a lot of new functions:

/* To define a new type derived from a fundental */
GType g_char_type_register_static (const gchar *name);
GType g_uchar_type_register_static (const gchar *name);
GType g_int_type_register_static (const gchar *name);
GType g_uint_type_register_static (const gchar *name);

/* To set/unset a GValue with the new GTypes */
/* tinyint as a char type */
void g_value_set_tinyint(GValue *value, tinyint v_tinyint);
tinyint g_value_get_tinyint(const GValue *val);
void g_value_set_tinyuint(GValue *value, tinyuint v_tinyuint);
tinyuint g_value_get_tinyuint(const GValue *val);

/* gshort type */
void g_value_set_short(GValue *value, gshort v_short);
gshort g_value_get_short(const GValue *val);
void g_value_set_ushort(GValue *value, gushort v_ushort);
gushort g_value_get_ushort(const GValue *val);

Buy this functions may need be added to GLib, becouse a future use in
type derived from that kind of types.

And what about if we need to make GdaValue as a GObject?

2005/5/3, Daniel Espinosa <esodan gmail com>:
> ---------- Forwarded message ----------
> From: Daniel Espinosa <esodan gmail com>
> Date: May 3, 2005 5:59 PM
> Subject: Re: [gnome-db] GValue and GdaValue implementation
> To: Rodrigo Moya <rodrigo gnome-db org>
> 
> The glue library is a good idea, the GValue implementation in Mono, is
> hard coded becouse GValue use a union too!
> 
> But the problem is: what is better, have an implementation using GType
> and GObject in some types values, or continue to use the corrent
> implementation and hard code the port to other languages.
> 
> May be is not a bad idea to have a GdaValue using GType and GValue :-)
> 
> On 5/3/05, Rodrigo Moya <rodrigo gnome-db org> wrote:
> > On Mon, 2005-05-02 at 22:06 -0400, Daniel Morgan wrote:
> > > Just an idea...
> > >
> > > Could libgda be modified to allow GDA# to more easily get/set GDA values
> > > by providing helper functions that does not use unions?
> > >
> > it already does, the gda_value_set/get_* functions allow using direct
> > values without using the union.
> > --
> > Rodrigo Moya <rodrigo gnome-db org>
> >
> >
> 


-- 
Trabajar, la mejor arma para tu superación



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