| 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 |
|
| 19 |
/* See enums.h */ |
| 20 |
|
| 21 |
/* For C++ files. */ |
| 22 |
|
| 23 |
#undef enums_begin |
| 24 |
#undef enums_add |
| 25 |
#undef enums_alt |
| 26 |
#undef enums_end |
| 27 |
#define enums_begin(kType,minimum) kType kType##_getValue (conststring32 testText) { |
| 28 |
#define enums_add(kType,value,which,text) if (Melder_equ_firstCharacterCaseInsensitive (testText, text)) return kType::which; |
| 29 |
#define enums_alt(kType,which,text) if (Melder_equ_firstCharacterCaseInsensitive (testText, text)) return kType::which; |
| 30 |
#define enums_end(kType,maximum,def) \ |
| 31 |
if (str32equ (testText, U"\t")) return kType::DEFAULT; \ |
| 32 |
if (str32equ (testText, U"\n")) return kType::MAX; \ |
| 33 |
return kType::UNDEFINED; } |
| 34 |
|
| 35 |
/* End of file enums_getValue.h */ |