source: libcfa/src/enum.hfa@ 1967109

Last change on this file since 1967109 was bf4fe05, checked in by Peter A. Buhr <pabuhr@…>, 17 months ago

fix merge

  • Property mode set to 100644
File size: 1.0 KB
RevLine 
[72713e5]1#pragma once
2
[983f486]3forall(T) { // T is the based type of enum(T)
4 forall(E) trait Bounded {
5 E lowerBound();
6 E upperBound();
7 };
[72713e5]8
[03ac869]9 forall(E| Bounded(T, E)) trait Serial {
[983f486]10 unsigned fromInstance(E e);
11 E fromInt(unsigned i);
12 E succ(E e);
13 E pred(E e);
14 };
[72713e5]15
[983f486]16 // Opague Enum + TypedEnum
[03ac869]17 forall(E | Serial(T, E)) trait CfaEnum {
[983f486]18 char * labelE(E e);
19 unsigned int posE(E e);
20 };
[72713e5]21
[03ac869]22 forall(E| CfaEnum(T, E)) trait TypedEnum {
[983f486]23 T valueE(E e);
24 };
[c2a4b62]25
[41c8312]26 forall(E | TypedEnum(T, E)) {
27 // comparison
[bf4fe05]28 int ?==?(E l, E r); // true if l and r are same enumerators
29 int ?!=?(E l, E r); // true if l and r are different enumerators
30 int ?!=?(E l, zero_t); // true if l is not the first enumerator
31 int ?<?(E l, E r); // true if l is an enuemerator before r
32 int ?<=?(E l, E r); // true if l before or the same as r
33 int ?>?(E l, E r); // true if l is an enuemrator after r
34 int ?>=?(E l, E r); // true if l after or the same as r
[41c8312]35 }
[07e9df1]36}
Note: See TracBrowser for help on using the repository browser.