| 1 | /* TextGrid_def.h |
| 2 | * |
| 3 | * Copyright (C) 1992-2012,2014-2016,2018,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 TextPoint |
| 21 | oo_DEFINE_CLASS (TextPoint, AnyPoint) |
| 22 | |
| 23 | oo_STRING (mark) |
| 24 | |
| 25 | oo_END_CLASS (TextPoint) |
| 26 | #undef ooSTRUCT |
| 27 | |
| 28 | |
| 29 | #define ooSTRUCT TextInterval |
| 30 | oo_DEFINE_CLASS (TextInterval, Function) |
| 31 | |
| 32 | oo_STRING (text) |
| 33 | |
| 34 | #if oo_DECLARING |
| 35 | int v_domainQuantity () const |
| 36 | override { return MelderQuantity_TIME_SECONDS; } |
| 37 | #endif |
| 38 | |
| 39 | oo_END_CLASS (TextInterval) |
| 40 | #undef ooSTRUCT |
| 41 | |
| 42 | |
| 43 | #define ooSTRUCT TextTier |
| 44 | oo_DEFINE_CLASS (TextTier, Function) // a kind of AnyTier though |
| 45 | |
| 46 | oo_COLLECTION_OF (SortedSetOfDoubleOf, points, TextPoint, 0) |
| 47 | |
| 48 | #if oo_DECLARING |
| 49 | AnyTier_METHODS |
| 50 | |
| 51 | int v_domainQuantity () const |
| 52 | override { return MelderQuantity_TIME_SECONDS; } |
| 53 | #endif |
| 54 | |
| 55 | oo_END_CLASS (TextTier) |
| 56 | #undef ooSTRUCT |
| 57 | |
| 58 | |
| 59 | #define ooSTRUCT IntervalTier |
| 60 | oo_DEFINE_CLASS (IntervalTier, Function) |
| 61 | |
| 62 | oo_COLLECTION_OF (SortedSetOfDoubleOf, intervals, TextInterval, 0) |
| 63 | |
| 64 | #if oo_DECLARING |
| 65 | int v_domainQuantity () const |
| 66 | override { return MelderQuantity_TIME_SECONDS; } |
| 67 | void v_shiftX (double xfrom, double xto) |
| 68 | override; |
| 69 | void v_scaleX (double xminfrom, double xmaxfrom, double xminto, double xmaxto) |
| 70 | override; |
| 71 | #endif |
| 72 | |
| 73 | oo_END_CLASS (IntervalTier) |
| 74 | #undef ooSTRUCT |
| 75 | |
| 76 | |
| 77 | #define ooSTRUCT TextGrid |
| 78 | oo_DEFINE_CLASS (TextGrid, Function) |
| 79 | |
| 80 | oo_OBJECT (FunctionList, 0, tiers) // TextTier and IntervalTier objects |
| 81 | |
| 82 | #if oo_DECLARING |
| 83 | void v1_info () |
| 84 | override; |
| 85 | void v_repair () |
| 86 | override; |
| 87 | int v_domainQuantity () const |
| 88 | override { return MelderQuantity_TIME_SECONDS; } |
| 89 | void v_shiftX (double xfrom, double xto) |
| 90 | override; |
| 91 | void v_scaleX (double xminfrom, double xmaxfrom, double xminto, double xmaxto) |
| 92 | override; |
| 93 | |
| 94 | IntervalTier intervalTier_cast (int32 tierNumber) { |
| 95 | return static_cast <IntervalTier> (our tiers -> at [tierNumber]); |
| 96 | } |
| 97 | TextTier textTier_cast (int32 tierNumber) { |
| 98 | return static_cast <TextTier> (our tiers -> at [tierNumber]); |
| 99 | } |
| 100 | #endif |
| 101 | |
| 102 | oo_END_CLASS (TextGrid) |
| 103 | #undef ooSTRUCT |
| 104 | |
| 105 | |
| 106 | /* End of file TextGrid_def.h */ |