From 8e16a3e0e49b3c74e753d71d63d44059f83f032e Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Mon, 16 Jun 2014 17:25:48 -0400 Subject: [PATCH] Variant - Implemented ::trivial to faclitate operator shortcuts. --- src/Variant.cpp | 13 +++++++++++++ src/Variant.h | 1 + 2 files changed, 14 insertions(+) diff --git a/src/Variant.cpp b/src/Variant.cpp index b434426da..bcec3ab54 100644 --- a/src/Variant.cpp +++ b/src/Variant.cpp @@ -1763,6 +1763,19 @@ int Variant::type () return _type; } +//////////////////////////////////////////////////////////////////////////////// +bool Variant::trivial () const +{ + return (_type == type_unknown) || + (_type == type_integer && _integer == 0) || + (_type == type_real && _real == 0.0) || + (_type == type_string && _string == "") || + (_type == type_date && _date == 0) || + (_type == type_duration && _duration == 0); + + return false; +} + //////////////////////////////////////////////////////////////////////////////// bool Variant::get_bool () const { diff --git a/src/Variant.h b/src/Variant.h index 77dcacc66..8073fdaf9 100644 --- a/src/Variant.h +++ b/src/Variant.h @@ -95,6 +95,7 @@ public: void cast (const enum type); int type (); + bool trivial () const; bool get_bool () const; int get_integer () const;