mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Variant
- Implemented ::trivial to faclitate operator shortcuts.
This commit is contained in:
parent
841c78768c
commit
8e16a3e0e4
2 changed files with 14 additions and 0 deletions
|
@ -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
|
||||
{
|
||||
|
|
|
@ -95,6 +95,7 @@ public:
|
|||
|
||||
void cast (const enum type);
|
||||
int type ();
|
||||
bool trivial () const;
|
||||
|
||||
bool get_bool () const;
|
||||
int get_integer () const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue