Enum

G-Golf class, accessors, methods and procedures to deal with C enum types.

Classes

<enum>
<gi-enum>

Procedures, Accessors and Methods

!enum-set
enum->value
enum->values
enum->symbol
enum->symbols
enum->name
enum->names
!g-type_
!g-name
!name__

Description

G-Golf class, accessors, methods and procedures to deal with C enum types.

Classes

Class: <enum>

The <enum> class is for enumerated values. Its (unique) slot is:

enum-set

#:accessor !enum-set
#:init-keyword #:enum-set

Notes:

  • the enum-set can’t be empty and so you must use the #:enum-set (#:init-keyword) when creating new <enum> instances;

  • the #:enum-set (#:init-keyword) accepts either a list of symbols or a well-formed enum-set;

  • a well-formed enum-set is a list of (symbol . id) pairs, where id is a positive integer.

  • each 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’).

Class: <gi-enum>

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 #f

g-name

#:accessor !g-name
#:init-keyword #:g-name

name

#: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’).

Procedures, Accessors and Methods

Accessor: !enum-set (inst <enum>)

Returns the content of the enum-set slot for inst.

Method: enum->value (inst <enum>) symbol
Method: enum->values (inst <enum>)

Returns the inst value for symbol (or #f if it does not exists), or the list of all values for inst, respectively.

Method: enum->symbol (inst <enum>) value
Method: enum->symbols (inst <enum>)

Returns the inst symbol for value (or #f if it does not exists), or the list of all symbols for inst, respectively.

Method: enum->name (inst <enum>) value
Method: enum->names (inst <enum>)

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.

Accessor: !g-type (inst <gi-enum>)
Accessor: !g-name (inst <gi-enum>)
Accessor: !name (inst <gi-enum>)

Returns the content of the g-type, g-name or name slot for inst, respectively.