source: libcfa/src/enum.hfa @ e542b02

Last change on this file since e542b02 was 983f486, checked in by JiadaL <j82liang@…>, 3 months ago

Reformat forall clause in enum.hfa

  • Property mode set to 100644
File size: 855 bytes
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
[983f486]9    forall(E| Bounded(E, T)) trait Serial {
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
17    forall(E | Serial(E, T)) trait CfaEnum {
18        char * labelE(E e);
19        unsigned int posE(E e);
20    };
[72713e5]21
[983f486]22    forall(E | CfaEnum(E, T)) trait TypedEnum {
23        T valueE(E e);
24    };
25}
[c333ed2]26
[72713e5]27forall(E, T| TypedEnum(E, T)) {
28    // comparison
29    int ?==?(E l, E r);
30    int ?!=?(E l, E r);
31    int ?!=?(E l, zero_t);
32    int ?<?(E l, E r);
33    int ?<=?(E l, E r);
34    int ?>?(E l, E r);
35    int ?>=?(E l, E r);
[c333ed2]36
37    // for testing; To be removed
[983f486]38    // char * typeEnumString(E e);
[c333ed2]39    char * typeEnumString(E e);
[72713e5]40}
Note: See TracBrowser for help on using the repository browser.