You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
764 B

8 months ago
  1. #pragma once
  2. #include <stdint.h>
  3. #include <string.h>
  4. namespace iflytop {
  5. class ZEnum {
  6. public:
  7. int val;
  8. char const* name;
  9. char const* chName;
  10. ZEnum(int val, const char* name, const char* chName) : val(val), name(name), chName(chName) {}
  11. bool isEq(int val) { return this->val == val; }
  12. bool isEq(ZEnum* role) { return this->val == role->val; }
  13. bool isEqByChName(const char* chName) { return strcmp(this->chName, chName) == 0; }
  14. ZEnum(const ZEnum& other) : val(other.val), name(other.name), chName(other.chName) {}
  15. // :operator=
  16. ZEnum& operator=(const ZEnum& other) {
  17. if (this != &other) {
  18. val = other.val;
  19. name = other.name;
  20. chName = other.chName;
  21. }
  22. return *this;
  23. }
  24. };
  25. } // namespace iflytop