Next: , Previous: g-boxed-opaque, Up: GBoxed


12.5 define-boxed-opaque-accessor

— Macro: define-boxed-opaque-accessor
     (define-boxed-opaque-accessor
       boxed-name accessor-name &key type reader writer)
boxed-name
A symbol naming the opaque structure type for which the accessor is being defined
accessor-name
A symbol naming the accessor
type
A CFFI foreign type of the property for which the accessor is being defined
reader
A NIL or a string or a function designator for the reader function
writer
A NIL or a string or a function designator for the writer function

Defines the accessor named accessor-name for property of opaque structure named boxed-name of type specified by CFFI foreign-type type.

reader is a string naming a foreign function of one argument of CFFI foreign-type (g-boxed-foreign boxed-name) that returns a value of CFFI foreign-type type; or a function designator for a function that accepts a single argument - an instance of g-boxed-opaque class and returns the value of a property; or a NIL if the property is not readable.

writer is a string naming a foreign function of two arguments: of types type and (g-boxed-foreign boxed-name) (with the first argument being the new value and the second being the object); or a function designator for a function of two arguments: a new value and an instance of g-boxed-opaque class; or a NIL if the property is not writable.

Example:

     (define-boxed-opaque-accessor text-iter text-iter-child-anchor
       :reader "gtk_text_iter_get_child_anchor" :type (g-object text-child-anchor))
     
     (define-boxed-opaque-accessor text-iter text-iter-tags
       :reader "gtk_text_iter_get_tags" :type (gslist (g-object text-tag) :free-from-foreign t))
     
     (define-boxed-opaque-accessor text-iter text-iter-chars-in-line
       :reader "gtk_text_iter_get_chars_in_line" :type :int)
     
     (define-boxed-opaque-accessor text-iter text-iter-offset
       :reader "gtk_text_iter_get_offset" :writer "gtk_text_iter_set_offset" :type :int)