Last change
on this file since f5cb7c2 was
72713e5,
checked in by JiadaL <j82liang@…>, 6 months ago
|
Add libcfa/src/enum.hfa
|
-
Property mode set to
100644
|
File size:
545 bytes
|
Line | |
---|
1 | #pragma once |
---|
2 | |
---|
3 | forall(E) trait Bounded { |
---|
4 | E lowerBound(); |
---|
5 | E upperBound(); |
---|
6 | }; |
---|
7 | |
---|
8 | forall(E | 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 | forall(E, T) trait TypedEnum { |
---|
16 | T valueE(E e); |
---|
17 | char * labelE(E e); |
---|
18 | unsigned int posE(E e); |
---|
19 | }; |
---|
20 | |
---|
21 | forall(E, T| TypedEnum(E, T)) { |
---|
22 | // comparison |
---|
23 | int ?==?(E l, E r); |
---|
24 | int ?!=?(E l, E r); |
---|
25 | int ?!=?(E l, zero_t); |
---|
26 | int ?<?(E l, E r); |
---|
27 | int ?<=?(E l, E r); |
---|
28 | int ?>?(E l, E r); |
---|
29 | int ?>=?(E l, E r); |
---|
30 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.