| 1 | /* Strings_extensions.cpp |
| 2 | * |
| 3 | * Copyright (C) 1993-2012,2015-2022 David Weenink, 2015-2021 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. 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 | /* |
| 20 | djmw 20011003 |
| 21 | */ |
| 22 | |
| 23 | #include "Strings_extensions.h"cxx . . $ `<file>/dwtools/Strings_extensions.h`/ |
| 24 | #include "NUM2.h"cxx . . $ `<file>/dwsys/NUM2.h`/ |
| 25 | |
| 26 | autoStringscxx . . $ autoStrings# Strings_createFixedLengthcxx . . $ Strings_createFixedLength(4779411fb981e1c). (integercxx . . $ integer# numberOfStrings) { |
| 27 | try { |
| 28 | Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (numberOfStrings >= 0, |
| 29 | U"The number of strings should not be negative."); |
| 30 | autoStringscxx . . $ autoStrings# me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (Strings); |
| 31 | mycxx . . $ `melder/melder.h:44:9`! stringscxx . . $ structStrings#strings. =cxx . . $ _autostringautovector#`operator=`(150f7ba7aac25b7e). autoSTRVECcxx . . $ autoSTRVEC# (numberOfStrings); |
| 32 | mycxx . . $ `melder/melder.h:44:9`! numberOfStringscxx . . $ structStrings#numberOfStrings. = numberOfStrings; |
| 33 | return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 34 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 35 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Strings not created."); |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | autoStringscxx . . $ autoStrings# Strings_createAsCharacterscxx . . $ Strings_createAsCharacters(9acdfa623bce7965). (conststring32cxx . . $ conststring32# string) { |
| 40 | try { |
| 41 | autoStringscxx . . $ autoStrings# me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (Strings); |
| 42 | mycxx . . $ `melder/melder.h:44:9`! numberOfStringscxx . . $ structStrings#numberOfStrings. = Melder_lengthcxx . . $ Melder_length(3fae411214b133ad). (string); |
| 43 | mycxx . . $ `melder/melder.h:44:9`! stringscxx . . $ structStrings#strings. =cxx . . $ _autostringautovector#`operator=`(150f7ba7aac25b7e). autoSTRVECcxx . . $ autoSTRVEC# (mycxx . . $ `melder/melder.h:44:9`! numberOfStringscxx . . $ structStrings#numberOfStrings.); |
| 44 | for (integercxx . . $ integer# i = 1; i <= mycxx . . $ `melder/melder.h:44:9`! numberOfStringscxx . . $ structStrings#numberOfStrings.; i ++) |
| 45 | mycxx . . $ `melder/melder.h:44:9`! stringscxx . . $ structStrings#strings. [cxx . . $ _autostringautovector#`operator[]`(f191be2b65019068).i] =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (Melder_charactercxx . . $ Melder_character(7ee4a1927ac5447f). (*string ++)); |
| 46 | return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 47 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 48 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Strings from characters not created."); |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | autoStringscxx . . $ autoStrings# Strings_createAsTokenscxx . . $ Strings_createAsTokens(46a782a57ff120bc). (conststring32cxx . . $ conststring32# token_string, conststring32cxx . . $ conststring32# separator_string) { |
| 53 | try { |
| 54 | autoStringscxx . . $ autoStrings# me = Thing_newcxx . . $ `sys/Thing.h:514:9`! (Strings); |
| 55 | /* |
| 56 | 1. make a copy |
| 57 | 2. replace all separators by 0 in the copy |
| 58 | 3. count the items in the copy |
| 59 | 4. copy the tokens from the copy to the Strings object |
| 60 | |
| 61 | The algorithm is not the most efficient one since the token string is processed 4 times. |
| 62 | However the steps taken are easy to follow. |
| 63 | */ |
| 64 | if (! token_string || token_string [0] == U'\0') |
| 65 | return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 66 | |
| 67 | const conststring32cxx . . $ conststring32# separators = ( separator_string && separator_string [0] != U'\0' ? separator_string : U" " ); |
| 68 | autostring32cxx . . $ autostring32# copy = Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (token_string); |
| 69 | mutablestring32cxx . . $ mutablestring32# tokens = copy.getcxx . . $ _autostring#get(5a2a78a048fb49a8).(); |
| 70 | char32cxx . . $ char32# *index = & tokens [0]; |
| 71 | integercxx . . $ integer# numberOfTokens = 0; |
| 72 | for (const char32cxx . . $ char32# *indexs = & token_string [0]; *indexs != U'\0'; indexs ++, index ++) { |
| 73 | for (const char32cxx . . $ char32# *s = & separators [0]; *s != U'\0'; s ++) { |
| 74 | if (*index == *s) { |
| 75 | *index = U'\0'; |
| 76 | if (index > tokens && *(index - 1) != U'\0') |
| 77 | numberOfTokens ++; |
| 78 | break; |
| 79 | } |
| 80 | } |
| 81 | } |
| 82 | if (*(index - 1) != U'\0') // if token_string ends with a non-separator |
| 83 | numberOfTokens ++; |
| 84 | mycxx . . $ `melder/melder.h:44:9`! numberOfStringscxx . . $ structStrings#numberOfStrings. = numberOfTokens; |
| 85 | mycxx . . $ `melder/melder.h:44:9`! stringscxx . . $ structStrings#strings. =cxx . . $ _autostringautovector#`operator=`(150f7ba7aac25b7e). autoSTRVECcxx . . $ autoSTRVEC# (mycxx . . $ `melder/melder.h:44:9`! numberOfStringscxx . . $ structStrings#numberOfStrings.); |
| 86 | numberOfTokens = 0; |
| 87 | char32cxx . . $ char32# *start = tokens; |
| 88 | index = & tokens [0]; |
| 89 | for (const char32cxx . . $ char32# *indexs = & token_string [0]; *indexs != U'\0'; indexs ++, index ++) { |
| 90 | if (*index == U'\0' && index > tokens && *(index - 1) != U'\0') |
| 91 | mycxx . . $ `melder/melder.h:44:9`! stringscxx . . $ structStrings#strings. [cxx . . $ _autostringautovector#`operator[]`(f191be2b65019068).++ numberOfTokens] =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (start); |
| 92 | if (*index != U'\0' && index > tokens && *(index - 1) == U'\0') |
| 93 | start = index; |
| 94 | } |
| 95 | if (*(index - 1) != U'\0') |
| 96 | mycxx . . $ `melder/melder.h:44:9`! stringscxx . . $ structStrings#strings. [cxx . . $ _autostringautovector#`operator[]`(f191be2b65019068).++ numberOfTokens] =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (start); |
| 97 | return mecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 98 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 99 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Strings as tokens not created."); |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | autoStringscxx . . $ autoStrings# Strings_appendcxx . . $ Strings_append(7400b63c973e9c9e). (OrderedOfcxx . . $ OrderedOf#<structStringscxx . . $ structStrings#>* me) { |
| 104 | try { |
| 105 | integercxx . . $ integer# index = 1, numberOfStrings = 0; |
| 106 | for (integercxx . . $ integer# i = 1; i <= mycxx . . $ `melder/melder.h:44:9`! sizecxx . . $ CollectionOf#size.; i ++) { |
| 107 | const Stringscxx . . $ Strings# s = mycxx . . $ `melder/melder.h:44:9`! atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).i]; |
| 108 | numberOfStrings += s -> numberOfStringscxx . . $ structStrings#numberOfStrings.; |
| 109 | } |
| 110 | autoStringscxx . . $ autoStrings# thee = Strings_createFixedLengthcxx . . $ Strings_createFixedLength(4779411fb981e1c). (numberOfStrings); |
| 111 | for (integercxx . . $ integer# i = 1; i <= mycxx . . $ `melder/melder.h:44:9`! sizecxx . . $ CollectionOf#size.; i ++) { |
| 112 | const Stringscxx . . $ Strings# s = mycxx . . $ `melder/melder.h:44:9`! atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).i]; |
| 113 | for (integercxx . . $ integer# j = 1; j <= s -> numberOfStringscxx . . $ structStrings#numberOfStrings.; j ++, index ++) |
| 114 | thycxx . . $ `melder/melder.h:45:9`! stringscxx . . $ structStrings#strings. [cxx . . $ _autostringautovector#`operator[]`(f191be2b65019068).index] =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (s -> stringscxx . . $ structStrings#strings. [cxx . . $ _autostringautovector#`operator[]`(f191be2b65019068).j].getcxx . . $ _autostring#get(5a2a78a048fb49a8).()); |
| 115 | } |
| 116 | return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 117 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 118 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": not appended."); |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | autoStringscxx . . $ autoStrings# Strings_changecxx . . $ Strings_change(76dfb0b0a4a65ffa). (Stringscxx . . $ Strings# me, conststring32cxx . . $ conststring32# search, conststring32cxx . . $ conststring32# replace, int maximumNumberOfReplaces, integercxx . . $ integer# *nmatches, integercxx . . $ integer# *nstringmatches, bool use_regexp) { |
| 123 | try { |
| 124 | autoStringscxx . . $ autoStrings# thee = Thing_newcxx . . $ `sys/Thing.h:514:9`! (Strings); |
| 125 | autoSTRVECcxx . . $ autoSTRVEC# strings = string32vector_searchAndReplacecxx . . $ string32vector_searchAndReplace(97193444c8efba6). (mycxx . . $ `melder/melder.h:44:9`! stringscxx . . $ structStrings#strings..getcxx . . $ _autostringautovector#get(9d56076a9ef7dd02).(), |
| 126 | search, replace, maximumNumberOfReplaces, nmatches, nstringmatches, use_regexp); |
| 127 | thycxx . . $ `melder/melder.h:45:9`! numberOfStringscxx . . $ structStrings#numberOfStrings. = mycxx . . $ `melder/melder.h:44:9`! numberOfStringscxx . . $ structStrings#numberOfStrings.; |
| 128 | thycxx . . $ `melder/melder.h:45:9`! stringscxx . . $ structStrings#strings. =cxx . . $ _autostringautovector#`operator=`(150f7ba7aac25b7e). stdcxx . . $ std/::movecxx . . $ std/move(e35c19a1ba7baa26). (strings); |
| 129 | return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 130 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 131 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": not changed."); |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | autoStringscxx . . $ autoStrings# Strings_createFromSTRVECcxx . . $ Strings_createFromSTRVEC(b66ca11e948a00b5). (constSTRVECcxx . . $ constSTRVEC# const& strings) { |
| 136 | try { |
| 137 | autoStringscxx . . $ autoStrings# thee = Strings_createFixedLengthcxx . . $ Strings_createFixedLength(4779411fb981e1c). (strings.sizecxx . . $ _conststringvector#size.); |
| 138 | for (integercxx . . $ integer# i = 1; i <= strings.sizecxx . . $ _conststringvector#size.; i ++) |
| 139 | thycxx . . $ `melder/melder.h:45:9`! stringscxx . . $ structStrings#strings. [cxx . . $ _autostringautovector#`operator[]`(f191be2b65019068).i] =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (strings [cxx . . $ _conststringvector#`operator[]`(2065423e0524e64a).i]); |
| 140 | return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 141 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 142 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (U"Strings not created."); |
| 143 | } |
| 144 | } |
| 145 | |
| 146 | autoStringscxx . . $ autoStrings# Strings_extractPartcxx . . $ Strings_extractPart(bfb81efa69f23511). (Stringscxx . . $ Strings# me, integercxx . . $ integer# from, integercxx . . $ integer# to) { |
| 147 | try { |
| 148 | Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (from > 0 && from <= to && to <= mycxx . . $ `melder/melder.h:44:9`! numberOfStrings, |
| 149 | U"Strings_extractPart: begin and end should be in interval [1, ", mycxx . . $ `melder/melder.h:44:9`! numberOfStrings, U"]."); |
| 150 | return Strings_createFromSTRVECcxx . . $ Strings_createFromSTRVEC(b66ca11e948a00b5). (mycxx . . $ `melder/melder.h:44:9`! stringscxx . . $ structStrings#strings..partcxx . . $ _autostringautovector#part(862ae67a684f15c7). (from, to)); |
| 151 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 152 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": no part extracted."); |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | autoPermutationcxx . . $ autoPermutation# Strings_to_Permutationcxx . . $ Strings_to_Permutation(4535383de796ed86). (Stringscxx . . $ Strings# me, kStrings_sortingcxx . . $ kStrings_sorting# sorting) { |
| 157 | try { |
| 158 | return Permutation_createAsSortingIndexcxx . . $ Permutation_createAsSortingIndex(57823860738f5352). (mycxx . . $ `melder/melder.h:44:9`! stringscxx . . $ structStrings#strings..getcxx . . $ _autostringautovector#get(9d56076a9ef7dd02).(), sorting); |
| 159 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 160 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": no Permutation created."); |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | autoStringscxx . . $ autoStrings# Strings_Permutation_permuteStringscxx . . $ Strings_Permutation_permuteStrings(96bf0a39f3d1f28d). (Stringscxx . . $ Strings# me, Permutationcxx . . $ Permutation# thee) { |
| 165 | try { |
| 166 | Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (mycxx . . $ `melder/melder.h:44:9`! numberOfStrings == thycxx . . $ `melder/melder.h:45:9`! numberOfElements, |
| 167 | U"Strings_Permutation_permuteStrings: The number of strings and the number of elements in the Permutation should be equal."); |
| 168 | autoStringscxx . . $ autoStrings# him = Strings_createFixedLengthcxx . . $ Strings_createFixedLength(4779411fb981e1c). (mycxx . . $ `melder/melder.h:44:9`! numberOfStringscxx . . $ structStrings#numberOfStrings.); |
| 169 | for (integercxx . . $ integer# i = 1; i <= thycxx . . $ `melder/melder.h:45:9`! numberOfElementscxx . . $ structPermutation#numberOfElements.; i ++) { |
| 170 | const integercxx . . $ integer# index = thycxx . . $ `melder/melder.h:45:9`! pcxx . . $ structPermutation#p. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i]; |
| 171 | hiscxx . . $ `melder/melder.h:47:9`! stringscxx . . $ structStrings#strings. [cxx . . $ _autostringautovector#`operator[]`(f191be2b65019068).i] =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (mycxx . . $ `melder/melder.h:44:9`! stringscxx . . $ structStrings#strings. [cxx . . $ _autostringautovector#`operator[]`(f191be2b65019068).index].getcxx . . $ _autostring#get(5a2a78a048fb49a8).()); |
| 172 | } |
| 173 | return himcxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 174 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 175 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": no permuted Strings created."); |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | autoStringsIndexcxx . . $ autoStringsIndex# Stringses_to_StringsIndexcxx . . $ Stringses_to_StringsIndex(4d8bb01cf73a31d6). (Stringscxx . . $ Strings# me, Stringscxx . . $ Strings# classes) { |
| 180 | try { |
| 181 | autoStringsIndexcxx . . $ autoStringsIndex# tmp = Strings_to_StringsIndexcxx . . $ Strings_to_StringsIndex(786a22033bf23ced). (classes, kStrings_sortingcxx . . $ kStrings_sorting#::ALPHABETICALcxx . . $ kStrings_sorting#ALPHABETICAL.); |
| 182 | const integercxx . . $ integer# numberOfClasses = tmp ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). classescxx . . $ structIndex#classes.->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab).sizecxx . . $ CollectionOf#size.; |
| 183 | |
| 184 | autoStringsIndexcxx . . $ autoStringsIndex# him = StringsIndex_createcxx . . $ StringsIndex_create(3d8cbadf5fb4569a). (mycxx . . $ `melder/melder.h:44:9`! numberOfStringscxx . . $ structStrings#numberOfStrings.); |
| 185 | for (integercxx . . $ integer# i = 1; i <= numberOfClasses; i ++) { |
| 186 | const SimpleStringcxx . . $ SimpleString# t = (SimpleStringcxx . . $ SimpleString#) tmp ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). classescxx . . $ structIndex#classes.->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab).atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).i]; // FIXME cast |
| 187 | autoSimpleStringcxx . . $ autoSimpleString# t2 = Data_copycxx . . $ Data_copy(97a542a26794c80e). (t); |
| 188 | hiscxx . . $ `melder/melder.h:47:9`! classescxx . . $ structIndex#classes. ->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab). addItem_movecxx . . $ CollectionOf#addItem_move(bcc0cff787be24fe). (t2cxx . . $ autoSomeThing#autoSomeThing(327dc2ad7b4df21)..movecxx . . $ autoSomeThing#move(25acc3554b7d1642).()); |
| 189 | } |
| 190 | for (integercxx . . $ integer# j = 1; j <= mycxx . . $ `melder/melder.h:44:9`! numberOfStringscxx . . $ structStrings#numberOfStrings.; j ++) { |
| 191 | integercxx . . $ integer# index = 0; |
| 192 | const conststring32cxx . . $ conststring32# stringsj = mycxx . . $ `melder/melder.h:44:9`! stringscxx . . $ structStrings#strings. [cxx . . $ _autostringautovector#`operator[]`(f191be2b65019068).j].getcxx . . $ _autostring#get(5a2a78a048fb49a8).(); |
| 193 | for (integercxx . . $ integer# i = 1; i <= numberOfClasses; i ++) { |
| 194 | SimpleStringcxx . . $ SimpleString# ss = (SimpleStringcxx . . $ SimpleString#) hiscxx . . $ `melder/melder.h:47:9`! classescxx . . $ structIndex#classes.->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab).atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).i]; // FIXME cast |
| 195 | if (Melder_equcxx . . $ `melder/melder_str32.h:124:9`! (stringsj, ss -> stringcxx . . $ structSimpleString#string..getcxx . . $ _autostring#get(5a2a78a048fb49a8).())) { |
| 196 | index = i; |
| 197 | break; |
| 198 | } |
| 199 | } |
| 200 | hiscxx . . $ `melder/melder.h:47:9`! classIndexcxx . . $ structIndex#classIndex. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).j] = index; |
| 201 | } |
| 202 | return himcxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 203 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 204 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": no StringsIndex created."); |
| 205 | } |
| 206 | } |
| 207 | |
| 208 | |
| 209 | autoStringscxx . . $ autoStrings# StringsIndex_to_Stringscxx . . $ StringsIndex_to_Strings(b89d0cf2901e5aac). (StringsIndexcxx . . $ StringsIndex# me) { |
| 210 | try { |
| 211 | autoStringscxx . . $ autoStrings# thee = Strings_createFixedLengthcxx . . $ Strings_createFixedLength(4779411fb981e1c). (mycxx . . $ `melder/melder.h:44:9`! numberOfItemscxx . . $ structIndex#numberOfItems.); |
| 212 | for (integercxx . . $ integer# i = 1; i <= mycxx . . $ `melder/melder.h:44:9`! numberOfItemscxx . . $ structIndex#numberOfItems.; i ++) { |
| 213 | const SimpleStringcxx . . $ SimpleString# s = (SimpleStringcxx . . $ SimpleString#) mycxx . . $ `melder/melder.h:44:9`! classescxx . . $ structIndex#classes.->cxx . . $ autoSomeThing#`operator->`(34d6acfd341ba7ab).atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).mycxx . . $ `melder/melder.h:44:9`! classIndexcxx . . $ structIndex#classIndex. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).i]]; // FIXME cast, FIXME classIndex |
| 214 | thycxx . . $ `melder/melder.h:45:9`! stringscxx . . $ structStrings#strings. [cxx . . $ _autostringautovector#`operator[]`(f191be2b65019068).i] =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (s -> stringcxx . . $ structSimpleString#string..getcxx . . $ _autostring#get(5a2a78a048fb49a8).()); |
| 215 | } |
| 216 | return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 217 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 218 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": no Strings created."); |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | autoStringsIndexcxx . . $ autoStringsIndex# Table_to_StringsIndex_columncxx . . $ Table_to_StringsIndex_column(12bba36fe9977926). (Tablecxx . . $ Table# me, integercxx . . $ integer# column, kStrings_sortingcxx . . $ kStrings_sorting# sorting) { |
| 223 | try { |
| 224 | Table_checkSpecifiedColumnNumberWithinRangecxx . . $ Table_checkSpecifiedColumnNumberWithinRange(305df77d18352539). (me, column); |
| 225 | const integercxx . . $ integer# numberOfRows = mycxx . . $ `melder/melder.h:44:9`! rowscxx . . $ structTable#rows..sizecxx . . $ CollectionOf#size.; |
| 226 | Table_numericize_acxx . . $ Table_numericize_a(305df77d18352539). (me, column); |
| 227 | autoSTRVECcxx . . $ autoSTRVEC# groupLabelscxx . . $ _autostringautovector#_autostringautovector(1624ee8275b10bda). (numberOfRows); |
| 228 | for (integercxx . . $ integer# irow = 1; irow <= numberOfRows; irow ++) |
| 229 | groupLabels [cxx . . $ _autostringautovector#`operator[]`(f191be2b65019068).irow] =cxx . . $ _autostring#`operator=`(f562943cbc4bcf37). Melder_dupcxx . . $ Melder_dup(87bf156b1f548402). (mycxx . . $ `melder/melder.h:44:9`! rowscxx . . $ structTable#rows..atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).irow] -> cellscxx . . $ structTableRow#cells. [cxx . . $ autovector#`operator[]`(8a4599b8835d1ce1).column]. stringcxx . . $ structTableCell#string..getcxx . . $ _autostring#get(5a2a78a048fb49a8).()); // TODO: no dup |
| 230 | |
| 231 | autoStringsIndexcxx . . $ autoStringsIndex# him = StringsIndex_createFromSTRVECcxx . . $ StringsIndex_createFromSTRVEC(e4dff117608d2bea). (groupLabelscxx . . $ _conststringvector#_conststringvector(93d9e701af42cb0d)..getcxx . . $ _autostringautovector#get(9d56076a9ef7dd02).(), sorting); |
| 232 | return himcxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 233 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 234 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U"No StringsIndex created from column ", column, U"."); |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | /* End of file Strings_extensions.cpp */ |