Vuo  2.4.0
VuoBoolean.c
Go to the documentation of this file.
1
10#include <stdio.h>
11#include <string.h>
12#include <ctype.h>
13#include "type.h"
14
16#ifdef VUO_COMPILER
18 "title" : "Boolean",
19 "description" : "A boolean (true/false) value.",
20 "keywords" : [ "true", "false" ],
21 "version" : "1.0.0",
22 "dependencies" : [
23 "VuoList_VuoBoolean"
24 ]
25 });
26#endif
28
34{
35 if (json_object_get_type(js) == json_type_string)
36 {
37 char firstChar = tolower(json_object_get_string(js)[0]);
38 if (firstChar == 'n' // "no"
39 || firstChar == 'f') // "false"
40 return false;
41 }
42
43 return json_object_get_boolean(js);
44}
45
51{
52 return json_object_new_boolean(value);
53}
54
59{
63 return l;
64}
65
71{
72 return strdup(value ? "True" : "False");
73}
74
78bool VuoBoolean_areEqual(const VuoBoolean value1, const VuoBoolean value2)
79{
80 return value1 == value2;
81}
82
88{
89 return !a && b;
90}