Vuo
2.3.2
type
VuoIntegerRange.c
Go to the documentation of this file.
1
10
#include "
type.h
"
11
13
#ifdef VUO_COMPILER
14
VuoModuleMetadata
({
15
"title"
:
"Integer Range"
,
16
"description"
:
"Defines an integer range with an optionally bound/unbound min/max."
,
17
"keywords"
: [ ],
18
"version"
:
"1.0.0"
,
19
"dependencies"
: [
20
"VuoReal"
21
]
22
});
23
#endif
25
26
38
VuoIntegerRange
VuoIntegerRange_makeFromJson
(
json_object
* js)
39
{
40
return
(
VuoIntegerRange
){
41
VuoJson_getObjectValue
(
VuoInteger
, js,
"minimum"
,
VuoIntegerRange_NoMinimum
),
42
VuoJson_getObjectValue
(
VuoInteger
, js,
"maximum"
,
VuoIntegerRange_NoMaximum
),
43
};
44
}
45
50
json_object
*
VuoIntegerRange_getJson
(
const
VuoIntegerRange
value)
51
{
52
json_object
*js = json_object_new_object();
53
54
if
(value.minimum !=
VuoIntegerRange_NoMinimum
)
55
{
56
json_object
*minObject =
VuoInteger_getJson
(value.minimum);
57
json_object_object_add(js,
"minimum"
, minObject);
58
}
59
60
if
(value.maximum !=
VuoIntegerRange_NoMaximum
)
61
{
62
json_object
*maxObject =
VuoInteger_getJson
(value.maximum);
63
json_object_object_add(js,
"maximum"
, maxObject);
64
}
65
66
return
js;
67
}
68
69
74
char
*
VuoIntegerRange_getSummary
(
const
VuoIntegerRange
value)
75
{
76
if
(value.minimum !=
VuoIntegerRange_NoMinimum
&& value.maximum !=
VuoIntegerRange_NoMaximum
)
77
return
VuoText_format
(
"%lld to %lld"
, value.minimum, value.maximum);
78
else
if
(value.minimum !=
VuoIntegerRange_NoMinimum
)
79
return
VuoText_format
(
"%lld to ∞"
, value.minimum);
80
else
if
(value.maximum !=
VuoIntegerRange_NoMaximum
)
81
return
VuoText_format
(
"-∞ to %lld"
, value.maximum);
82
else
83
return
VuoText_format
(
"-∞ to ∞"
);
84
}
Generated on Sat Jun 19 2021 10:17:49 for Vuo by
1.9.1