Variant
- Implemented ::trivial to faclitate operator shortcuts.
This commit is contained in:
@@ -1763,6 +1763,19 @@ int Variant::type ()
|
|||||||
return _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
|
bool Variant::get_bool () const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ public:
|
|||||||
|
|
||||||
void cast (const enum type);
|
void cast (const enum type);
|
||||||
int type ();
|
int type ();
|
||||||
|
bool trivial () const;
|
||||||
|
|
||||||
bool get_bool () const;
|
bool get_bool () const;
|
||||||
int get_integer () const;
|
int get_integer () const;
|
||||||
|
|||||||
Reference in New Issue
Block a user