Vuo  2.0.0
VuoOscType.c
Go to the documentation of this file.
1 
10 #include "type.h"
11 #include "VuoOscType.h"
12 #include "VuoList_VuoOscType.h"
13 
15 #ifdef VUO_COMPILER
17  "title" : "OSC Type",
18  "description" : "An OSC data type.",
19  "keywords" : [ ],
20  "version" : "1.0.0",
21  "dependencies" : [
22  "VuoList_VuoOscType"
23  ]
24  });
25 #endif
26 
36 {
37  const char *valueAsString = "";
38  if (json_object_get_type(js) == json_type_string)
39  valueAsString = json_object_get_string(js);
40 
41  VuoOscType value = VuoOscType_Auto;
42 
43  if (strcmp(valueAsString, "int32") == 0)
44  value = VuoOscType_Int32;
45  else if (strcmp(valueAsString, "float32") == 0)
46  value = VuoOscType_Float32;
47 
48  return value;
49 }
50 
55 {
56  char *valueAsString = "auto";
57 
58  if (value == VuoOscType_Int32)
59  valueAsString = "int32";
60  else if (value == VuoOscType_Float32)
61  valueAsString = "float32";
62 
63  return json_object_new_string(valueAsString);
64 }
65 
70 {
72  VuoListAppendValue_VuoOscType(l, VuoOscType_Auto);
73  VuoListAppendValue_VuoOscType(l, VuoOscType_Int32);
74  VuoListAppendValue_VuoOscType(l, VuoOscType_Float32);
75  return l;
76 }
77 
82 {
83  char *valueAsString = "Auto";
84 
85  if (value == VuoOscType_Int32)
86  valueAsString = "Integer (32-bit)";
87  else if (value == VuoOscType_Float32)
88  valueAsString = "Floating point (32-bit)";
89 
90  return strdup(valueAsString);
91 }
92 
96 bool VuoOscType_areEqual(const VuoOscType valueA, const VuoOscType valueB)
97 {
98  return valueA == valueB;
99 }
100 
104 bool VuoOscType_isLessThan(const VuoOscType valueA, const VuoOscType valueB)
105 {
106  return valueA < valueB;
107 }