Next: , Previous: Enum types information, Up: GObject Reference


4.6 Using GValues

GValue is a generic container for arbitrary value of type supported by GType system. Refer to GObject documentation for more detailed information.

CL-GTK2-GOBJECT works with GValue as a foreign type g-value. Functions g-value-zero, g-value-type, g-value-init, parse-g-value, set-g-value are used to inspect and assign GValues. g-value is a CFFI foreign type that is used by all these functions. Pointer to foreign instance of this type is passed to them.

GValue is used whenever a value of unkown type should be passed. It is used in:

Example of usage:

     (cffi:with-foreign-object (gval 'g-value)
       (set-g-value gval "Hello" "gchararray" :zero-g-value t)
       (format t "~S~%" (parse-g-value gval))
       (g-value-unset gval))
     =>
     "Hello"