- Implemented ::operator_hastag and ::operator_notag.
This commit is contained in:
Paul Beckingham 2014-05-26 21:04:47 -04:00
parent b06ac68248
commit ae356a1d32
2 changed files with 29 additions and 0 deletions

View file

@ -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
{

View file

@ -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&);