Main Page   Class Hierarchy   Compound List   File List   Compound Members  

KDE::SLP::PredicateFilter Class Reference

#include <filters.h>

Inheritance diagram for KDE::SLP::PredicateFilter:

KDE::SLP::Filter List of all members.

Public Methods

 PredicateFilter (const QString &predicate)
QString predicate () const

Static Public Methods

QString escape (const QString &s)

Detailed Description

A PredicateFilter contains a LDAPv3 search filter expression that will be used to filter services by their attributes. The exact description can be found in RFC 2254.

Search filters by example:

 Match all services whose attribute 'port' is 80:
 "(port=80)"

 Match all services whose attribute 'port' is larger or equalthan 80:
 "(port>=80)"
 (other operators: approx("~=") and less("<="))

 Match all services whose attribute 'port' is not 80:
 "(!(port=80))"

 Match all services whose attribute 'port' is 80 and 'host' is 'www.kde.org':
 "(&(port=80)(host=www.kde.org))"
 (Note that string matching is case-insensitive, and spaces may be stripped)

 Match all services with 'port' 80 and 'host' either 'www.kde.org' or 'www.linux.org':
 "(&(port=80)(|(host=www.kde.org)(host=www.linux.org)))"

 Match all services whose 'host' attribute ends with 'kde.org':
 "(host=*kde.org)"

 Match all services whose 'description' attribute contains 'kde':
 "(description=*kde*)"

 Match all services whose 'portlist' attribute contains a list with the numbers
 80 and 8080:
 "(&(port=80)(port=8080))"
 (an attribute expression matches when at least one value in the list fulfills the condition)

 Match all services that have a 'description' attribute:
 "(description=*)"

 Match all services that have a 'description' attributes that contains "*new*":
 "(description=*\2anew\2a*)"
 Any occurrence of the following characters must be escaped by a backslash followed
  by the 2 hexadecimal digits with the ASCII code: "*" ("\2a"), "(" ("\28"),
  ")" ("\29"), "\" ("\5c") and the 0 byte ("\00"). This can be done by the
  escape() function.
 


Constructor & Destructor Documentation

KDE::SLP::PredicateFilter::PredicateFilter const QString &    predicate
 

Creates a new PredicateFilter with the given filter.

Parameters:
predicate  the LDAPv3 search filter


Member Function Documentation

QString KDE::SLP::PredicateFilter::escape const QString &    s [static]
 

Escapes the string as described in RFC 2254. This is required for the values in the filter. Any occurrence of the following characters must be escaped by a backslash followed by the 2 hexadecimal digits of the ASCII code: "*" ("\2a"), "(" ("\28"), ")" ("\29"), "\" ("\5c") and the 0 byte ("\00")).

Parameters:
s  the string to escape
Returns:
the escaped string.

QString KDE::SLP::PredicateFilter::predicate  
 

Returns the predicate.

Returns:
the LDAPv3 search filter


The documentation for this class was generated from the following file:
Generated on Tue Jun 24 20:14:35 2003 for KDE::SLP by doxygen1.2.18