1 /******************************************************************************
3 * Copyright (C) 2012-2016 Icinga Development Team (https://www.icinga.org/) *
5 * This program is free software; you can redistribute it and/or *
6 * modify it under the terms of the GNU General Public License *
7 * as published by the Free Software Foundation; either version 2 *
8 * of the License, or (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the Free Software Foundation *
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ******************************************************************************/
20 #include "base/value.hpp"
21 #include "base/array.hpp"
22 #include "base/dictionary.hpp"
23 #include "base/datetime.hpp"
24 #include "base/convert.hpp"
25 #include "base/utility.hpp"
26 #include "base/objectlock.hpp"
27 #include <boost/foreach.hpp>
28 #include <boost/lexical_cast.hpp>
30 using namespace icinga;
32 Value::operator double(void) const
34 const double *value = boost::get<double>(&m_Value);
39 const bool *fvalue = boost::get<bool>(&m_Value);
48 return boost::lexical_cast<double>(m_Value);
49 } catch (const std::exception&) {
50 std::ostringstream msgbuf;
51 msgbuf << "Can't convert '" << *this << "' to a floating point number.";
52 BOOST_THROW_EXCEPTION(std::invalid_argument(msgbuf.str()));
56 Value::operator String(void) const
64 return Convert::ToString(boost::get<double>(m_Value));
66 if (boost::get<bool>(m_Value))
71 return boost::get<String>(m_Value);
73 object = boost::get<Object::Ptr>(m_Value).get();
74 return object->ToString();
76 BOOST_THROW_EXCEPTION(std::runtime_error("Unknown value type."));
80 std::ostream& icinga::operator<<(std::ostream& stream, const Value& value)
82 if (value.IsBoolean())
83 stream << static_cast<int>(value);
85 stream << static_cast<String>(value);
90 std::istream& icinga::operator>>(std::istream& stream, Value& value)
98 Value& Value::operator=(const Value& other)
100 m_Value = other.m_Value;
104 bool Value::operator==(bool rhs) const
106 return *this == Value(rhs);
109 bool Value::operator!=(bool rhs) const
111 return !(*this == rhs);
114 bool Value::operator==(int rhs) const
116 return *this == Value(rhs);
119 bool Value::operator!=(int rhs) const
121 return !(*this == rhs);
124 bool Value::operator==(double rhs) const
126 return *this == Value(rhs);
129 bool Value::operator!=(double rhs) const
131 return !(*this == rhs);
134 bool Value::operator==(const char *rhs) const
136 return static_cast<String>(*this) == rhs;
139 bool Value::operator!=(const char *rhs) const
141 return !(*this == rhs);
144 bool Value::operator==(const String& rhs) const
146 return static_cast<String>(*this) == rhs;
149 bool Value::operator!=(const String& rhs) const
151 return !(*this == rhs);
154 bool Value::operator==(const Value& rhs) const
156 if (IsNumber() && rhs.IsNumber())
157 return Get<double>() == rhs.Get<double>();
158 else if ((IsBoolean() || IsNumber()) && (rhs.IsBoolean() || rhs.IsNumber()) && !(IsEmpty() && rhs.IsEmpty()))
159 return static_cast<double>(*this) == static_cast<double>(rhs);
161 if (IsString() && rhs.IsString())
162 return Get<String>() == rhs.Get<String>();
163 else if ((IsString() || IsEmpty()) && (rhs.IsString() || rhs.IsEmpty()) && !(IsEmpty() && rhs.IsEmpty()))
164 return static_cast<String>(*this) == static_cast<String>(rhs);
166 if (IsEmpty() != rhs.IsEmpty())
172 if (IsObject() != rhs.IsObject())
176 if (IsObjectType<DateTime>() && rhs.IsObjectType<DateTime>()) {
177 DateTime::Ptr dt1 = *this;
178 DateTime::Ptr dt2 = rhs;
180 return dt1->GetValue() == dt2->GetValue();
183 if (IsObjectType<Array>() && rhs.IsObjectType<Array>()) {
184 Array::Ptr arr1 = *this;
185 Array::Ptr arr2 = rhs;
190 if (arr1->GetLength() != arr2->GetLength())
193 for (Array::SizeType i = 0; i < arr1->GetLength(); i++) {
194 if (arr1->Get(i) != arr2->Get(i))
201 return Get<Object::Ptr>() == rhs.Get<Object::Ptr>();
207 bool Value::operator!=(const Value& rhs) const
209 return !(*this == rhs);
212 Value icinga::operator+(const Value& lhs, const char *rhs)
214 return lhs + Value(rhs);
217 Value icinga::operator+(const char *lhs, const Value& rhs)
219 return Value(lhs) + rhs;
222 Value icinga::operator+(const Value& lhs, const String& rhs)
224 return lhs + Value(rhs);
227 Value icinga::operator+(const String& lhs, const Value& rhs)
229 return Value(lhs) + rhs;
232 Value icinga::operator+(const Value& lhs, const Value& rhs)
234 if ((lhs.IsEmpty() || lhs.IsNumber()) && !lhs.IsString() && (rhs.IsEmpty() || rhs.IsNumber()) && !rhs.IsString() && !(lhs.IsEmpty() && rhs.IsEmpty()))
235 return static_cast<double>(lhs) + static_cast<double>(rhs);
236 if ((lhs.IsString() || lhs.IsEmpty() || lhs.IsNumber()) && (rhs.IsString() || rhs.IsEmpty() || rhs.IsNumber()) && (!(lhs.IsEmpty() && rhs.IsEmpty()) || lhs.IsString() || rhs.IsString()))
237 return static_cast<String>(lhs) + static_cast<String>(rhs);
238 else if ((lhs.IsNumber() || lhs.IsEmpty()) && (rhs.IsNumber() || rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty()))
239 return static_cast<double>(lhs) + static_cast<double>(rhs);
240 else if (lhs.IsObjectType<DateTime>() && rhs.IsNumber())
241 return new DateTime(Convert::ToDateTimeValue(lhs) + rhs);
242 else if ((lhs.IsObjectType<Array>() || lhs.IsEmpty()) && (rhs.IsObjectType<Array>() || rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty())) {
243 Array::Ptr result = new Array();
245 static_cast<Array::Ptr>(lhs)->CopyTo(result);
247 static_cast<Array::Ptr>(rhs)->CopyTo(result);
249 } else if ((lhs.IsObjectType<Dictionary>() || lhs.IsEmpty()) && (rhs.IsObjectType<Dictionary>() || rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty())) {
250 Dictionary::Ptr result = new Dictionary();
252 static_cast<Dictionary::Ptr>(lhs)->CopyTo(result);
254 static_cast<Dictionary::Ptr>(rhs)->CopyTo(result);
257 BOOST_THROW_EXCEPTION(std::invalid_argument("Operator + cannot be applied to values of type '" + lhs.GetTypeName() + "' and '" + rhs.GetTypeName() + "'"));
261 Value icinga::operator+(const Value& lhs, double rhs)
263 return lhs + Value(rhs);
266 Value icinga::operator+(double lhs, const Value& rhs)
268 return Value(lhs) + rhs;
271 Value icinga::operator+(const Value& lhs, int rhs)
273 return lhs + Value(rhs);
276 Value icinga::operator+(int lhs, const Value& rhs)
278 return Value(lhs) + rhs;
281 Value icinga::operator-(const Value& lhs, const Value& rhs)
283 if ((lhs.IsNumber() || lhs.IsEmpty()) && !lhs.IsString() && (rhs.IsNumber() || rhs.IsEmpty()) && !rhs.IsString() && !(lhs.IsEmpty() && rhs.IsEmpty()))
284 return static_cast<double>(lhs) - static_cast<double>(rhs);
285 else if (lhs.IsObjectType<DateTime>() && rhs.IsNumber())
286 return new DateTime(Convert::ToDateTimeValue(lhs) - rhs);
287 else if (lhs.IsObjectType<DateTime>() && rhs.IsObjectType<DateTime>())
288 return Convert::ToDateTimeValue(lhs) - Convert::ToDateTimeValue(rhs);
289 else if ((lhs.IsObjectType<DateTime>() || lhs.IsEmpty()) && (rhs.IsObjectType<DateTime>() || rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty()))
290 return new DateTime(Convert::ToDateTimeValue(lhs) - Convert::ToDateTimeValue(rhs));
291 else if ((lhs.IsObjectType<Array>() || lhs.IsEmpty()) && (rhs.IsObjectType<Array>() || rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty())) {
295 Array::Ptr result = new Array();
296 Array::Ptr left = lhs;
297 Array::Ptr right = rhs;
299 ObjectLock olock(left);
300 BOOST_FOREACH(const Value& lv, left) {
302 ObjectLock xlock(right);
303 BOOST_FOREACH(const Value& rv, right) {
318 BOOST_THROW_EXCEPTION(std::invalid_argument("Operator - cannot be applied to values of type '" + lhs.GetTypeName() + "' and '" + rhs.GetTypeName() + "'"));
321 Value icinga::operator-(const Value& lhs, double rhs)
323 return lhs - Value(rhs);
326 Value icinga::operator-(double lhs, const Value& rhs)
328 return Value(lhs) - rhs;
331 Value icinga::operator-(const Value& lhs, int rhs)
333 return lhs - Value(rhs);
336 Value icinga::operator-(int lhs, const Value& rhs)
338 return Value(lhs) - rhs;
341 Value icinga::operator*(const Value& lhs, const Value& rhs)
343 if ((lhs.IsNumber() || lhs.IsEmpty()) && (rhs.IsNumber() || rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty()))
344 return static_cast<double>(lhs) * static_cast<double>(rhs);
346 BOOST_THROW_EXCEPTION(std::invalid_argument("Operator * cannot be applied to values of type '" + lhs.GetTypeName() + "' and '" + rhs.GetTypeName() + "'"));
349 Value icinga::operator*(const Value& lhs, double rhs)
351 return lhs * Value(rhs);
354 Value icinga::operator*(double lhs, const Value& rhs)
356 return Value(lhs) * rhs;
359 Value icinga::operator*(const Value& lhs, int rhs)
361 return lhs * Value(rhs);
364 Value icinga::operator*(int lhs, const Value& rhs)
366 return Value(lhs) * rhs;
369 Value icinga::operator/(const Value& lhs, const Value& rhs)
372 BOOST_THROW_EXCEPTION(std::invalid_argument("Right-hand side argument for operator / is Empty."));
373 else if ((lhs.IsEmpty() || lhs.IsNumber()) && rhs.IsNumber()) {
374 if (static_cast<double>(rhs) == 0)
375 BOOST_THROW_EXCEPTION(std::invalid_argument("Right-hand side argument for operator / is 0."));
377 return static_cast<double>(lhs) / static_cast<double>(rhs);
379 BOOST_THROW_EXCEPTION(std::invalid_argument("Operator / cannot be applied to values of type '" + lhs.GetTypeName() + "' and '" + rhs.GetTypeName() + "'"));
382 Value icinga::operator/(const Value& lhs, double rhs)
384 return lhs / Value(rhs);
387 Value icinga::operator/(double lhs, const Value& rhs)
389 return Value(lhs) / rhs;
392 Value icinga::operator/(const Value& lhs, int rhs)
394 return lhs / Value(rhs);
397 Value icinga::operator/(int lhs, const Value& rhs)
399 return Value(lhs) / rhs;
402 Value icinga::operator%(const Value& lhs, const Value& rhs)
405 BOOST_THROW_EXCEPTION(std::invalid_argument("Right-hand side argument for operator % is Empty."));
406 else if ((rhs.IsNumber() || lhs.IsNumber()) && rhs.IsNumber()) {
407 if (static_cast<double>(rhs) == 0)
408 BOOST_THROW_EXCEPTION(std::invalid_argument("Right-hand side argument for operator % is 0."));
410 return static_cast<int>(lhs) % static_cast<int>(rhs);
412 BOOST_THROW_EXCEPTION(std::invalid_argument("Operator % cannot be applied to values of type '" + lhs.GetTypeName() + "' and '" + rhs.GetTypeName() + "'"));
415 Value icinga::operator%(const Value& lhs, double rhs)
417 return lhs % Value(rhs);
420 Value icinga::operator%(double lhs, const Value& rhs)
422 return Value(lhs) % rhs;
425 Value icinga::operator%(const Value& lhs, int rhs)
427 return lhs % Value(rhs);
430 Value icinga::operator%(int lhs, const Value& rhs)
432 return Value(lhs) % rhs;
435 Value icinga::operator^(const Value& lhs, const Value& rhs)
437 if ((lhs.IsNumber() || lhs.IsEmpty()) && (rhs.IsNumber() || rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty()))
438 return static_cast<int>(lhs) ^ static_cast<int>(rhs);
440 BOOST_THROW_EXCEPTION(std::invalid_argument("Operator & cannot be applied to values of type '" + lhs.GetTypeName() + "' and '" + rhs.GetTypeName() + "'"));
443 Value icinga::operator^(const Value& lhs, double rhs)
445 return lhs ^ Value(rhs);
448 Value icinga::operator^(double lhs, const Value& rhs)
450 return Value(lhs) ^ rhs;
453 Value icinga::operator^(const Value& lhs, int rhs)
455 return lhs ^ Value(rhs);
458 Value icinga::operator^(int lhs, const Value& rhs)
460 return Value(lhs) ^ rhs;
463 Value icinga::operator&(const Value& lhs, const Value& rhs)
465 if ((lhs.IsNumber() || lhs.IsEmpty()) && (rhs.IsNumber() || rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty()))
466 return static_cast<int>(lhs) & static_cast<int>(rhs);
468 BOOST_THROW_EXCEPTION(std::invalid_argument("Operator & cannot be applied to values of type '" + lhs.GetTypeName() + "' and '" + rhs.GetTypeName() + "'"));
471 Value icinga::operator&(const Value& lhs, double rhs)
473 return lhs & Value(rhs);
476 Value icinga::operator&(double lhs, const Value& rhs)
478 return Value(lhs) & rhs;
481 Value icinga::operator&(const Value& lhs, int rhs)
483 return lhs & Value(rhs);
486 Value icinga::operator&(int lhs, const Value& rhs)
488 return Value(lhs) & rhs;
491 Value icinga::operator|(const Value& lhs, const Value& rhs)
493 if ((lhs.IsNumber() || lhs.IsEmpty()) && (rhs.IsNumber() || rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty()))
494 return static_cast<int>(lhs) | static_cast<int>(rhs);
496 BOOST_THROW_EXCEPTION(std::invalid_argument("Operator | cannot be applied to values of type '" + lhs.GetTypeName() + "' and '" + rhs.GetTypeName() + "'"));
499 Value icinga::operator|(const Value& lhs, double rhs)
501 return lhs | Value(rhs);
504 Value icinga::operator|(double lhs, const Value& rhs)
506 return Value(lhs) | rhs;
509 Value icinga::operator|(const Value& lhs, int rhs)
511 return lhs | Value(rhs);
514 Value icinga::operator|(int lhs, const Value& rhs)
516 return Value(lhs) | rhs;
519 Value icinga::operator<<(const Value& lhs, const Value& rhs)
521 if ((lhs.IsNumber() || lhs.IsEmpty()) && (rhs.IsNumber() || rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty()))
522 return static_cast<int>(lhs) << static_cast<int>(rhs);
524 BOOST_THROW_EXCEPTION(std::invalid_argument("Operator << cannot be applied to values of type '" + lhs.GetTypeName() + "' and '" + rhs.GetTypeName() + "'"));
527 Value icinga::operator<<(const Value& lhs, double rhs)
529 return lhs << Value(rhs);
532 Value icinga::operator<<(double lhs, const Value& rhs)
534 return Value(lhs) << rhs;
537 Value icinga::operator<<(const Value& lhs, int rhs)
539 return lhs << Value(rhs);
542 Value icinga::operator<<(int lhs, const Value& rhs)
544 return Value(lhs) << rhs;
547 Value icinga::operator>>(const Value& lhs, const Value& rhs)
549 if ((lhs.IsNumber() || lhs.IsEmpty()) && (rhs.IsNumber() || rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty()))
550 return static_cast<int>(lhs) >> static_cast<int>(rhs);
552 BOOST_THROW_EXCEPTION(std::invalid_argument("Operator >> cannot be applied to values of type '" + lhs.GetTypeName() + "' and '" + rhs.GetTypeName() + "'"));
555 Value icinga::operator>>(const Value& lhs, double rhs)
557 return lhs >> Value(rhs);
560 Value icinga::operator>>(double lhs, const Value& rhs)
562 return Value(lhs) >> rhs;
565 Value icinga::operator>>(const Value& lhs, int rhs)
567 return lhs >> Value(rhs);
570 Value icinga::operator>>(int lhs, const Value& rhs)
572 return Value(lhs) >> rhs;
575 bool icinga::operator<(const Value& lhs, const Value& rhs)
577 if (lhs.IsString() && rhs.IsString())
578 return static_cast<String>(lhs) < static_cast<String>(rhs);
579 else if ((lhs.IsNumber() || lhs.IsEmpty()) && (rhs.IsNumber() || rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty()))
580 return static_cast<double>(lhs) < static_cast<double>(rhs);
581 else if ((lhs.IsObjectType<DateTime>() || lhs.IsEmpty()) && (rhs.IsObjectType<DateTime>() || rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty()))
582 return Convert::ToDateTimeValue(lhs) < Convert::ToDateTimeValue(rhs);
583 else if (lhs.IsObjectType<Array>() && rhs.IsObjectType<Array>()) {
584 Array::Ptr larr = lhs;
585 Array::Ptr rarr = rhs;
587 ObjectLock llock(larr);
588 ObjectLock rlock(rarr);
590 Array::SizeType llen = larr->GetLength();
591 Array::SizeType rlen = rarr->GetLength();
593 for (Array::SizeType i = 0; i < std::max(llen, rlen); i++) {
594 Value lval = (i >= llen) ? Empty : larr->Get(i);
595 Value rval = (i >= rlen) ? Empty : rarr->Get(i);
599 else if (lval > rval)
605 BOOST_THROW_EXCEPTION(std::invalid_argument("Operator < cannot be applied to values of type '" + lhs.GetTypeName() + "' and '" + rhs.GetTypeName() + "'"));
608 bool icinga::operator<(const Value& lhs, double rhs)
610 return lhs < Value(rhs);
613 bool icinga::operator<(double lhs, const Value& rhs)
615 return Value(lhs) < rhs;
618 bool icinga::operator<(const Value& lhs, int rhs)
620 return lhs < Value(rhs);
623 bool icinga::operator<(int lhs, const Value& rhs)
625 return Value(lhs) < rhs;
628 bool icinga::operator>(const Value& lhs, const Value& rhs)
630 if (lhs.IsString() && rhs.IsString())
631 return static_cast<String>(lhs) > static_cast<String>(rhs);
632 else if ((lhs.IsNumber() || lhs.IsEmpty()) && (rhs.IsNumber() || rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty()))
633 return static_cast<double>(lhs) > static_cast<double>(rhs);
634 else if ((lhs.IsObjectType<DateTime>() || lhs.IsEmpty()) && (rhs.IsObjectType<DateTime>() || rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty()))
635 return Convert::ToDateTimeValue(lhs) > Convert::ToDateTimeValue(rhs);
636 else if (lhs.IsObjectType<Array>() && rhs.IsObjectType<Array>()) {
637 Array::Ptr larr = lhs;
638 Array::Ptr rarr = rhs;
640 ObjectLock llock(larr);
641 ObjectLock rlock(rarr);
643 Array::SizeType llen = larr->GetLength();
644 Array::SizeType rlen = rarr->GetLength();
646 for (Array::SizeType i = 0; i < std::max(llen, rlen); i++) {
647 Value lval = (i >= llen) ? Empty : larr->Get(i);
648 Value rval = (i >= rlen) ? Empty : rarr->Get(i);
652 else if (lval < rval)
658 BOOST_THROW_EXCEPTION(std::invalid_argument("Operator > cannot be applied to values of type '" + lhs.GetTypeName() + "' and '" + rhs.GetTypeName() + "'"));
661 bool icinga::operator>(const Value& lhs, double rhs)
663 return lhs > Value(rhs);
666 bool icinga::operator>(double lhs, const Value& rhs)
668 return Value(lhs) > rhs;
671 bool icinga::operator>(const Value& lhs, int rhs)
673 return lhs > Value(rhs);
676 bool icinga::operator>(int lhs, const Value& rhs)
678 return Value(lhs) > rhs;
681 bool icinga::operator<=(const Value& lhs, const Value& rhs)
683 if (lhs.IsString() && rhs.IsString())
684 return static_cast<String>(lhs) <= static_cast<String>(rhs);
685 else if ((lhs.IsNumber() || lhs.IsEmpty()) && (rhs.IsNumber() || rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty()))
686 return static_cast<double>(lhs) <= static_cast<double>(rhs);
687 else if ((lhs.IsObjectType<DateTime>() || lhs.IsEmpty()) && (rhs.IsObjectType<DateTime>() || rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty()))
688 return Convert::ToDateTimeValue(lhs) <= Convert::ToDateTimeValue(rhs);
690 BOOST_THROW_EXCEPTION(std::invalid_argument("Operator <= cannot be applied to values of type '" + lhs.GetTypeName() + "' and '" + rhs.GetTypeName() + "'"));
693 bool icinga::operator<=(const Value& lhs, double rhs)
695 return lhs <= Value(rhs);
698 bool icinga::operator<=(double lhs, const Value& rhs)
700 return Value(lhs) <= rhs;
703 bool icinga::operator<=(const Value& lhs, int rhs)
705 return lhs <= Value(rhs);
708 bool icinga::operator<=(int lhs, const Value& rhs)
710 return Value(lhs) <= rhs;
713 bool icinga::operator>=(const Value& lhs, const Value& rhs)
715 if (lhs.IsString() && rhs.IsString())
716 return static_cast<String>(lhs) >= static_cast<String>(rhs);
717 else if ((lhs.IsNumber() || lhs.IsEmpty()) && (rhs.IsNumber() || rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty()))
718 return static_cast<double>(lhs) >= static_cast<double>(rhs);
719 else if ((lhs.IsObjectType<DateTime>() || lhs.IsEmpty()) && (rhs.IsObjectType<DateTime>() || rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty()) && !(lhs.IsEmpty() && rhs.IsEmpty()))
720 return Convert::ToDateTimeValue(lhs) >= Convert::ToDateTimeValue(rhs);
722 BOOST_THROW_EXCEPTION(std::invalid_argument("Operator >= cannot be applied to values of type '" + lhs.GetTypeName() + "' and '" + rhs.GetTypeName() + "'"));
725 bool icinga::operator>=(const Value& lhs, double rhs)
727 return lhs >= Value(rhs);
730 bool icinga::operator>=(double lhs, const Value& rhs)
732 return Value(lhs) >= rhs;
735 bool icinga::operator>=(const Value& lhs, int rhs)
737 return lhs >= Value(rhs);
740 bool icinga::operator>=(int lhs, const Value& rhs)
742 return Value(lhs) >= rhs;