Changeset 983f486 for libcfa/src
- Timestamp:
- May 7, 2024, 10:33:40 PM (6 months ago)
- Branches:
- master
- Children:
- c2a4b62, e542b02
- Parents:
- 9b140bd
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/enum.hfa
r9b140bd r983f486 1 1 #pragma once 2 2 3 forall(E) trait Bounded { 4 E lowerBound(); 5 E upperBound(); 6 }; 3 forall(T) { // T is the based type of enum(T) 4 forall(E) trait Bounded { 5 E lowerBound(); 6 E upperBound(); 7 }; 7 8 8 forall(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 };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 }; 14 15 15 // Opague Enum + TypedEnum16 forall(E, T| Serial(E, T)) trait CfaEnum {17 char * labelE(E e);18 unsigned int posE(E e);19 };16 // Opague Enum + TypedEnum 17 forall(E | Serial(E, T)) trait CfaEnum { 18 char * labelE(E e); 19 unsigned int posE(E e); 20 }; 20 21 21 forall(E, T | CfaEnum(E, T)) trait TypedEnum { 22 T valueE(E e); 23 }; 22 forall(E | CfaEnum(E, T)) trait TypedEnum { 23 T valueE(E e); 24 }; 25 } 24 26 25 27 forall(E, T| TypedEnum(E, T)) { … … 34 36 35 37 // for testing; To be removed 38 // char * typeEnumString(E e); 36 39 char * typeEnumString(E e); 37 40 }
Note: See TracChangeset
for help on using the changeset viewer.