Esempio n. 1
0
autoCategories Categories_create () {
	try {
		autoCategories me = Thing_new (Categories);
		Categories_init (me.peek(), 10);
		return me;
	} catch (MelderError) {
		Melder_throw (U"Categories not created.");
	}
}
autoCategories Strings_to_Categories (Strings me) {
	try {
		if (my numberOfStrings < 1) {
			Melder_throw (U"Empty strings.");
		}
		autoCategories thee = Thing_new (Categories);
		Categories_init (thee.peek(), my numberOfStrings);

		for (long i = 1; i <= my numberOfStrings; i++) {
			autoSimpleString s = SimpleString_create (my strings[i]);
			Collection_addItem_move (thee.peek(), s.move());
		}
		return thee;
	} catch (MelderError) {
		Melder_throw (me, U": not converted.");
	}
}