source: libcfa/src/enum.hfa @ c333ed2

Last change on this file since c333ed2 was c333ed2, checked in by JiadaL <j82liang@…>, 2 months ago

Remove intermeidate type (enum attribute type); remove replacePseudoFunc (has been migrated to resolver)

  • Property mode set to 100644
File size: 706 bytes
Line 
1#pragma once
2
3forall(E) trait Bounded {
4    E lowerBound();
5    E upperBound();
6};
7
8forall(E, T| Bounded(E)) trait Serial {
9    unsigned fromInstance(E e);
10    E fromInt(unsigned i);
11    E succ(E e);
12    E pred(E e);
13};
14
15// Opague Enum + TypedEnum
16forall(E, T | Serial(E, T)) trait CfaEnum {
17    char * labelE(E e);
18    unsigned int posE(E e);
19};
20
21forall(E, T | CfaEnum(E, T)) trait TypedEnum {
22    T valueE(E e);
23};
24
25forall(E, T| TypedEnum(E, T)) {
26    // comparison
27    int ?==?(E l, E r);
28    int ?!=?(E l, E r);
29    int ?!=?(E l, zero_t);
30    int ?<?(E l, E r);
31    int ?<=?(E l, E r);
32    int ?>?(E l, E r);
33    int ?>=?(E l, E r);
34
35    // for testing; To be removed
36    char * typeEnumString(E e);
37}
Note: See TracBrowser for help on using the repository browser.