Vuo  2.3.2
VuoIntegerRange.c
Go to the documentation of this file.
1 
10 #include "type.h"
11 
13 #ifdef VUO_COMPILER
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 
39 {
40  return (VuoIntegerRange){
43  };
44 }
45 
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 
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 }