G-Golf class, accessors, methods and procedures to deal with C enum types.
G-Golf class, accessors, methods and procedures to deal with C enum types.
The <enum>
class is for enumerated values. Its (unique) slot is:
enum-set
#:accessor !enum-set
#:init-keyword #:enum-set
Notes:
enum-set
can’t be empty and so you must use the
#:enum-set
(#:init-keyword) when creating new <enum>
instances;
#:enum-set
(#:init-keyword) accepts either a list of symbols
or a well-formed enum-set
;
enum-set
is a list of (symbol . id)
pairs,
where id
is a positive integer.
symbol
and each id
of an enum-set
must be
unique.
Instances of the <enum>
class are immutable (to be precise, there
are not meant to be mutated, see GOOPS Notes and Conventions,
’Slots are not Immutable’).
The <gi-enum>
class is a subclass of <enum>
. Its
class-direct-slots
are:
g-type
#:accessor !g-type
#:init-keyword #:g-type
#:init-value #fg-name
#:accessor !g-name
#:init-keyword #:g-namename
#:accessor !name
The name
slot is automatically initialized.
Instances of the <gi-enum>
class are immutable (to be precise,
there are not meant to be mutated, see GOOPS Notes and Conventions, ’Slots are not Immutable’).
Returns the content of the enum-set slot for inst.
Returns the inst value for symbol (or #f
if it does
not exists), or the list of all values for inst, respectively.
Returns the inst symbol for value (or #f
if it does
not exists), or the list of all symbols for inst, respectively.
Returns the inst name (the string representation of the symbol)
for value (or #f
if it does not exists), or the list of all
names for inst, respectively.
value can either be a symbol
or an id
.