Package: gobject

Type gobject:type-t

Superclasses

common-lisp:standard-object, common-lisp:t

Documented Subclasses

None

Direct Slots

mangled-p
Whether the type designator is mangled with the G_SIGNAL_TYPE_STATIC_SCOPE flag.

Details

The g:type-t type specifier represents the unique GType identifier of a registered type. The g:type-t type specifier is identified by its g:gtype representation, a string for the name, or a numeric identifier. Functions accept g:type-t type specifiers as a g:gtype instance, a string or an integer and return a g:gtype instance. Use the g:gtype function to create a g:gtype instance. You can get the name or the numeric identifier with the g:gtype-name and g:gtype-id functions.

Fundamental types

The fundamental types known to GObject and the types of values that correspond to the CFFI interface und Common Lisp.
ID     NAME               CFFI type      Lisp type
------------------------------------------------------------
 4     "void"           :void            NULL
 8     "GInterface"     :pointer
12     "gchar"          :char
16     "guchar"         :uchar
20     "gboolean"       :boolean         boolean
24     "gint"           :int
28     "guint"          :uint
32     "glong"          :long
36     "gulong"         :ulong
40     "gint64"         :int64
44     "guint64"        :uint64
48     "GEnum"                           g:enum
52     "GFlags"                          g:flags
56     "gfloat"         :float           single-float
60     "gdouble"        :double          double-float
64     "gchararray"     :string
68     "gpointer"       :pointer
72     "GBoxed"         :pointer         g:boxed
76     "GParam"         :pointer         g:param
80     "GObject"        :pointer         g:object
84     "GVariant"       :pointer         g:variant    

Lisp symbols for types

In the Lisp API, a Lisp symbol is registered for each GType. The g:symbol-for-gtype function gets this Lisp symbol.

Examples

Create a g:gtype instance from a string or a numeric identifier.
(g:gtype "gdouble") => #<GTYPE :name "gdouble" :id 60>
(g:gtype 60) => #<GTYPE :name "gdouble" :id 60>    
Get the name and the numeric identifier from a g:gtype instance.
(glib:gtype-id (g:gtype "gdouble")) => 60
(glib:gtype-name (g:gtype "gdouble")) => "gdouble"    
Convert from foreign.
(cffi:convert-from-foreign 60 'g:type-t)
=> #<GTYPE :name "gdouble" :id 60>
(cffi:convert-from-foreign "gdouble" 'g:type-t)
=> #<GTYPE :name "gdouble" :id 60>
(cffi:convert-from-foreign (g:gtype "gdouble") 'g:type-t)
=> #<GTYPE :name "gdouble" :id 60>    
Convert to foreign.
(cffi:convert-to-foreign 60 'g:type-t) => 60
(cffi:convert-to-foreign "gdouble" 'g:type-t) => 60
(cffi:convert-to-foreign (g:gtype "gdouble") 'g:type-t) => 60    
Get the Lisp symbol for a GType:
(g:symbol-for-gtype "GApplication")
=> GIO:APPLICATION
=> T    
 

See also

2024-12-8