Vuo  2.0.0
VuoTableFormat.c
Go to the documentation of this file.
1 
10 #include "type.h"
11 #include "VuoTableFormat.h"
12 #include "VuoList_VuoTableFormat.h"
13 
15 #ifdef VUO_COMPILER
17  "title" : "Table Format",
18  "description" : "A text format for information structured in rows and columns",
19  "keywords" : [],
20  "version" : "1.0.0",
21  "dependencies" : [
22  "VuoList_VuoTableFormat"
23  ]
24  });
25 #endif
26 
33 {
34  const char *valueAsString = "";
35  if (json_object_get_type(js) == json_type_string)
36  valueAsString = json_object_get_string(js);
37 
38  VuoTableFormat value = VuoTableFormat_Csv;
39 
40  if (! strcmp(valueAsString, "csv")) {
41  value = VuoTableFormat_Csv;
42  } else if (! strcmp(valueAsString, "tsv")) {
43  value = VuoTableFormat_Tsv;
44  }
45 
46  return value;
47 }
48 
54 {
55  char *valueAsString = "";
56 
57  switch (value) {
58  case VuoTableFormat_Csv:
59  valueAsString = "csv";
60  break;
61  case VuoTableFormat_Tsv:
62  valueAsString = "tsv";
63  break;
64  }
65 
66  return json_object_new_string(valueAsString);
67 }
68 
73 {
75  VuoListAppendValue_VuoTableFormat(l, VuoTableFormat_Csv);
76  VuoListAppendValue_VuoTableFormat(l, VuoTableFormat_Tsv);
77  return l;
78 }
79 
85 {
86  char *valueAsString = "";
87 
88  switch (value) {
89  case VuoTableFormat_Csv:
90  valueAsString = "CSV (comma-separated)";
91  break;
92  case VuoTableFormat_Tsv:
93  valueAsString = "TSV (tab-separated)";
94  break;
95  }
96 
97  return strdup(valueAsString);
98 }