C# Class Novell.Directory.Ldap.Rfc2251.RfcFilter

Represents an Ldap Filter. This filter object can be created from a String or can be built up programatically by adding filter components one at a time. Existing filter components can be iterated though. Each filter component has an integer identifier defined in this class. The following are basic filter components: {@link #EQUALITY_MATCH}, {@link #GREATER_OR_EQUAL}, {@link #LESS_OR_EQUAL}, {@link #SUBSTRINGS}, {@link #PRESENT}, {@link #APPROX_MATCH}, {@link #EXTENSIBLE_MATCH}. More filters can be nested together into more complex filters with the following filter components: {@link #AND}, {@link #OR}, {@link #NOT} Substrings can have three components:
 Filter ::= CHOICE { and             [0] SET OF Filter, or              [1] SET OF Filter, not             [2] Filter, equalityMatch   [3] AttributeValueAssertion, substrings      [4] SubstringFilter, greaterOrEqual  [5] AttributeValueAssertion, lessOrEqual     [6] AttributeValueAssertion, present         [7] AttributeDescription, approxMatch     [8] AttributeValueAssertion, extensibleMatch [9] MatchingRuleAssertion } 
Inheritance: Novell.Directory.Ldap.Asn1.Asn1Choice
显示文件 Open project: EventStore/csharp-ldap Class Usage Examples

Public Methods

Method Description
RfcFilter ( ) : System

Constructs a Filter object that will be built up piece by piece.

RfcFilter ( System filter ) : System

Constructs a Filter object by parsing an RFC 2254 Search Filter String.

addPresent ( System attrName ) : void

Creates and adds a present matching to the filter.

endNestedFilter ( int rfcType ) : void

Completes a nested filter and checks for the valid filter type.

endSubstrings ( ) : void

Completes a SubString filter component. @throws LdapLocalException Occurs when this is called out of sequence, or the substrings filter is empty.

filterToString ( ) : System.String

Creates and returns a String representation of this filter.

getFilterIterator ( ) : System.Collections.IEnumerator

Creates an iterator over the preparsed segments of a filter. The first object returned by an iterator is an integer indicating the type of filter components. Subseqence values are returned. If a component is of type 'AND' or 'OR' or 'NOT' then the value returned is another iterator. This iterator is used by toString.

startNestedFilter ( int rfcType ) : void

Creates and adds the Asn1Tagged value for a nestedFilter: AND, OR, or NOT. Note that a Not nested filter can only have one filter, where AND and OR do not

startSubstrings ( System attrName ) : void

Creates and addes a substrings filter component. startSubstrings must be immediatly followed by at least one {@link #addSubstring} method and one {@link #endSubstrings} method @throws Novell.Directory.Ldap.LdapLocalException Occurs when this component is created out of sequence.

Private Methods

Method Description
addAttributeValueAssertion ( int rfcType, System attrName, sbyte value_Renamed ) : void
addExtensibleMatch ( System matchingRule, System attrName, sbyte value_Renamed, bool useDNMatching ) : void
addObject ( Asn1Object current ) : void

Called by sequential filter building methods to add to a filter component. Verifies that the specified Asn1Object can be added, then adds the object to the filter.

addSubstring ( int type, sbyte value_Renamed ) : void
byteString ( sbyte value_Renamed ) : System.String

Convert a UTF8 encoded string, or binary data, into a String encoded for a string filter.

hex2int ( char c ) : int

Convert hex character to an integer. Return -1 if char is something other than a hex char.

parse ( System filterExpr ) : Asn1Tagged

Parses an RFC 2251 filter string into an ASN.1 Ldap Filter object.

parseFilter ( ) : Asn1Tagged

Parses an RFC 2254 filter

parseFilterComp ( ) : Asn1Tagged

RFC 2254 filter helper method. Will Parse a filter component.

parseFilterList ( ) : Asn1SetOf

Must have 1 or more Filters

stringFilter ( System itr, System filter ) : void

Uses a filterIterator to create a string representation of a filter.

unescapeString ( System string_Renamed ) : sbyte[]

Replace escaped hex digits with the equivalent binary representation. Assume either V2 or V3 escape mechanisms: V2: \*, \(, \), \\. V3: \2A, \28, \29, \5C, \00.

Method Details

RfcFilter() public method

Constructs a Filter object that will be built up piece by piece.
public RfcFilter ( ) : System
return System

RfcFilter() public method

Constructs a Filter object by parsing an RFC 2254 Search Filter String.
public RfcFilter ( System filter ) : System
filter System
return System

addPresent() public method

Creates and adds a present matching to the filter.
public addPresent ( System attrName ) : void
attrName System Name of the attribute to check for presence. /// @throws LdapLocalException /// Occurs if addPresent is called out of sequence. ///
return void

endNestedFilter() public method

Completes a nested filter and checks for the valid filter type.
public endNestedFilter ( int rfcType ) : void
rfcType int Type of filter to complete. /// @throws Novell.Directory.Ldap.LdapLocalException Occurs when the specified /// type differs from the current filter component. ///
return void

endSubstrings() public method

Completes a SubString filter component. @throws LdapLocalException Occurs when this is called out of sequence, or the substrings filter is empty.
public endSubstrings ( ) : void
return void

filterToString() public method

Creates and returns a String representation of this filter.
public filterToString ( ) : System.String
return System.String

getFilterIterator() public method

Creates an iterator over the preparsed segments of a filter. The first object returned by an iterator is an integer indicating the type of filter components. Subseqence values are returned. If a component is of type 'AND' or 'OR' or 'NOT' then the value returned is another iterator. This iterator is used by toString.
public getFilterIterator ( ) : System.Collections.IEnumerator
return System.Collections.IEnumerator

startNestedFilter() public method

Creates and adds the Asn1Tagged value for a nestedFilter: AND, OR, or NOT. Note that a Not nested filter can only have one filter, where AND and OR do not
public startNestedFilter ( int rfcType ) : void
rfcType int Filter type: /// [AND | OR | NOT] /// @throws Novell.Directory.Ldap.LdapLocalException ///
return void

startSubstrings() public method

Creates and addes a substrings filter component. startSubstrings must be immediatly followed by at least one {@link #addSubstring} method and one {@link #endSubstrings} method @throws Novell.Directory.Ldap.LdapLocalException Occurs when this component is created out of sequence.
public startSubstrings ( System attrName ) : void
attrName System
return void