44 typedef const char * CString;
45 typedef typename T::EnumType eT;
47 static const Enum<T> & at(eT t) {
49 typedef const std::vector<const Enum<T> * > CT;
50 CT & enums = T::getEnums();
51 for (
typename CT::const_iterator it = enums.begin(); it != enums.end(); it++) {
52 if (((eT)t) == ((eT)(*it))) {
59 static const Enum<T> & at(
const char * t) {
61 typedef const std::vector<const Enum<T> * > CT;
62 CT & enums = T::getEnums();
63 for (
typename CT::const_iterator it = enums.begin(); it != enums.end(); it++) {
64 if ((*it)->name.compare(t) == 0) {
71 Enum(
const eT &value,
const char *name) : value(value), name(name) {}
73 operator eT (
void)
const {
77 operator CString(
void)
const {
81 bool operator == (
const Enum<T> &that)
const {
82 return this->value == that.value;
85 bool operator != (
const Enum<T> &that)
const {
86 return this->value != that.value;
89 void print(
void)
const {
90 std::cout <<
"[OBJ]Enum<" << T::klassName() <<
">" <<
"[k" << name <<
"] = " << value << std::endl;