Prechádzať zdrojové kódy

ctkLDAPSearchFilter added doc and boolean conversion function.

Sascha Zelzer 14 rokov pred
rodič
commit
056e515d3f

+ 6 - 1
Libs/PluginFramework/ctkLDAPSearchFilter.cpp

@@ -44,7 +44,7 @@ public:
 };
 
 ctkLDAPSearchFilter::ctkLDAPSearchFilter()
-  : d(new ctkLDAPSearchFilterData())
+  : d(0)
 {
 }
 
@@ -62,6 +62,11 @@ ctkLDAPSearchFilter::~ctkLDAPSearchFilter()
 {
 }
 
+ctkLDAPSearchFilter::operator bool() const
+{
+  return d;
+}
+
 bool ctkLDAPSearchFilter::match(const ctkServiceReference& reference) const
 {
   return d->ldapExpr.evaluate(reference.d_func()->getProperties(), true);

+ 10 - 0
Libs/PluginFramework/ctkLDAPSearchFilter.h

@@ -55,6 +55,14 @@ class CTK_PLUGINFW_EXPORT ctkLDAPSearchFilter {
 
 public:
 
+  /**
+   * Creates in invalid <code>ctkLDAPSearchFilter</code> object.
+   * Test the validity by using the boolean conversion operator.
+   *
+   * <p>
+   * Calling methods on an invalid <code>ctkLDAPSearchFilter</code>
+   * will result in undefined behavior.
+   */
   ctkLDAPSearchFilter();
 
   /**
@@ -78,6 +86,8 @@ public:
 
   ~ctkLDAPSearchFilter();
 
+  operator bool() const;
+
   /**
    * Filter using a service's properties.
    * <p>