Vuo  2.4.0
VuoTextSort.c
Go to the documentation of this file.
1
10#include "type.h"
11
13#ifdef VUO_COMPILER
15 "title" : "Text Sort Type",
16 "description" : "Ways that text can be interpreted for sorting.",
17 "keywords" : [ ],
18 "version" : "1.0.0",
19 "dependencies" : [
20 "VuoList_VuoTextSort"
21 ]
22 });
23#endif
25
31{
32 const char *valueAsString = "";
33 if (json_object_get_type(js) == json_type_string)
34 valueAsString = json_object_get_string(js);
35
36 if (strcmp(valueAsString, "text case-sensitive") == 0)
37 return VuoTextSort_TextCaseSensitive;
38 else if (strcmp(valueAsString, "number") == 0)
39 return VuoTextSort_Number;
40 else if (strcmp(valueAsString, "date") == 0)
41 return VuoTextSort_Date;
42
43 return VuoTextSort_Text;
44}
45
51{
52 char *valueAsString = "text";
53
54 if (value == VuoTextSort_TextCaseSensitive)
55 valueAsString = "text case-sensitive";
56 else if (value == VuoTextSort_Number)
57 valueAsString = "number";
58 else if (value == VuoTextSort_Date)
59 valueAsString = "date";
60
61 return json_object_new_string(valueAsString);
62}
63
68{
70 VuoListAppendValue_VuoTextSort(l, VuoTextSort_Text);
71 VuoListAppendValue_VuoTextSort(l, VuoTextSort_TextCaseSensitive);
72 VuoListAppendValue_VuoTextSort(l, VuoTextSort_Number);
73 VuoListAppendValue_VuoTextSort(l, VuoTextSort_Date);
74 return l;
75}
76
82{
83 char *valueAsString = "Text";
84
85 if (value == VuoTextSort_TextCaseSensitive)
86 valueAsString = "Text (case-sensitive)";
87 else if (value == VuoTextSort_Number)
88 valueAsString = "Number";
89 else if (value == VuoTextSort_Date)
90 valueAsString = "Date";
91
92 return strdup(valueAsString);
93}