diff options
-rw-r--r-- | include/core/match.h | 8 | ||||
-rw-r--r-- | src/match.cpp | 20 |
2 files changed, 23 insertions, 5 deletions
diff --git a/include/core/match.h b/include/core/match.h index dcf10ae..4afbec7 100644 --- a/include/core/match.h +++ b/include/core/match.h @@ -49,10 +49,13 @@ class CompMatch { CompMatch (const CompMatch &); ~CompMatch (); + static const CompMatch emptyMatch; + void update (); bool evaluate (CompWindow *window); - CompString toString (); + CompString toString () const; + bool isEmpty () const; CompMatch & operator= (const CompMatch &); CompMatch & operator&= (const CompMatch &); @@ -69,7 +72,8 @@ class CompMatch { const CompMatch & operator& (const CompString &); const CompMatch & operator| (const CompString &); - bool operator== (const CompMatch &); + bool operator== (const CompMatch &) const; + bool operator!= (const CompMatch &) const; private: PrivateMatch *priv; diff --git a/src/match.cpp b/src/match.cpp index a16c44a..072083e 100644 --- a/src/match.cpp +++ b/src/match.cpp @@ -39,6 +39,8 @@ #include "privatescreen.h" #include "privatewindow.h" +const CompMatch CompMatch::emptyMatch; + class CoreExp : public CompMatch::Expression { public: virtual ~CoreExp () {}; @@ -609,7 +611,7 @@ CompMatch::update () matchResetOps (priv->op.op); matchUpdateOps (priv->op.op); } - + bool CompMatch::evaluate (CompWindow *window) { @@ -617,11 +619,17 @@ CompMatch::evaluate (CompWindow *window) } CompString -CompMatch::toString () +CompMatch::toString () const { return matchOpsToString (priv->op.op); } +bool +CompMatch::isEmpty () const +{ + return (*this == emptyMatch); +} + CompMatch & CompMatch::operator= (const CompMatch &match) { @@ -712,7 +720,13 @@ CompMatch::operator| (const CompString &str) } bool -CompMatch::operator== (const CompMatch &match) +CompMatch::operator== (const CompMatch &match) const { return matchOpsEqual (priv->op.op, match.priv->op.op); } + +bool +CompMatch::operator!= (const CompMatch &match) const +{ + return !(*this == match); +} |