Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes

ctkLDAPExpr Class Reference

LDAP Expression. More...

#include <Libs/PluginFramework/ctkLDAPExpr.h>

List of all members.

Classes

class  ParseState
 Contains the current parser position and parsing utility methods. More...

Public Types

typedef char Byte

Public Member Functions

 ctkLDAPExpr (const QString &filter) throw ( ctkInvalidSyntaxException )
 ctkLDAPExpr (const ctkLDAPExpr &other)
bool evaluate (const ctkDictionary &p, bool matchCase) const
 Evaluate this LDAP filter.
QSet< QString > getMatchedObjectClasses () const
bool isSimple (const QList< QString > &keywords, QHash< int, QList< QString > > &cache, bool matchCase) const
const QString toQString () const

Static Public Member Functions

static bool query (const QString &filter, const ctkDictionary &pd) throw (ctkInvalidSyntaxException)

Static Public Attributes

static const int AND = 0
static const int APPROX = 32
static const int COMPLEX = AND | OR | NOT
static const int EQ = 4
static const int GE = 16
static const int LE = 8
static const int NOT = 2
static const int OR = 1
static const int SIMPLE = EQ | LE | GE | APPROX

Private Member Functions

bool compare (const QVariant &obj, int op, const QString &s) const
 ctkLDAPExpr (int op, const QString &attrName, const QString &attrValue)
 ctkLDAPExpr (int op, const QList< ctkLDAPExpr > &args)

Static Private Member Functions

static bool compareQString (const QString &s1, int op, const QString &s2)
static const QString fixupQString (const QString &s)
static ctkLDAPExpr parseExpr (ParseState &ps) throw (ctkInvalidSyntaxException)
static ctkLDAPExpr parseSimple (ParseState &ps) throw (ctkInvalidSyntaxException)
static bool patSubstr (const QString &s, int si, const QString &pat, int pi)
static bool patSubstr (const QString &s, const QString &pat)

Private Attributes

QSharedDataPointer
< ctkLDAPExprData
d
 Shared pointer.

Static Private Attributes

static const QString EOS = "Unexpected end of query"
static const QString GARBAGE = "Trailing garbage"
static const QString MALFORMED = "Malformed query"
static const QString NULLQ = "Null query"
static const QString OPERATOR = "Undefined operator"
static const QChar WILDCARD = 65535
static const QString WILDCARD_QString = QString( WILDCARD )

Detailed Description

LDAP Expression.

Date:
19 May 2010
Author:
Xavi Planes

Definition at line 43 of file ctkLDAPExpr.h.


Member Typedef Documentation

typedef char ctkLDAPExpr::Byte

Definition at line 55 of file ctkLDAPExpr.h.


Constructor & Destructor Documentation

ctkLDAPExpr::ctkLDAPExpr ( const QString &  filter  )  throw ( ctkInvalidSyntaxException )

Definition at line 34 of file ctkLDAPExpr.cpp.

ctkLDAPExpr::ctkLDAPExpr ( const ctkLDAPExpr other  ) 

Definition at line 61 of file ctkLDAPExpr.cpp.

ctkLDAPExpr::ctkLDAPExpr ( int  op,
const QList< ctkLDAPExpr > &  args 
) [private]

Definition at line 51 of file ctkLDAPExpr.cpp.

ctkLDAPExpr::ctkLDAPExpr ( int  op,
const QString &  attrName,
const QString &  attrValue 
) [private]

Definition at line 56 of file ctkLDAPExpr.cpp.


Member Function Documentation

bool ctkLDAPExpr::compare ( const QVariant &  obj,
int  op,
const QString &  s 
) const [private]

Definition at line 159 of file ctkLDAPExpr.cpp.

bool ctkLDAPExpr::compareQString ( const QString &  s1,
int  op,
const QString &  s2 
) [static, private]

Definition at line 231 of file ctkLDAPExpr.cpp.

bool ctkLDAPExpr::evaluate ( const ctkDictionary p,
bool  matchCase 
) const

Evaluate this LDAP filter.

Definition at line 132 of file ctkLDAPExpr.cpp.

const QString ctkLDAPExpr::fixupQString ( const QString &  s  )  [static, private]

Definition at line 247 of file ctkLDAPExpr.cpp.

QSet< QString > ctkLDAPExpr::getMatchedObjectClasses (  )  const

Get object class set matched by this LDAP expression. This will not work with wildcards and NOT expressions. If a set can not be determined return null.

Returns:
std::set of classes matched, otherwise null.

Definition at line 66 of file ctkLDAPExpr.cpp.

bool ctkLDAPExpr::isSimple ( const QList< QString > &  keywords,
QHash< int, QList< QString > > &  cache,
bool  matchCase 
) const

Checks if this LDAP expression is "simple". The definition of a simple filter is:

  • (<it>name</it>=<it>value</it>) is simple if <it>name</it> is a member of the provided keywords, and <it>value</it> does not contain a wildcard character;
  • (| EXPR+ ) is simple if all EXPR expressions are simple;
  • No other expressions are simple.

If the filter is found to be simple, the cache is filled with mappings from the provided keywords to lists of attribute values. The keyword-value-pairs are the ones that satisfy this expression, for the given keywords.

Parameters:
keywords The keywords to look for.
cache An array (indexed by the keyword indexes) of lists to fill in with values saturating this expression.
Returns:
true if this expression is simple, false otherwise.

Definition at line 105 of file ctkLDAPExpr.cpp.

ctkLDAPExpr ctkLDAPExpr::parseExpr ( ParseState ps  )  throw (ctkInvalidSyntaxException) [static, private]

Definition at line 292 of file ctkLDAPExpr.cpp.

ctkLDAPExpr ctkLDAPExpr::parseSimple ( ParseState ps  )  throw (ctkInvalidSyntaxException) [static, private]

Definition at line 323 of file ctkLDAPExpr.cpp.

bool ctkLDAPExpr::patSubstr ( const QString &  s,
const QString &  pat 
) [static, private]

Definition at line 287 of file ctkLDAPExpr.cpp.

bool ctkLDAPExpr::patSubstr ( const QString &  s,
int  si,
const QString &  pat,
int  pi 
) [static, private]

Definition at line 263 of file ctkLDAPExpr.cpp.

bool ctkLDAPExpr::query ( const QString &  filter,
const ctkDictionary pd 
) throw (ctkInvalidSyntaxException) [static]

Definition at line 127 of file ctkLDAPExpr.cpp.

const QString ctkLDAPExpr::toQString (  )  const

Definition at line 347 of file ctkLDAPExpr.cpp.


Member Data Documentation

const int ctkLDAPExpr::AND = 0 [static]

Definition at line 46 of file ctkLDAPExpr.h.

const int ctkLDAPExpr::APPROX = 32 [static]

Definition at line 52 of file ctkLDAPExpr.h.

const int ctkLDAPExpr::COMPLEX = AND | OR | NOT [static]

Definition at line 53 of file ctkLDAPExpr.h.

QSharedDataPointer<ctkLDAPExprData> ctkLDAPExpr::d [private]

Shared pointer.

Definition at line 192 of file ctkLDAPExpr.h.

const QString ctkLDAPExpr::EOS = "Unexpected end of query" [static, private]

Definition at line 185 of file ctkLDAPExpr.h.

const int ctkLDAPExpr::EQ = 4 [static]

Definition at line 49 of file ctkLDAPExpr.h.

const QString ctkLDAPExpr::GARBAGE = "Trailing garbage" [static, private]

Definition at line 184 of file ctkLDAPExpr.h.

const int ctkLDAPExpr::GE = 16 [static]

Definition at line 51 of file ctkLDAPExpr.h.

const int ctkLDAPExpr::LE = 8 [static]

Definition at line 50 of file ctkLDAPExpr.h.

const QString ctkLDAPExpr::MALFORMED = "Malformed query" [static, private]

Definition at line 186 of file ctkLDAPExpr.h.

const int ctkLDAPExpr::NOT = 2 [static]

Definition at line 48 of file ctkLDAPExpr.h.

const QString ctkLDAPExpr::NULLQ = "Null query" [static, private]

Definition at line 183 of file ctkLDAPExpr.h.

const QString ctkLDAPExpr::OPERATOR = "Undefined operator" [static, private]

Definition at line 187 of file ctkLDAPExpr.h.

const int ctkLDAPExpr::OR = 1 [static]

Definition at line 47 of file ctkLDAPExpr.h.

const int ctkLDAPExpr::SIMPLE = EQ | LE | GE | APPROX [static]

Definition at line 54 of file ctkLDAPExpr.h.

const QChar ctkLDAPExpr::WILDCARD = 65535 [static, private]

Definition at line 180 of file ctkLDAPExpr.h.

const QString ctkLDAPExpr::WILDCARD_QString = QString( WILDCARD ) [static, private]

Definition at line 181 of file ctkLDAPExpr.h.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines