| 1 | /* NavigationContext.cpp |
| 2 | * |
| 3 | * Copyright (C) 2020-2021 David Weenink |
| 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. See the GNU |
| 13 | * 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 | #include "Distributions_and_Strings.h"cxx . . $ `<file>/stat/Distributions_and_Strings.h`/ |
| 20 | #include "NavigationContext.h"cxx . . $ `<file>/dwtools/NavigationContext.h`/ |
| 21 | #include "NUM2.h"cxx . . $ `<file>/dwsys/NUM2.h`/ |
| 22 | #include "Strings_extensions.h"cxx . . $ `<file>/dwtools/Strings_extensions.h`/ |
| 23 | |
| 24 | |
| 25 | #include "enums_getText.h"cxx . . $ `<file>/melder/enums_getText.h`/ |
| 26 | #include "NavigationContext_enums.h"cxx . . $ `<file>/dwtools/NavigationContext_enums.h`/ |
| 27 | #include "enums_getValue.h"cxx . . $ `<file>/melder/enums_getValue.h`/ |
| 28 | #include "NavigationContext_enums.h"cxx . . $ `<file>/dwtools/NavigationContext_enums.h`/ |
| 29 | |
| 30 | #include "oo_DESTROY.h"cxx . . $ `<file>/sys/oo_DESTROY.h`/ |
| 31 | #include "NavigationContext_def.h"cxx . . $ `<file>/dwtools/NavigationContext_def.h`/ |
| 32 | #include "oo_COPY.h"cxx . . $ `<file>/sys/oo_COPY.h`/ |
| 33 | #include "NavigationContext_def.h"cxx . . $ `<file>/dwtools/NavigationContext_def.h`/ |
| 34 | #include "oo_EQUAL.h"cxx . . $ `<file>/sys/oo_EQUAL.h`/ |
| 35 | #include "NavigationContext_def.h"cxx . . $ `<file>/dwtools/NavigationContext_def.h`/ |
| 36 | #include "oo_CAN_WRITE_AS_ENCODING.h"cxx . . $ `<file>/sys/oo_CAN_WRITE_AS_ENCODING.h`/ |
| 37 | #include "NavigationContext_def.h"cxx . . $ `<file>/dwtools/NavigationContext_def.h`/ |
| 38 | #include "oo_WRITE_TEXT.h"cxx . . $ `<file>/sys/oo_WRITE_TEXT.h`/ |
| 39 | #include "NavigationContext_def.h"cxx . . $ `<file>/dwtools/NavigationContext_def.h`/ |
| 40 | #include "oo_READ_TEXT.h"cxx . . $ `<file>/sys/oo_READ_TEXT.h`/ |
| 41 | #include "NavigationContext_def.h"cxx . . $ `<file>/dwtools/NavigationContext_def.h`/ |
| 42 | #include "oo_WRITE_BINARY.h"cxx . . $ `<file>/sys/oo_WRITE_BINARY.h`/ |
| 43 | #include "NavigationContext_def.h"cxx . . $ `<file>/dwtools/NavigationContext_def.h`/ |
| 44 | #include "oo_READ_BINARY.h"cxx . . $ `<file>/sys/oo_READ_BINARY.h`/ |
| 45 | #include "NavigationContext_def.h"cxx . . $ `<file>/dwtools/NavigationContext_def.h`/ |
| 46 | #include "oo_DESCRIPTION.h"cxx . . $ `<file>/sys/oo_DESCRIPTION.h`/ |
| 47 | #include "NavigationContext_def.h"cxx . . $ `<file>/dwtools/NavigationContext_def.h`/ |
| 48 | |
| 49 | |
| 50 | Thing_implementcxx . . $ `sys/Thing.h:65:9`! (NavigationContext, Daata, 0); |
| 51 | |
| 52 | static bool STRVEChasMatchcxx . . $ STRVEChasMatch(92c872240fc31e6). (constSTRVECcxx . . $ constSTRVEC# const& labels, conststring32cxx . . $ conststring32# label, kMelder_stringcxx . . $ kMelder_string# criterion, kMatchBoolean matchBoolean) { |
| 53 | bool match = true; |
| 54 | if (matchBoolean == kMatchBoolean::OR_) { |
| 55 | for (integercxx . . $ integer# istring = 1; istring <= labels.sizecxx . . $ _conststringvector#size.; istring ++) |
| 56 | if (Melder_stringMatchesCriterioncxx . . $ Melder_stringMatchesCriterion(3e677ada61cce709). (label, criterion, labels [cxx . . $ _conststringvector#`operator[]`(2065423e0524e64a).istring], true)) |
| 57 | return true; |
| 58 | match = false; |
| 59 | } else { // matchBoolean == kMatchBoolean::AND_ |
| 60 | for (integercxx . . $ integer# istring = 1; istring <= labels.sizecxx . . $ _conststringvector#size.; istring ++) |
| 61 | if (! (match = match && Melder_stringMatchesCriterioncxx . . $ Melder_stringMatchesCriterion(3e677ada61cce709). (label, criterion, labels [cxx . . $ _conststringvector#`operator[]`(2065423e0524e64a).istring], true))) |
| 62 | return false; |
| 63 | match = true; |
| 64 | } |
| 65 | return match; |
| 66 | } |
| 67 | |
| 68 | void structNavigationContext :: v1_info () { |
| 69 | // skipping parent classes |
| 70 | if (topicLabels && topicLabels ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). stringscxx . . $ structStrings#strings..sizecxx . . $ _autostringautovector#size. > 0) { |
| 71 | MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"\tTopic criterion: ", kMelder_string_getTextcxx . . $ kMelder_string_getText(200d4804e0521b21). (topicCriterion)); |
| 72 | MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"\tTopic match boolean: ", kMatchBoolean_getTextcxx . . $ kMatchBoolean_getText(f9e30f939a600905). (topicMatchBoolean)); |
| 73 | MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"\tNumber of Topic labels: ", topicLabels ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). stringscxx . . $ structStrings#strings..sizecxx . . $ _autostringautovector#size.); |
| 74 | } else { |
| 75 | MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"\tNo Topic labels defined"); |
| 76 | } |
| 77 | if (beforeLabels && beforeLabels ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). stringscxx . . $ structStrings#strings..sizecxx . . $ _autostringautovector#size. > 0) { |
| 78 | MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"\tBefore criterion: ", kMelder_string_getTextcxx . . $ kMelder_string_getText(200d4804e0521b21). (beforeCriterion)); |
| 79 | MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"\tBefore match boolean: ", kMatchBoolean_getTextcxx . . $ kMatchBoolean_getText(f9e30f939a600905). (beforeMatchBoolean)); |
| 80 | MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"\tNumber of Before labels: ", beforeLabels ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). stringscxx . . $ structStrings#strings..sizecxx . . $ _autostringautovector#size.); |
| 81 | } else { |
| 82 | MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"\tNo Before labels defined"); |
| 83 | } |
| 84 | if (afterLabels && afterLabels ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). stringscxx . . $ structStrings#strings..sizecxx . . $ _autostringautovector#size. > 0) { |
| 85 | MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"\tAfter criterion: ", kMelder_string_getTextcxx . . $ kMelder_string_getText(200d4804e0521b21). (afterCriterion)); |
| 86 | MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"\tAfter match boolean: ", kMatchBoolean_getTextcxx . . $ kMatchBoolean_getText(f9e30f939a600905). (afterMatchBoolean)); |
| 87 | MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"\tNumber of After labels: ", afterLabels ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). stringscxx . . $ structStrings#strings..sizecxx . . $ _autostringautovector#size.); |
| 88 | } else { |
| 89 | MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"\tNo After labels defined"); |
| 90 | } |
| 91 | MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"\tBefore and After use: ", kContext_combination_getTextcxx . . $ kContext_combination_getText(527f5b89810e7c61). (combinationCriterion)); |
| 92 | MelderInfo_writeLinecxx . . $ MelderInfo_writeLine(3eb398314feba58b). (U"\tExclude topic match: ", ( excludeTopicMatch ? U"yes" : U"no" )); |
| 93 | } |
| 94 | |
| 95 | autoNavigationContext NavigationContext_createTopicOnlycxx . . $ NavigationContext_createTopicOnly(87a6868f4a636b40). ( |
| 96 | constSTRVECcxx . . $ constSTRVEC# const& topicLabels, kMelder_stringcxx . . $ kMelder_string# topicCriterion, kMatchBoolean topicMatchBoolean) |
| 97 | { |
| 98 | try { |
| 99 | autoNavigationContext me = NavigationContext_createcxx . . $ NavigationContext_create(8c26f37f2df3028e). ( |
| 100 | topicLabels, topicCriterion, topicMatchBoolean, |
| 101 | {cxx . . $ _conststringvector#_conststringvector(49f6e7a06ebc5aa8). }, kMelder_stringcxx . . $ kMelder_string#::EQUAL_TOcxx . . $ kMelder_string#EQUAL_TO., kMatchBoolean::OR_, |
| 102 | {cxx . . $ _conststringvector#_conststringvector(49f6e7a06ebc5aa8). }, kMelder_stringcxx . . $ kMelder_string#::EQUAL_TOcxx . . $ kMelder_string#EQUAL_TO., kMatchBoolean::OR_, |
| 103 | kContext_combination::NO_BEFORE_AND_NO_AFTER, false |
| 104 | ); |
| 105 | return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 106 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 107 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"NavigationContext could not be created for Topic."); |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | autoNavigationContext NavigationContext_createBeforeAndTopiccxx . . $ NavigationContext_createBeforeAndTopic(fa8aa981845e444b). ( |
| 112 | constSTRVECcxx . . $ constSTRVEC# const& topicLabels, kMelder_stringcxx . . $ kMelder_string# topicCriterion, kMatchBoolean topicMatchBoolean, |
| 113 | constSTRVECcxx . . $ constSTRVEC# const& beforeLabels, kMelder_stringcxx . . $ kMelder_string# beforeCriterion, kMatchBoolean beforeMatchBoolean) |
| 114 | { |
| 115 | try { |
| 116 | autoNavigationContext me = NavigationContext_createcxx . . $ NavigationContext_create(8c26f37f2df3028e). ( |
| 117 | topicLabels, topicCriterion, topicMatchBoolean, |
| 118 | beforeLabels, beforeCriterion, kMatchBoolean::OR_, |
| 119 | {cxx . . $ _conststringvector#_conststringvector(49f6e7a06ebc5aa8). }, kMelder_stringcxx . . $ kMelder_string#::EQUAL_TOcxx . . $ kMelder_string#EQUAL_TO., kMatchBoolean::OR_, |
| 120 | kContext_combination::BEFORE, false |
| 121 | ); |
| 122 | return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 123 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 124 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"NavigationContext could not be created for Topic."); |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | static autoStringscxx . . $ autoStrings# Strings_createAsUniqueTokenscxx . . $ Strings_createAsUniqueTokens(30b823a6b9f47b9f). (constSTRVECcxx . . $ constSTRVEC# strings, conststring32cxx . . $ conststring32# where) { |
| 129 | autoStringscxx . . $ autoStrings# me = Strings_createFromSTRVECcxx . . $ Strings_createFromSTRVEC(b66ca11e948a00b5). (strings); |
| 130 | autoStringscxx . . $ autoStrings# thee = Data_copycxx . . $ Data_copy(97a542a26794c80e). (me.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 131 | Strings_sortcxx . . $ Strings_sort(1f79c244d2d6c1ef). (thee.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).()); |
| 132 | for (integercxx . . $ integer# istring = 2; istring <= thycxx . . $ `melder/melder.h:45:9`! numberOfStringscxx . . $ structStrings#numberOfStrings.; istring ++) |
| 133 | Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (! Melder_equcxx . . $ `melder/melder_str32.h:124:9`! (thycxx . . $ `melder/melder.h:45:9`! strings [istring].get(), thycxx . . $ `melder/melder.h:45:9`! strings [istring - 1].get()), |
| 134 | U"The ", where, U" labels should be unique, however \"", thycxx . . $ `melder/melder.h:45:9`! strings [istring].get(), U"\" occurs more than once."); |
| 135 | return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 136 | } |
| 137 | |
| 138 | autoNavigationContext NavigationContext_createcxx . . $ NavigationContext_create(8c26f37f2df3028e). ( |
| 139 | constSTRVECcxx . . $ constSTRVEC# const& topicLabels, kMelder_stringcxx . . $ kMelder_string# topicCriterion, kMatchBoolean topicMatchBoolean, |
| 140 | constSTRVECcxx . . $ constSTRVEC# const& beforeLabels, kMelder_stringcxx . . $ kMelder_string# beforeCriterion, kMatchBoolean beforeMatchBoolean, |
| 141 | constSTRVECcxx . . $ constSTRVEC# const& afterLabels, kMelder_stringcxx . . $ kMelder_string# afterCriterion, kMatchBoolean afterMatchBoolean, |
| 142 | kContext_combination combinationCriterion, bool excludeTopicMatch) |
| 143 | { |
| 144 | try { |
| 145 | Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (! (excludeTopicMatch && combinationCriterion == kContext_combination::NO_BEFORE_AND_NO_AFTER), |
| 146 | U"You should not exclude Before & After & Topic from matching. One of the three should be included."); |
| 147 | autoNavigationContext me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (NavigationContext); |
| 148 | mycxx . . $ `melder/melder.h:44:9`! topicLabels =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). Strings_createAsUniqueTokenscxx . . $ Strings_createAsUniqueTokens(30b823a6b9f47b9f). (topicLabels, U"Topic"); |
| 149 | mycxx . . $ `melder/melder.h:44:9`! topicCriterion = topicCriterion; |
| 150 | mycxx . . $ `melder/melder.h:44:9`! topicMatchBoolean = topicMatchBoolean; |
| 151 | mycxx . . $ `melder/melder.h:44:9`! beforeLabels =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). Strings_createAsUniqueTokenscxx . . $ Strings_createAsUniqueTokens(30b823a6b9f47b9f). (beforeLabels, U"Before"); |
| 152 | mycxx . . $ `melder/melder.h:44:9`! beforeCriterion = beforeCriterion; |
| 153 | mycxx . . $ `melder/melder.h:44:9`! beforeMatchBoolean = beforeMatchBoolean; |
| 154 | mycxx . . $ `melder/melder.h:44:9`! afterLabels =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). Strings_createAsUniqueTokenscxx . . $ Strings_createAsUniqueTokens(30b823a6b9f47b9f). (afterLabels, U"After"); |
| 155 | mycxx . . $ `melder/melder.h:44:9`! afterCriterion = afterCriterion; |
| 156 | mycxx . . $ `melder/melder.h:44:9`! afterMatchBoolean = afterMatchBoolean; |
| 157 | mycxx . . $ `melder/melder.h:44:9`! combinationCriterion = combinationCriterion; |
| 158 | if (combinationCriterion == kContext_combination::BEFORE && beforeLabels.sizecxx . . $ _conststringvector#size. == 0) |
| 159 | Strings_insertcxx . . $ Strings_insert(48d18350c34fd7ae). (mycxx . . $ `melder/melder.h:44:9`! beforeLabels.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 1, U""); |
| 160 | else if (combinationCriterion == kContext_combination::AFTER && afterLabels.sizecxx . . $ _conststringvector#size. == 0) |
| 161 | Strings_insertcxx . . $ Strings_insert(48d18350c34fd7ae). (mycxx . . $ `melder/melder.h:44:9`! afterLabels.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 1, U""); |
| 162 | else if (combinationCriterion == kContext_combination::BEFORE_AND_AFTER || combinationCriterion == kContext_combination::BEFORE_OR_AFTER_NOT_BOTH || |
| 163 | combinationCriterion == kContext_combination::BEFORE_OR_AFTER_OR_BOTH) { |
| 164 | if (beforeLabels.sizecxx . . $ _conststringvector#size. == 0) |
| 165 | Strings_insertcxx . . $ Strings_insert(48d18350c34fd7ae). (mycxx . . $ `melder/melder.h:44:9`! beforeLabels.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 1, U""); |
| 166 | if (afterLabels.sizecxx . . $ _conststringvector#size. == 0) |
| 167 | Strings_insertcxx . . $ Strings_insert(48d18350c34fd7ae). (mycxx . . $ `melder/melder.h:44:9`! afterLabels.getcxx . . $ autoSomeThing#get(34d6acfd341ba7ab).(), 1, U""); |
| 168 | } |
| 169 | mycxx . . $ `melder/melder.h:44:9`! excludeTopicMatch = excludeTopicMatch; |
| 170 | return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 171 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 172 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"NavigationContext could not be created."); |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | static void Strings_checkIfUniqueLabelscxx . . $ Strings_checkIfUniqueLabels(1f79c244d2d6c1ef). (Stringscxx . . $ Strings# me) { |
| 177 | autoDistributionscxx . . $ autoDistributions# distributions = Strings_to_Distributionscxx . . $ Strings_to_Distributions(51ca0faf08ce563). (me); |
| 178 | Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (distributions -> numberOfRows != mycxx . . $ `melder/melder.h:44:9`! numberOfStrings, |
| 179 | U"There should be no duplicate labels."); |
| 180 | } |
| 181 | |
| 182 | void NavigationContext_replaceTopicLabelscxx . . $ NavigationContext_replaceTopicLabels(8cb6085299eb9dce). (NavigationContext me, Stringscxx . . $ Strings# labels) { |
| 183 | try { |
| 184 | Strings_checkIfUniqueLabelscxx . . $ Strings_checkIfUniqueLabels(1f79c244d2d6c1ef). (labels); |
| 185 | mycxx . . $ `melder/melder.h:44:9`! topicLabels =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). Data_copycxx . . $ Data_copy(97a542a26794c80e). (labels); |
| 186 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 187 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": cannot replace Topic labels from ", labels, U"."); |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | void NavigationContext_replaceBeforeLabelscxx . . $ NavigationContext_replaceBeforeLabels(8cb6085299eb9dce). (NavigationContext me, Stringscxx . . $ Strings# labels) { |
| 192 | try { |
| 193 | Strings_checkIfUniqueLabelscxx . . $ Strings_checkIfUniqueLabels(1f79c244d2d6c1ef). (labels); |
| 194 | mycxx . . $ `melder/melder.h:44:9`! beforeLabels =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). Data_copycxx . . $ Data_copy(97a542a26794c80e). (labels); |
| 195 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 196 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": cannot replace Before labels from ", labels, U"."); |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | void NavigationContext_replaceAfterLabelscxx . . $ NavigationContext_replaceAfterLabels(8cb6085299eb9dce). (NavigationContext me, Stringscxx . . $ Strings# labels) { |
| 201 | try { |
| 202 | Strings_checkIfUniqueLabelscxx . . $ Strings_checkIfUniqueLabels(1f79c244d2d6c1ef). (labels); |
| 203 | mycxx . . $ `melder/melder.h:44:9`! afterLabels =cxx . . $ autoSomeThing#`operator=`(80cc59814f7161e8). Data_copycxx . . $ Data_copy(97a542a26794c80e). (labels); |
| 204 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 205 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": cannot replace After labels from ", labels, U"."); |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | void NavigationContext_modifyTopicCriterioncxx . . $ NavigationContext_modifyTopicCriterion(c45a15ae190e64a0). (NavigationContext me, kMelder_stringcxx . . $ kMelder_string# criterion, kMatchBoolean matchBoolean) { |
| 210 | Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (mycxx . . $ `melder/melder.h:44:9`! topicLabels && mycxx . . $ `melder/melder.h:44:9`! topicLabels -> numberOfStrings > 0, |
| 211 | U"There are no Topic labels."); |
| 212 | mycxx . . $ `melder/melder.h:44:9`! topicCriterion = criterion; |
| 213 | mycxx . . $ `melder/melder.h:44:9`! topicMatchBoolean = matchBoolean; |
| 214 | } |
| 215 | |
| 216 | void NavigationContext_modifyBeforeCriterioncxx . . $ NavigationContext_modifyBeforeCriterion(c45a15ae190e64a0). (NavigationContext me, kMelder_stringcxx . . $ kMelder_string# criterion, kMatchBoolean matchBoolean) { |
| 217 | Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (mycxx . . $ `melder/melder.h:44:9`! beforeLabels && mycxx . . $ `melder/melder.h:44:9`! beforeLabels -> numberOfStrings > 0, |
| 218 | U"There are no Before labels."); |
| 219 | mycxx . . $ `melder/melder.h:44:9`! beforeCriterion = criterion; |
| 220 | mycxx . . $ `melder/melder.h:44:9`! beforeMatchBoolean = matchBoolean; |
| 221 | } |
| 222 | |
| 223 | void NavigationContext_modifyAfterCriterioncxx . . $ NavigationContext_modifyAfterCriterion(c45a15ae190e64a0). (NavigationContext me, kMelder_stringcxx . . $ kMelder_string# criterion, kMatchBoolean matchBoolean) { |
| 224 | Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (mycxx . . $ `melder/melder.h:44:9`! afterLabels && mycxx . . $ `melder/melder.h:44:9`! afterLabels -> numberOfStrings > 0, |
| 225 | U"There are no After labels."); |
| 226 | mycxx . . $ `melder/melder.h:44:9`! afterCriterion = criterion; |
| 227 | mycxx . . $ `melder/melder.h:44:9`! afterMatchBoolean = matchBoolean; |
| 228 | } |
| 229 | |
| 230 | void NavigationContext_modifyUseCriterioncxx . . $ NavigationContext_modifyUseCriterion(f83477fabe84a2b9). (NavigationContext me, kContext_combination combinationCriterion, bool excludeTopicMatch) { |
| 231 | const bool hasBefore = ( mycxx . . $ `melder/melder.h:44:9`! beforeLabels && mycxx . . $ `melder/melder.h:44:9`! beforeLabels ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). stringscxx . . $ structStrings#strings..sizecxx . . $ _autostringautovector#size. > 0 ); |
| 232 | const bool hasAfter = ( mycxx . . $ `melder/melder.h:44:9`! afterLabels && mycxx . . $ `melder/melder.h:44:9`! afterLabels ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). stringscxx . . $ structStrings#strings..sizecxx . . $ _autostringautovector#size. > 0 ); |
| 233 | if (combinationCriterion == kContext_combination::BEFORE) |
| 234 | Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (hasBefore, |
| 235 | U"For the ", kContext_combination_getText (combinationCriterion), U" criterion the NavigationContext should have Before labels."); |
| 236 | if (combinationCriterion == kContext_combination::AFTER) |
| 237 | Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (hasAfter, |
| 238 | U"For the ", kContext_combination_getText (combinationCriterion), U" criterion the NavigationContext should have After labels."); |
| 239 | if (combinationCriterion == kContext_combination::BEFORE_AND_AFTER || combinationCriterion == kContext_combination::BEFORE_OR_AFTER_NOT_BOTH || |
| 240 | combinationCriterion == kContext_combination::BEFORE_OR_AFTER_OR_BOTH) |
| 241 | Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (hasBefore && hasAfter, |
| 242 | U"For the ", kContext_combination_getText (combinationCriterion), U" criterion the NavigationContext should have Before and After labels."); |
| 243 | if (excludeTopicMatch) |
| 244 | Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (hasBefore || hasAfter, |
| 245 | U"For the ", kContext_combination_getText (combinationCriterion), U" criterion the NavigationContext should have Before or After labels."); |
| 246 | mycxx . . $ `melder/melder.h:44:9`! excludeTopicMatch = excludeTopicMatch; |
| 247 | mycxx . . $ `melder/melder.h:44:9`! combinationCriterion = combinationCriterion; |
| 248 | } |
| 249 | |
| 250 | bool NavigationContext_isTopicLabelcxx . . $ NavigationContext_isTopicLabel(f3fe4a9aac5707a0). (NavigationContext me, conststring32cxx . . $ conststring32# label) { |
| 251 | return ( mycxx . . $ `melder/melder.h:44:9`! topicLabels && STRVEChasMatchcxx . . $ STRVEChasMatch(92c872240fc31e6). (mycxx . . $ `melder/melder.h:44:9`! topicLabels ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). stringscxx . . $ structStrings#strings..getcxx . . $ _autostringautovector#get(9d56076a9ef7dd02).(), label, mycxx . . $ `melder/melder.h:44:9`! topicCriterion, mycxx . . $ `melder/melder.h:44:9`! topicMatchBoolean) ); |
| 252 | } |
| 253 | |
| 254 | bool NavigationContext_isBeforeLabelcxx . . $ NavigationContext_isBeforeLabel(f3fe4a9aac5707a0). (NavigationContext me, conststring32cxx . . $ conststring32# label) { |
| 255 | return ( mycxx . . $ `melder/melder.h:44:9`! beforeLabels && STRVEChasMatchcxx . . $ STRVEChasMatch(92c872240fc31e6). (mycxx . . $ `melder/melder.h:44:9`! beforeLabels ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). stringscxx . . $ structStrings#strings..getcxx . . $ _autostringautovector#get(9d56076a9ef7dd02).(), label, mycxx . . $ `melder/melder.h:44:9`! beforeCriterion, mycxx . . $ `melder/melder.h:44:9`! beforeMatchBoolean) ); |
| 256 | } |
| 257 | |
| 258 | bool NavigationContext_isAfterLabelcxx . . $ NavigationContext_isAfterLabel(f3fe4a9aac5707a0). (NavigationContext me, conststring32cxx . . $ conststring32# label) { |
| 259 | return ( mycxx . . $ `melder/melder.h:44:9`! afterLabels && STRVEChasMatchcxx . . $ STRVEChasMatch(92c872240fc31e6). (mycxx . . $ `melder/melder.h:44:9`! afterLabels ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). stringscxx . . $ structStrings#strings..getcxx . . $ _autostringautovector#get(9d56076a9ef7dd02).(), label, mycxx . . $ `melder/melder.h:44:9`! afterCriterion, mycxx . . $ `melder/melder.h:44:9`! afterMatchBoolean) ); |
| 260 | } |
| 261 | |
| 262 | /* End of file NavigationContext.cpp */ |