Exemplo n.º 1
0
/**
 * @ingroup VuoText
 * Creates a new UTF-8 C string from @c value, or, if it's more than 30 Unicode characters long, creates an aposiopesis.
 *
 * @eg{Hello World!}
 * @eg{I would like to convey my gree...}
 */
char * VuoText_summaryFromValue(const VuoText value)
{
	if (!value)
		return strdup("");

	const int maxLength = 30;
	if (VuoText_length(value) <= maxLength)
		return strdup(value);

	VuoText abbreviation = VuoText_substring(value, 1, maxLength);
	VuoText ellipsis = VuoText_make("...");
	VuoText summaryParts[2] = { abbreviation, ellipsis };
	VuoText summaryWhole = VuoText_append(summaryParts, 2);
	char *summary = strdup(summaryWhole);

	VuoRetain(abbreviation);
	VuoRelease(abbreviation);
	VuoRetain(ellipsis);
	VuoRelease(ellipsis);
	VuoRetain(summaryWhole);
	VuoRelease(summaryWhole);
	return summary;
}
Exemplo n.º 2
0
 * @copyright Copyright © 2012–2014 Kosada Incorporated.
 * This code may be modified and distributed under the terms of the MIT License.
 * For more information, see http://vuo.org/license.
 */

#include "node.h"

VuoModuleMetadata({
					 "title" : "Vuoize Text",
					 "description" : "Takes a text string and Vuoizes it (by prepending the word 'Vuo').",
					 "keywords" : [ ],
					 "version" : "1.0.0",
					 "dependencies" : [ ],
					 "node": {
						 "isInterface" : false
					 }
				 });

void nodeEvent
(
		VuoInputData(VuoText) text,
		VuoOutputData(VuoText) vuoizedText
)
{
	VuoText texts[2] = {
		"Vuo",
		text
	};
	*vuoizedText = VuoText_append(texts, 2);
}