source: libcfa/src/enum.cfa @ 253d0b4

Last change on this file since 253d0b4 was 525f7ad, checked in by JiadaL <j82liang@…>, 4 weeks ago
  1. Add count_e( enum_name ), a pseudo function that return the number of element in an enum; 2. Implementation of enum range loop.
  • Property mode set to 100644
File size: 710 bytes
Line 
1#include "enum.hfa"
2#include "fstream.hfa"
3
4#pragma GCC visibility push(default)
5
6forall(ostype & | basic_ostream(ostype), E, V| CfaEnum(E, V))
7ostype & ?|?(ostype& os, E e) {
8    return os | type_name(e) | "." | labelE(e);
9}
10
11forall(ostype & | basic_ostream(ostype), E| CfaEnum(E, quasi_void))
12ostype & ?|?(ostype& os, E e) {
13    return os | type_name(e) | "." | labelE(e);
14}
15
16forall(ostype & | basic_ostream(ostype), E, V| CfaEnum(E, V)) {
17    int ?==?(E l, E r) { return posE(l) == posE(r); }
18    int ?<=?(E l, E r) { return posE(l) <= posE(r); }
19    int ?>=?(E l, E r) { return posE(l) >= posE(r); }
20    int ?<?(E l, E r) { return posE(l) < posE(r); }
21    int ?>?(E l, E r) { return posE(l) > posE(r); }
22}
Note: See TracBrowser for help on using the repository browser.