| 1 | /* Categories_and_Strings.cpp |
| 2 | * |
| 3 | * Copyright (C) 1993-2018 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 | /* |
| 20 | djmw 20020315 GPL header |
| 21 | djmw 20110304 Thing_new |
| 22 | */ |
| 23 | |
| 24 | #include "Categories_and_Strings.h"cxx . . $ `<file>/dwtools/Categories_and_Strings.h`/ |
| 25 | |
| 26 | autoStringscxx . . $ autoStrings# Categories_to_Stringscxx . . $ Categories_to_Strings(41f68e334bf104d6). (Categoriescxx . . $ Categories# me) { |
| 27 | try { |
| 28 | Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (mycxx . . $ `melder/melder.h:44:9`! size > 0, |
| 29 | U"There should be at least one category present."); |
| 30 | |
| 31 | autoStringscxx . . $ autoStrings# thee = Thing_newcxx . . $ `sys/Thing.h:514:9`! (Strings); |
| 32 | thycxx . . $ `melder/melder.h:45:9`! stringscxx . . $ structStrings#strings. =cxx . . $ _autostringautovector#`operator=`(150f7ba7aac25b7e). autoSTRVECcxx . . $ autoSTRVEC# (mycxx . . $ `melder/melder.h:44:9`! sizecxx . . $ CollectionOf#size.); |
| 33 | thycxx . . $ `melder/melder.h:45:9`! numberOfStringscxx . . $ structStrings#numberOfStrings. = mycxx . . $ `melder/melder.h:44:9`! sizecxx . . $ CollectionOf#size.; |
| 34 | |
| 35 | for (integercxx . . $ integer# i = 1; i <= mycxx . . $ `melder/melder.h:44:9`! sizecxx . . $ CollectionOf#size.; i ++) { |
| 36 | const SimpleStringcxx . . $ SimpleString# s = mycxx . . $ `melder/melder.h:44:9`! atcxx . . $ CollectionOf#at. [cxx . . $ ArrayOf#`operator[]`(a7f36fee1ae21897).i]; |
| 37 | 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).()); |
| 38 | } |
| 39 | return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 40 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 41 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": not converted to Strings."); |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | autoCategoriescxx . . $ autoCategories# Strings_to_Categoriescxx . . $ Strings_to_Categories(b35d01c7d3dd524f). (Stringscxx . . $ Strings# me) { |
| 46 | try { |
| 47 | Melder_requirecxx . . $ `melder/melder_require.h:21:9`! (mycxx . . $ `melder/melder.h:44:9`! numberOfStrings > 0, U"Empty strings."); |
| 48 | |
| 49 | autoCategoriescxx . . $ autoCategories# thee = Thing_newcxx . . $ `sys/Thing.h:514:9`! (Categories); |
| 50 | thycxx . . $ `melder/melder.h:45:9`! _growcxx . . $ CollectionOf#_grow(1624ee8275b10bda). (mycxx . . $ `melder/melder.h:44:9`! numberOfStringscxx . . $ structStrings#numberOfStrings.); |
| 51 | |
| 52 | for (integercxx . . $ integer# i = 1; i <= mycxx . . $ `melder/melder.h:44:9`! numberOfStringscxx . . $ structStrings#numberOfStrings.; i ++) { |
| 53 | autoSimpleStringcxx . . $ autoSimpleString# s = SimpleString_createcxx . . $ SimpleString_create(d4d4ea089a1063c6). (mycxx . . $ `melder/melder.h:44:9`! stringscxx . . $ structStrings#strings. [cxx . . $ _autostringautovector#`operator[]`(f191be2b65019068).i].getcxx . . $ _autostring#get(5a2a78a048fb49a8).()); |
| 54 | thycxx . . $ `melder/melder.h:45:9`! addItem_movecxx . . $ CollectionOf#addItem_move(bcc0cff787be24fe). (scxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f)..movecxx . . $ autoSomeThing#move(25acc3554b7d1642).()); |
| 55 | } |
| 56 | return theecxx . . $ autoSomeThing#autoSomeThing(b79141a71f7bc86f).; |
| 57 | } catch (MelderErrorcxx . . $ MelderError#) { |
| 58 | Melder_throwcxx . . $ `melder/melder_error.h:77:9`! (me, U": not converted."); |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | /* End of file Categories_and_Strings.cpp */ |