Vuo  2.4.0
VuoDurationType.c
Go to the documentation of this file.
1
10#include "type.h"
11#include "VuoDurationType.h"
13
15#ifdef VUO_COMPILER
17 "title" : "Duration Type",
18 "description" : "Duration Enum.",
19 "keywords" : [ ],
20 "version" : "1.0.0",
21 "dependencies" : [
22 "VuoList_VuoDurationType"
23 ]
24 });
25#endif
27
33{
34 const char *valueAsString = "";
35 if (json_object_get_type(js) == json_type_string)
36 valueAsString = json_object_get_string(js);
37
38 VuoDurationType value = VuoDurationType_Single;
39
40 if( !strcmp(valueAsString, "single") ) {
41 value = VuoDurationType_Single;
42 } else
43 if( !strcmp(valueAsString, "until next") ) {
44 value = VuoDurationType_UntilNext;
45 } else
46 if( !strcmp(valueAsString, "until reset") ) {
47 value = VuoDurationType_UntilReset;
48 }
49 return value;
50}
51
57{
58 char *valueAsString = "";
59
60 switch (value)
61 {
62 case VuoDurationType_Single:
63 valueAsString = "single";
64 break;
65 case VuoDurationType_UntilNext:
66 valueAsString = "until next";
67 break;
68 case VuoDurationType_UntilReset:
69 valueAsString = "until reset";
70 break;
71 }
72 return json_object_new_string(valueAsString);
73}
74
79{
81 VuoListAppendValue_VuoDurationType(l, VuoDurationType_Single);
82 VuoListAppendValue_VuoDurationType(l, VuoDurationType_UntilNext);
83 VuoListAppendValue_VuoDurationType(l, VuoDurationType_UntilReset);
84 return l;
85}
86
92{
93 char *valueAsString = "";
94
95 switch (value)
96 {
97 case VuoDurationType_Single:
98 valueAsString = "Single";
99 break;
100 case VuoDurationType_UntilNext:
101 valueAsString = "Until Next";
102 break;
103 case VuoDurationType_UntilReset:
104 valueAsString = "Until Reset";
105 break;
106 }
107 return strdup(valueAsString);
108}