Browse Source

ENH: EventBus: Implemented missing methods

In ctkEvent and ctkLDAPSearchFilter
Sascha Zelzer 14 years ago
parent
commit
cb6192e9c6

+ 1 - 3
Libs/PluginFramework/EventBus/ctkEvent.cpp

@@ -69,7 +69,5 @@ const QString& ctkEvent::topic() const
 
 bool ctkEvent::matches(const ctkLDAPSearchFilter& filter) const
 {
-  Q_UNUSED(filter)
-  // TODO
-  return true;
+  return filter.matchCase(d->properties);
 }

+ 9 - 12
Libs/PluginFramework/ctkLDAPSearchFilter.cpp

@@ -21,22 +21,23 @@
 
 #include "ctkLDAPSearchFilter.h"
 
+#include "ctkLDAPExpr.h"
+
 
 class ctkLDAPSearchFilterPrivate {
 public:
 
-  ctkLDAPSearchFilterPrivate()
-    : ref(1)
+  ctkLDAPSearchFilterPrivate(const QString& filter)
+    : ref(1), ldapExpr(filter)
   {}
 
   QAtomicInt ref;
-
+  ctkLDAPExpr ldapExpr;
 };
 
 ctkLDAPSearchFilter::ctkLDAPSearchFilter(const QString& filter)
-  : d(new ctkLDAPSearchFilterPrivate())
+  : d(new ctkLDAPSearchFilterPrivate(filter))
 {
-  Q_UNUSED(filter)
 }
 
 ctkLDAPSearchFilter::ctkLDAPSearchFilter(const ctkLDAPSearchFilter& filter)
@@ -53,21 +54,17 @@ ctkLDAPSearchFilter::~ctkLDAPSearchFilter()
 
 bool ctkLDAPSearchFilter::match(const Dictionary& dictionary) const
 {
-  Q_UNUSED(dictionary)
-  return true;
+  return d->ldapExpr.evaluate(dictionary, false);
 }
 
 bool ctkLDAPSearchFilter::matchCase(const Dictionary& dictionary) const
 {
-  Q_UNUSED(dictionary)
-  return true;
+  return d->ldapExpr.evaluate(dictionary, true);
 }
 
 bool ctkLDAPSearchFilter::operator==(const ctkLDAPSearchFilter& other) const
 {
-  // TODO
-  Q_UNUSED(other)
-  return true;
+  return d->ldapExpr.toString() == other.d->ldapExpr.toString();
 }
 
 ctkLDAPSearchFilter& ctkLDAPSearchFilter::operator=(const ctkLDAPSearchFilter& filter)