Re: Converting a Glib::ValueBase to a derived type



On Wed, 2008-01-30 at 16:51 -0500, José Alburquerque wrote:
> >>  class defined in 
> >> structure.hg to use Glib::ValueBase (just checked in to svn).  I'm still 
> >> a bit unclear about working with Glib::ValueBase so I wrote the attached 
> >> test (also checked in). I'm stuck in the last if block where I'm trying 
> >> to determine if the value obtained is of the right type.
> >>     
> >
> > You can try
> > G_VALUE_TYPE(value.gobj()):
> > http://library.gnome.org/devel/gobject/unstable/gobject-Generic-values.html#G-VALUE-TYPE:CAPS
> >
> >   
> Last question:  Once the type is determined, is it practical to attempt 
> to read the value stored?  If so, how would that be done?

First I need to correct your test:
 Glib::ValueBase value;
 testProxy.get(value);

It should be:
 Glib::Value<Glib::ustring> value;
 textProxy.get(value);

Then you can do
Glib::ustring text = value.get();


-- 
murrayc murrayc com
www.murrayc.com
www.openismus.com



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