| 1 | /* Strings_def.h |
| 2 | * |
| 3 | * Copyright (C) 1992-2007,2011,2012,2015-2018,2020,2022,2023 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 | |
| 20 | #define ooSTRUCT Strings |
| 21 | oo_DEFINE_CLASS (Strings, Daata) |
| 22 | |
| 23 | oo_INTEGER (numberOfStrings) |
| 24 | oo_STRING_VECTOR (strings, numberOfStrings) |
| 25 | |
| 26 | #if oo_DECLARING |
| 27 | void v1_info () |
| 28 | override; |
| 29 | void v1_assertInvariants () override { |
| 30 | our Strings_Parent :: v1_assertInvariants (); |
| 31 | Melder_assert (our strings.size == our numberOfStrings); |
| 32 | } |
| 33 | void maintainInvariants () { |
| 34 | our numberOfStrings = our strings.size; |
| 35 | } |
| 36 | void checkStringNumber (const integer stringNumber) { |
| 37 | Melder_require (stringNumber >= 1, |
| 38 | U"The element number should be at least 1, not ", stringNumber, U"."); |
| 39 | Melder_require (stringNumber <= our numberOfStrings, |
| 40 | U"The element number should be at most the number of elements (", our numberOfStrings, U"), not", stringNumber, U"."); |
| 41 | } |
| 42 | bool v_hasGetVectorStr () const |
| 43 | override { return true; } |
| 44 | conststring32 v_getVectorStr (integer icol) const |
| 45 | override; |
| 46 | #endif |
| 47 | |
| 48 | oo_END_CLASS (Strings) |
| 49 | #undef ooSTRUCT |
| 50 | |
| 51 | |
| 52 | /* End of file Strings_def.h */ |