mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Variant
- Implemented ::operator_hastag and ::operator_notag.
This commit is contained in:
parent
b06ac68248
commit
ae356a1d32
2 changed files with 29 additions and 0 deletions
|
@ -33,6 +33,7 @@
|
|||
#include <ISO8601.h>
|
||||
#include <Duration.h>
|
||||
#include <RX.h>
|
||||
#include <text.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Variant::Variant ()
|
||||
|
@ -791,6 +792,32 @@ bool Variant::operator_partial (const Variant& other) const
|
|||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Variant::operator_hastag (const Variant& other) const
|
||||
{
|
||||
Variant left (*this); // tags
|
||||
Variant right (other); // tag
|
||||
|
||||
left.cast (type_string);
|
||||
right.cast (type_string);
|
||||
|
||||
std::vector <std::string> individual;
|
||||
split (individual, left._string, ',');
|
||||
|
||||
std::vector <std::string>::iterator i;
|
||||
for (i = individual.begin (); i != individual.end (); ++i)
|
||||
if (*i == right._string)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Variant::operator_notag (const Variant& other) const
|
||||
{
|
||||
return ! operator_hastag (other);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Variant::operator! () const
|
||||
{
|
||||
|
|
|
@ -60,6 +60,8 @@ public:
|
|||
bool operator_match (const Variant&) const;
|
||||
bool operator_nomatch (const Variant&) const;
|
||||
bool operator_partial (const Variant&) const;
|
||||
bool operator_hastag (const Variant&) const;
|
||||
bool operator_notag (const Variant&) const;
|
||||
bool operator! () const;
|
||||
|
||||
Variant& operator^= (const Variant&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue