mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Variant
- Updated operator+= to handle trivial values.
This commit is contained in:
parent
5dbbca882f
commit
2a552d4fc0
1 changed files with 16 additions and 5 deletions
|
@ -1316,15 +1316,26 @@ Variant& Variant::operator+= (const Variant& other)
|
||||||
case type_real:
|
case type_real:
|
||||||
switch (right._type)
|
switch (right._type)
|
||||||
{
|
{
|
||||||
case type_unknown: throw std::string ("Cannot add unknown type");
|
case type_unknown:
|
||||||
case type_boolean: right.cast (type_real); _real += right._real; break;
|
throw std::string ("Cannot add unknown type");
|
||||||
case type_integer: right.cast (type_real); _real += right._real; break;
|
|
||||||
case type_real: _real += right._real; break;
|
case type_boolean:
|
||||||
case type_string: cast (type_string); _string += right._string; break;
|
case type_integer:
|
||||||
|
case type_real:
|
||||||
|
right.cast (type_real);
|
||||||
|
_real += right._real;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case type_string:
|
||||||
|
cast (type_string);
|
||||||
|
_string += right._string;
|
||||||
|
break;
|
||||||
|
|
||||||
case type_date:
|
case type_date:
|
||||||
_type = type_date;
|
_type = type_date;
|
||||||
_date = (unsigned) (int) _real + right._date;
|
_date = (unsigned) (int) _real + right._date;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case type_duration:
|
case type_duration:
|
||||||
_type = type_duration;
|
_type = type_duration;
|
||||||
_duration = (unsigned) (int) _real + right._duration;
|
_duration = (unsigned) (int) _real + right._duration;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue