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



On 6/24/05, Daniel Espinosa <esodan gmail com> wrote:
> > 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 );

It can also be done as:  g_value_unset(val);
which is the most elegant thing!

> 
> 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).
> 

Yes, I was thinking the same but was sparing the idea for a next mail!

> 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?

I believe it's the best solution.

Can you do all these changes?

Thanks,

Vivien



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