Vuo 2.4.4
Loading...
Searching...
No Matches
VuoDurationType.c
Go to the documentation of this file.
1
10#include "VuoDurationType.h"
11
13#ifdef VUO_COMPILER
15 "title" : "Duration Type",
16 "description" : "Duration Enum.",
17 "keywords" : [ ],
18 "version" : "1.0.0",
19 "dependencies" : [
20 "VuoList_VuoDurationType"
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 VuoDurationType value = VuoDurationType_Single;
37
38 if( !strcmp(valueAsString, "single") ) {
39 value = VuoDurationType_Single;
40 } else
41 if( !strcmp(valueAsString, "until next") ) {
42 value = VuoDurationType_UntilNext;
43 } else
44 if( !strcmp(valueAsString, "until reset") ) {
45 value = VuoDurationType_UntilReset;
46 }
47 return value;
48}
49
54json_object * VuoDurationType_getJson(const VuoDurationType value)
55{
56 char *valueAsString = "";
57
58 switch (value)
59 {
60 case VuoDurationType_Single:
61 valueAsString = "single";
62 break;
63 case VuoDurationType_UntilNext:
64 valueAsString = "until next";
65 break;
66 case VuoDurationType_UntilReset:
67 valueAsString = "until reset";
68 break;
69 }
70 return json_object_new_string(valueAsString);
71}
72
77{
79 VuoListAppendValue_VuoDurationType(l, VuoDurationType_Single);
80 VuoListAppendValue_VuoDurationType(l, VuoDurationType_UntilNext);
81 VuoListAppendValue_VuoDurationType(l, VuoDurationType_UntilReset);
82 return l;
83}
84
90{
91 char *valueAsString = "";
92
93 switch (value)
94 {
95 case VuoDurationType_Single:
96 valueAsString = "Single";
97 break;
98 case VuoDurationType_UntilNext:
99 valueAsString = "Until Next";
100 break;
101 case VuoDurationType_UntilReset:
102 valueAsString = "Until Reset";
103 break;
104 }
105 return strdup(valueAsString);
106}