Re: [gnome-db] Please, tell me any thing about GdaValue & GValue work



> Another question (forgive me if it has already been asked, but I'm
> lazy to search back in the archives): why did you have to create
> GdaValue as a
> typedef struct {
>         GValue *value;
>         glong binary_length;
> } GdaValue;
> 
> and not something like
> typedef struct {
>         GValue value;
>         glong binary_length;
> } GdaValue;
> 
> note the difference is that in the second form, GdaValue is a GValue
> directly which simplifies things greatly?
> 
I make some tests, and could work.

To create a new GdaValue you can use sentences like:

GdaValue *val;

/*This create also an unset GValue*/
val = g_new0(GdaValue,1);

And to work with the GValue need to use:

g_value_unset( &val->value);

but is less elegant than: 

g_value_unset( val->value );

Of course both will work, then there's not reason to have a pointer in
the GdaValue structure for GValue.

But other question could be why to have a size of the binary type
inside the GdaValue structure, why don't have a structure for a binary
object like:

typedef struct {
    gpointer binary;
   glong size;
}

And store this type as a GBoxed (like in GdaNumeric or GdaMoney).

If so, the GdaValue could be defined just as:

typedef GValue GdaValue;

and use transparently a GValue as GdaValue, on all the code.

What do you think?
-- 
Trabajar, la mejor arma para tu superación



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