Vuo  2.0.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
24 
26 
39 {
40  return (VuoIntegerRange){
43  ""
44  };
45 }
46 
52 {
53  json_object *js = json_object_new_object();
54 
55  if (value.minimum != VuoIntegerRange_NoMinimum)
56  {
57  json_object *minObject = VuoInteger_getJson(value.minimum);
58  json_object_object_add(js, "minimum", minObject);
59  }
60 
61  if (value.maximum != VuoIntegerRange_NoMaximum)
62  {
63  json_object *maxObject = VuoInteger_getJson(value.maximum);
64  json_object_object_add(js, "maximum", maxObject);
65  }
66 
67  return js;
68 }
69 
70 
76 {
77  if (value.minimum != VuoIntegerRange_NoMinimum && value.maximum != VuoIntegerRange_NoMaximum)
78  return VuoText_format("%lld to %lld", value.minimum, value.maximum);
79  else if (value.minimum != VuoIntegerRange_NoMinimum)
80  return VuoText_format("%lld to ∞", value.minimum);
81  else if (value.maximum != VuoIntegerRange_NoMaximum)
82  return VuoText_format("-∞ to %lld", value.maximum);
83  else
84  return VuoText_format("-∞ to ∞");
85 }