Vuo 2.4.4
Loading...
Searching...
No Matches
VuoOscType.c
Go to the documentation of this file.
1
10#include "VuoOscType.h"
11
13#ifdef VUO_COMPILER
15 "title" : "OSC Type",
16 "description" : "An OSC data type.",
17 "keywords" : [ ],
18 "version" : "1.0.0",
19 "dependencies" : [
20 "VuoList_VuoOscType"
21 ]
22 });
23#endif
25
34{
35 const char *valueAsString = "";
36 if (json_object_get_type(js) == json_type_string)
37 valueAsString = json_object_get_string(js);
38
39 VuoOscType value = VuoOscType_Auto;
40
41 if (strcmp(valueAsString, "int32") == 0)
42 value = VuoOscType_Int32;
43 else if (strcmp(valueAsString, "float32") == 0)
44 value = VuoOscType_Float32;
45
46 return value;
47}
48
52json_object *VuoOscType_getJson(const VuoOscType value)
53{
54 char *valueAsString = "auto";
55
56 if (value == VuoOscType_Int32)
57 valueAsString = "int32";
58 else if (value == VuoOscType_Float32)
59 valueAsString = "float32";
60
61 return json_object_new_string(valueAsString);
62}
63
68{
70 VuoListAppendValue_VuoOscType(l, VuoOscType_Auto);
71 VuoListAppendValue_VuoOscType(l, VuoOscType_Int32);
72 VuoListAppendValue_VuoOscType(l, VuoOscType_Float32);
73 return l;
74}
75
80{
81 char *valueAsString = "Auto";
82
83 if (value == VuoOscType_Int32)
84 valueAsString = "Integer (32-bit)";
85 else if (value == VuoOscType_Float32)
86 valueAsString = "Floating point (32-bit)";
87
88 return strdup(valueAsString);
89}
90
94bool VuoOscType_areEqual(const VuoOscType valueA, const VuoOscType valueB)
95{
96 return valueA == valueB;
97}
98
102bool VuoOscType_isLessThan(const VuoOscType valueA, const VuoOscType valueB)
103{
104 return valueA < valueB;
105}