Next: , Previous: String types, Up: %typedef and %type


10.5 Enumerated types

Fields of this type contain symbols taken from an enumeration.

The type is described by writing the sequence of symbols conforming the enumeration. Enumeration symbols are strings described by the following regexp:

     [a-zA-Z0-9][a-zA-Z0-9_-]*

The symbols are separated by blank characters (including newlines). For example:

     %typedef: Status_t enum NEW STARTED DONE CLOSED
     %typedef: Day_t enum Monday Tuesday Wednesday Thursday Friday
     +                    Saturday Sunday

It is possible to insert comments when describing an enum type. The comments are delimited by parenthesis pairs. The contents of the comments can be any character but parenthesis. For example:

     %typedef: TaskStatus_t enum
     + NEW         (The task was just created)
     + IN_PROGRESS (Task started)
     + CLOSED      (Task closed)

Boolean fields can be seen as special enumerations holding the binary values.

     %typedef: Yesno_t bool

The literals allowed in boolean fields are yes/no, 0/1 and true/false. Examples are:

     SwitchedOn: 1
     SwitchedOn: yes
     SwitchedOn: false