Vuo  2.3.2
VuoMouseButton.c
Go to the documentation of this file.
1 
10 #include "type.h"
11 #include "VuoMouseButton.h"
12 #include "VuoList_VuoMouseButton.h"
13 
15 #ifdef VUO_COMPILER
17  "title" : "Mouse Button",
18  "version" : "1.0.0",
19  "dependencies" : [
20  "VuoList_VuoMouseButton"
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  VuoMouseButton value = VuoMouseButton_Left;
37 
38  if (! strcmp(valueAsString, "left")) {
39  value = VuoMouseButton_Left;
40  } else if (! strcmp(valueAsString, "middle")) {
41  value = VuoMouseButton_Middle;
42  } else if (! strcmp(valueAsString, "right")) {
43  value = VuoMouseButton_Right;
44  } else if (! strcmp(valueAsString, "any")) {
45  value = VuoMouseButton_Any;
46  }
47 
48  return value;
49 }
50 
56 {
57  char *valueAsString = "";
58 
59  switch (value) {
60  case VuoMouseButton_Left:
61  valueAsString = "left";
62  break;
63  case VuoMouseButton_Middle:
64  valueAsString = "middle";
65  break;
66  case VuoMouseButton_Right:
67  valueAsString = "right";
68  break;
69  case VuoMouseButton_Any:
70  valueAsString = "any";
71  break;
72  }
73 
74  return json_object_new_string(valueAsString);
75 }
76 
81 {
83  VuoListAppendValue_VuoMouseButton(l, VuoMouseButton_Left);
84  VuoListAppendValue_VuoMouseButton(l, VuoMouseButton_Middle);
85  VuoListAppendValue_VuoMouseButton(l, VuoMouseButton_Right);
86  VuoListAppendValue_VuoMouseButton(l, VuoMouseButton_Any);
87  return l;
88 }
89 
95 {
96  char *valueAsString = "";
97 
98  switch (value) {
99  case VuoMouseButton_Left:
100  valueAsString = "Left";
101  break;
102  case VuoMouseButton_Middle:
103  valueAsString = "Middle";
104  break;
105  case VuoMouseButton_Right:
106  valueAsString = "Right";
107  break;
108  case VuoMouseButton_Any:
109  valueAsString = "Any";
110  break;
111  }
112 
113  return strdup(valueAsString);
114 }