diff options
author | Danny Baumann <dannybaumann@web.de> | 2009-02-22 17:30:58 +0100 |
---|---|---|
committer | Danny Baumann <dannybaumann@web.de> | 2009-02-22 17:30:58 +0100 |
commit | 91fcc47d14c249168d514f74fe27e8e9b212ff9b (patch) | |
tree | 15395a63fc8c5787819b5b481d09eaecff46caba /src | |
parent | 36edd5272fcd331bdc1330aa6763cb404a7ca156 (diff) | |
download | zcomp-91fcc47d14c249168d514f74fe27e8e9b212ff9b.tar.gz zcomp-91fcc47d14c249168d514f74fe27e8e9b212ff9b.tar.bz2 |
Match API improvements:
- Provide != operator and emptiness check method
- Provide empty match
- Improve const correctness
Diffstat (limited to 'src')
-rw-r--r-- | src/match.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
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); +} |