C# Class CsQuery.StringScanner.CharacterData

A static class to provide attribute information about characters, e.g. determining whether or not it belongs to a number of predefined classes. This creates an array of every possible character with a uint that is a bitmap (of up to 32 possible values) This permits very fast access to this information since it only needs to be looked up via an index. Uses an array of 65536 uints = 256K of memory.
Exibir arquivo Open project: prepare/HTML-Renderer Class Usage Examples

Public Properties

Property Type Description
charsHtmlSpaceArray char[]

Public Methods

Method Description
Closer ( char character ) : char

Return the closing character for a set of known opening enclosing characters (including single and double quotes)

CreateCharacterInfo ( ) : ICharacterInfo

Creates a new instance of the CharacterInfo class

CreateCharacterInfo ( char character ) : ICharacterInfo

Creates a new instance of the CharacterInfo class.

CreateStringInfo ( ) : IStringInfo

Creates a new StringInfo instance

CreateStringInfo ( string text ) : IStringInfo

Creates a new StringInfo instance bound to a string

GetType ( char character ) : CharacterType

Gets a type with all flags set for the types implemented by this character

IsType ( char character, CharacterType type ) : bool

Test whether a character matches a set of flags defined by the paramter

MatchingBound ( char character ) : char

Return the matching bound for known opening and closing bound characters (same as Closer, but accepts closing tags and returns openers)

Private Methods

Method Description
CharacterData ( ) : System

Configuration of the xref of character info. This sets bitflags in the "characterFlags" array for every unicode value that defines its attributes. This creates a lookup table allowing very rapid access to metadata about a single character, useful during string-parsing and scanning.

CloserImpl ( char character ) : char
SetAlphaISO10646 ( uint hsb ) : void

Sets the bits for ISO 10646.

SetHtmlAttributeName ( uint hsb ) : void

Matches anything but the first character for a valid HTML attribute name.

SetHtmlTagNameExceptStart ( uint hsb ) : void

Add the . back in when actually parsing html

SetHtmlTagNameStart ( uint hsb ) : void

Add the : back in when actually parsing html

SetHtmlTagSelectorExceptStart ( uint hsb ) : void

Similar to above, we omit "." as a valid in-name char because it breaks chained CSS selectors.

SetHtmlTagSelectorStart ( uint hsb ) : void

We omit ":" as a valid name start character because it makes pseudoselectors impossible to parse.

SetRange ( uint flag, ushort start, ushort end ) : void
SetSelectorTerminator ( uint hsb ) : void
setBit ( char character, uint bit ) : void
setBit ( string forCharacters, uint bit ) : void

Method Details

Closer() public static method

Return the closing character for a set of known opening enclosing characters (including single and double quotes)
/// Thrown when the character is not a known opening bound ///
public static Closer ( char character ) : char
character char /// The opening bound character ///
return char

CreateCharacterInfo() public static method

Creates a new instance of the CharacterInfo class
public static CreateCharacterInfo ( ) : ICharacterInfo
return ICharacterInfo

CreateCharacterInfo() public static method

Creates a new instance of the CharacterInfo class.
public static CreateCharacterInfo ( char character ) : ICharacterInfo
character char /// The character to bind to the new instance. ///
return ICharacterInfo

CreateStringInfo() public static method

Creates a new StringInfo instance
public static CreateStringInfo ( ) : IStringInfo
return IStringInfo

CreateStringInfo() public static method

Creates a new StringInfo instance bound to a string
public static CreateStringInfo ( string text ) : IStringInfo
text string /// The string to bind. ///
return IStringInfo

GetType() public static method

Gets a type with all flags set for the types implemented by this character
public static GetType ( char character ) : CharacterType
character char /// The character to test ///
return CharacterType

IsType() public static method

Test whether a character matches a set of flags defined by the paramter
public static IsType ( char character, CharacterType type ) : bool
character char /// The character to test ///
type CharacterType /// The type to which to compare the character ///
return bool

MatchingBound() public static method

Return the matching bound for known opening and closing bound characters (same as Closer, but accepts closing tags and returns openers)
/// Thrown when the requested operation is invalid. ///
public static MatchingBound ( char character ) : char
character char /// The opening bound character ///
return char

Property Details

charsHtmlSpaceArray public_oe static_oe property

An array of all HTML "space" characters.
public static char[] charsHtmlSpaceArray
return char[]