enums_getValue.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /* enums_getValue.h
  2. *
  3. * Copyright (C) 2007-2009,2015,2017 Paul Boersma
  4. *
  5. * This code is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * This code is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. * See the GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this work. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /* See enums.h */
  19. /* For C++ files. */
  20. #undef enums_begin
  21. #undef enums_add
  22. #undef enums_alt
  23. #undef enums_end
  24. #define enums_begin(kType,minimum) kType kType##_getValue (conststring32 testText) {
  25. #define enums_add(kType,value,which,text) if (Melder_equ_firstCharacterCaseInsensitive (testText, text)) return kType::which;
  26. #define enums_alt(kType,which,text) if (Melder_equ_firstCharacterCaseInsensitive (testText, text)) return kType::which;
  27. #define enums_end(kType,maximum,def) \
  28. if (str32equ (testText, U"\t")) return kType::DEFAULT; \
  29. if (str32equ (testText, U"\n")) return kType::MAX; \
  30. return kType::UNDEFINED; }
  31. /* End of file enums_getValue.h */