Vuo
2.0.1
type
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
17
VuoModuleMetadata
({
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
27
33
VuoBoolean
VuoBoolean_makeFromJson
(
json_object
*js)
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
50
json_object
*
VuoBoolean_getJson
(
const
VuoBoolean
value)
51
{
52
return
json_object_new_boolean(value);
53
}
54
58
VuoList_VuoBoolean
VuoBoolean_getAllowedValues
(
void
)
59
{
60
VuoList_VuoBoolean
l =
VuoListCreate_VuoBoolean
();
61
VuoListAppendValue_VuoBoolean
(l,
false
);
62
VuoListAppendValue_VuoBoolean
(l,
true
);
63
return
l;
64
}
65
70
char
*
VuoBoolean_getSummary
(
const
VuoBoolean
value)
71
{
72
return
strdup(value ?
"True"
:
"False"
);
73
}
74
78
bool
VuoBoolean_areEqual
(
const
VuoBoolean
value1,
const
VuoBoolean
value2)
79
{
80
return
value1 == value2;
81
}
82
87
bool
VuoBoolean_isLessThan
(
const
VuoBoolean
a,
const
VuoBoolean
b)
88
{
89
return
!a && b;
90
}
Generated on Sat Mar 14 2020 13:04:38 for Vuo by
1.8.17