Vuo
2.1.2
type
VuoTextCase.c
Go to the documentation of this file.
1
10
#include <string.h>
11
#include "
type.h
"
12
14
#ifdef VUO_COMPILER
15
VuoModuleMetadata
({
16
"title"
:
"Text Case"
,
17
"description"
:
"Describes text casing styles."
,
18
"keywords"
: [ ],
19
"version"
:
"1.0.0"
,
20
"dependencies"
: [
21
"VuoList_VuoTextCase"
22
]
23
});
24
#endif
25
31
VuoTextCase
VuoTextCase_makeFromJson
(
json_object
*js)
32
{
33
const
char
*valueAsString =
""
;
34
35
if
(json_object_get_type(js) == json_type_string)
36
valueAsString = json_object_get_string(js);
37
38
if
( strcmp(valueAsString,
"lower"
) == 0 )
39
return
VuoTextCase_LowercaseAll
;
40
else
if
( strcmp(valueAsString,
"upper"
) == 0 )
41
return
VuoTextCase_UppercaseAll
;
42
else
if
( strcmp(valueAsString,
"word"
) == 0 )
43
return
VuoTextCase_UppercaseFirstLetterWord
;
44
45
return
VuoTextCase_UppercaseFirstLetterSentence
;
46
}
47
52
json_object
*
VuoTextCase_getJson
(
const
VuoTextCase
value)
53
{
54
char
*valueAsString =
"sentence"
;
55
56
if
( value ==
VuoTextCase_LowercaseAll
)
57
valueAsString =
"lower"
;
58
else
if
( value ==
VuoTextCase_UppercaseAll
)
59
valueAsString =
"upper"
;
60
else
if
( value ==
VuoTextCase_UppercaseFirstLetterWord
)
61
valueAsString =
"word"
;
62
63
return
json_object_new_string(valueAsString);
64
}
65
69
VuoList_VuoTextCase
VuoTextCase_getAllowedValues
(
void
)
70
{
71
VuoList_VuoTextCase
l =
VuoListCreate_VuoTextCase
();
72
VuoListAppendValue_VuoTextCase
(l,
VuoTextCase_LowercaseAll
);
73
VuoListAppendValue_VuoTextCase
(l,
VuoTextCase_UppercaseAll
);
74
VuoListAppendValue_VuoTextCase
(l,
VuoTextCase_UppercaseFirstLetterWord
);
75
VuoListAppendValue_VuoTextCase
(l,
VuoTextCase_UppercaseFirstLetterSentence
);
76
return
l;
77
}
78
83
char
*
VuoTextCase_getSummary
(
const
VuoTextCase
value)
84
{
85
char
*valueAsString =
"Uppercase first letter of each sentence"
;
86
87
if
( value ==
VuoTextCase_LowercaseAll
)
88
valueAsString =
"Lowercase all"
;
89
else
if
( value ==
VuoTextCase_UppercaseAll
)
90
valueAsString =
"Uppercase all"
;
91
else
if
( value ==
VuoTextCase_UppercaseFirstLetterWord
)
92
valueAsString =
"Uppercase first letter of each word"
;
93
94
return
strdup(valueAsString);
95
}
Generated on Tue Jul 14 2020 23:19:42 for Vuo by
1.8.18