CppMicroServices

C++ Micro Services: LDAPProp Class Reference
LDAPProp Class Reference

A fluent API for creating LDAP filter strings. More...

Public Member Functions

 LDAPProp (const std::string &property)
 Create a LDAPProp instance for the named LDAP property. More...
 
 operator LDAPPropExpr () const
 
LDAPPropExpr operator! () const
 States the absence of the LDAP property. More...
 
LDAPPropExpr operator== (const std::string &s) const
 LDAP equality '='. More...
 
LDAPPropExpr operator== (const us::Any &s) const
 LDAP equality '='. More...
 
template<class T >
LDAPPropExpr operator== (const T &s) const
 LDAP equality '='. More...
 
LDAPPropExpr operator!= (const std::string &s) const
 Convenience operator for LDAP inequality. More...
 
LDAPPropExpr operator!= (const us::Any &s) const
 Convenience operator for LDAP inequality. More...
 
template<class T >
LDAPPropExpr operator!= (const T &s) const
 Convenience operator for LDAP inequality. More...
 
LDAPPropExpr operator>= (const std::string &s) const
 LDAP greater or equal '>='. More...
 
LDAPPropExpr operator>= (const us::Any &s) const
 LDAP greater or equal '>='. More...
 
template<class T >
LDAPPropExpr operator>= (const T &s) const
 LDAP greater or equal '>='. More...
 
LDAPPropExpr operator<= (const std::string &s) const
 LDAP less or equal '<='. More...
 
LDAPPropExpr operator<= (const us::Any &s) const
 LDAP less or equal '<='. More...
 
template<class T >
LDAPPropExpr operator<= (const T &s) const
 LDAP less or equal '<='. More...
 
LDAPPropExpr Approx (const std::string &s) const
 LDAP approximation '~='. More...
 
LDAPPropExpr Approx (const us::Any &s) const
 LDAP approximation '~='. More...
 
template<class T >
LDAPPropExpr Approx (const T &s) const
 LDAP approximation '~='. More...
 

Detailed Description

A fluent API for creating LDAP filter strings.

Examples for creating LDAPFilter objects:

// This creates the filter "(&(name=Ben)(!(count=1)))"
LDAPFilter filter(LDAPProp("name") == "Ben" && !(LDAPProp("count") == 1));
// This creates the filter "(|(presence=*)(!(absence=*)))"
LDAPFilter filter(LDAPProp("presence") || !LDAPProp("absence"));
// This creates the filter "(&(ge>=-3)(approx~=hi))"
LDAPFilter filter(LDAPProp("ge") >= -3 && LDAPProp("approx").Approx("hi"));
See also
LDAPFilter

Constructor & Destructor Documentation

LDAPProp::LDAPProp ( const std::string &  property)

Create a LDAPProp instance for the named LDAP property.

Parameters
propertyThe name of the LDAP property.

Member Function Documentation

LDAPPropExpr LDAPProp::Approx ( const std::string &  s) const

LDAP approximation '~='.

Parameters
sA type convertible to std::string.
Returns
A LDAP expression object.
LDAPPropExpr LDAPProp::Approx ( const us::Any &  s) const

LDAP approximation '~='.

Parameters
sA type convertible to std::string.
Returns
A LDAP expression object.
template<class T >
LDAPPropExpr LDAPProp::Approx ( const T &  s) const
inline

LDAP approximation '~='.

Parameters
sA type convertible to std::string.
Returns
A LDAP expression object.
LDAPProp::operator LDAPPropExpr ( ) const
LDAPPropExpr LDAPProp::operator! ( ) const

States the absence of the LDAP property.

Returns
A LDAP expression object.
LDAPPropExpr LDAPProp::operator!= ( const std::string &  s) const

Convenience operator for LDAP inequality.

Writing either

LDAPProp("attr") != "val"

or

!(LDAPProp("attr") == "val")

leads to the same string "(!(attr=val))".

Parameters
sA type convertible to std::string.
Returns
A LDAP expression object.
LDAPPropExpr LDAPProp::operator!= ( const us::Any &  s) const

Convenience operator for LDAP inequality.

Writing either

LDAPProp("attr") != "val"

or

!(LDAPProp("attr") == "val")

leads to the same string "(!(attr=val))".

Parameters
sA type convertible to std::string.
Returns
A LDAP expression object.
template<class T >
LDAPPropExpr LDAPProp::operator!= ( const T &  s) const
inline

Convenience operator for LDAP inequality.

Writing either

LDAPProp("attr") != "val"

or

!(LDAPProp("attr") == "val")

leads to the same string "(!(attr=val))".

Parameters
sA type convertible to std::string.
Returns
A LDAP expression object.
LDAPPropExpr LDAPProp::operator<= ( const std::string &  s) const

LDAP less or equal '<='.

Parameters
sA type convertible to std::string.
Returns
A LDAP expression object.
LDAPPropExpr LDAPProp::operator<= ( const us::Any &  s) const

LDAP less or equal '<='.

Parameters
sA type convertible to std::string.
Returns
A LDAP expression object.
template<class T >
LDAPPropExpr LDAPProp::operator<= ( const T &  s) const
inline

LDAP less or equal '<='.

Parameters
sA type convertible to std::string.
Returns
A LDAP expression object.
LDAPPropExpr LDAPProp::operator== ( const std::string &  s) const

LDAP equality '='.

Parameters
sA type convertible to std::string.
Returns
A LDAP expression object.
LDAPPropExpr LDAPProp::operator== ( const us::Any &  s) const

LDAP equality '='.

Parameters
sA type convertible to std::string.
Returns
A LDAP expression object.
template<class T >
LDAPPropExpr LDAPProp::operator== ( const T &  s) const
inline

LDAP equality '='.

Parameters
sA type convertible to std::string.
Returns
A LDAP expression object.
LDAPPropExpr LDAPProp::operator>= ( const std::string &  s) const

LDAP greater or equal '>='.

Parameters
sA type convertible to std::string.
Returns
A LDAP expression object.
LDAPPropExpr LDAPProp::operator>= ( const us::Any &  s) const

LDAP greater or equal '>='.

Parameters
sA type convertible to std::string.
Returns
A LDAP expression object.
template<class T >
LDAPPropExpr LDAPProp::operator>= ( const T &  s) const
inline

LDAP greater or equal '>='.

Parameters
sA type convertible to std::string.
Returns
A LDAP expression object.