Vuo  2.0.0
VuoWrapMode.c
Go to the documentation of this file.
1 
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <string.h>
13 #include "type.h"
14 
16 #ifdef VUO_COMPILER
18  "title" : "Wrap Mode",
19  "description" : "Controls what happens when a value exceeds a given range.",
20  "keywords" : [ "loop", "overflow", "saturate", "stay" ],
21  "version" : "1.0.0",
22  "dependencies" : [
23  "VuoList_VuoWrapMode"
24  ]
25  });
26 #endif
27 
34 {
35  const char *valueAsString = "";
36  if (json_object_get_type(js) == json_type_string)
37  valueAsString = json_object_get_string(js);
38 
39  VuoWrapMode value = VuoWrapMode_Wrap;
40 
41  if (! strcmp(valueAsString, "wrap")) {
42  value = VuoWrapMode_Wrap;
43  } else if (! strcmp(valueAsString, "saturate")) {
44  value = VuoWrapMode_Saturate;
45  }
46 
47  return value;
48 }
49 
55 {
56  char *valueAsString = "";
57 
58  switch (value) {
59  case VuoWrapMode_Wrap:
60  valueAsString = "wrap";
61  break;
62  case VuoWrapMode_Saturate:
63  valueAsString = "saturate";
64  break;
65  }
66 
67  return json_object_new_string(valueAsString);
68 }
69 
74 {
76  VuoListAppendValue_VuoWrapMode(l, VuoWrapMode_Wrap);
77  VuoListAppendValue_VuoWrapMode(l, VuoWrapMode_Saturate);
78  return l;
79 }
80 
86 {
87  char *valueAsString = "";
88 
89  switch (value) {
90  case VuoWrapMode_Wrap:
91  valueAsString = "Wrap";
92  break;
93  case VuoWrapMode_Saturate:
94  valueAsString = "Saturate";
95  break;
96  }
97 
98  return strdup(valueAsString);
99 }