C# Class SimpleFramework.Xml.Stream.Splitter

The Splitter object is used split up a string in to tokens that can be used to create a camel case or hyphenated text representation of the string. This will preserve acronyms and numbers and splits tokens by case and character type. Examples of how a string would be splitted are as follows. CamelCaseString = "Camel" "Case" "String" hyphenated-text = "hyphenated" "text" URLAcronym = "URL" "acronym" RFC2616.txt = "RFC" "2616" "txt" By splitting strings in to individual words this allows the splitter to be used to assemble the words in a way that adheres to a specific style. Each style can then be applied to an XML document to give it a consistent format.
Mostra file Open project: ngallagher/simplexml

Protected Properties

Property Type Description
builder StringBuilder
count int
off int
text char[]

Public Methods

Method Description
Acronym ( ) : bool

This is used to extract a acronym from the source string. Once a token has been extracted the Commit method is called to add it to the string being build. Each time this is called a token, if extracted, will be committed to the string.

Commit ( char text, int off, int len ) : void

This is used to commit the provided text in to the style that is required. Committing the text to the buffer assembles the tokens resulting in a complete token.

IsDigit ( char ch ) : bool

This is used to determine if the provided string evaluates to a digit character. This delegates to Character so that the full range of unicode characters are considered.

IsLetter ( char ch ) : bool

This is used to determine if the provided string evaluates to a letter character. This delegates to System.Char so that the full range of unicode characters are considered.

IsSpecial ( char ch ) : bool

This is used to determine if the provided string evaluates to a symbol character. This delegates to System.Char so that the full range of unicode characters are considered.

IsUpper ( char ch ) : bool

This is used to determine if the provided string evaluates to an upper case letter. This delegates to System.Char so that the full range of unicode characters are considered.

Number ( ) : bool

This is used to extract a number from the source string. Once a token has been extracted the Commit method is called to add it to the string being build. Each time this is called a token, if extracted, will be committed to the string.

Parse ( char text, int off, int len ) : void

This is used to parse the provided text in to the style that is required. Manipulation of the text before committing it ensures that the text adheres to the required style.

Process ( ) : String

This is used to process the internal string and convert it in to a styled string. The styled string can then be used as an XML attribute or element providing a consistent format to the document that is being generated.

Splitter ( String source ) : System.Text

Constructor of the Splitter object. This is used to split the provided string in to individual words so that they can be assembled as a styled token, which can represent an XML attribute or element.

ToLower ( char ch ) : char

This is used to convert the provided character to a lower case character. This delegates to System.Char to perform the conversion so unicode characters are considered.

ToUpper ( char ch ) : char

This is used to convert the provided character to an upper case character. This delegates to System.Char to perform the conversion so unicode characters are considered.

Token ( ) : void

This is used to extract a token from the source string. Once a token has been extracted the Commit method is called to add it to the string being build. Each time this is called a token, if extracted, will be committed to the string. Before being committed the string is parsed for styling.

Method Details

Acronym() public method

This is used to extract a acronym from the source string. Once a token has been extracted the Commit method is called to add it to the string being build. Each time this is called a token, if extracted, will be committed to the string.
public Acronym ( ) : bool
return bool

Commit() public abstract method

This is used to commit the provided text in to the style that is required. Committing the text to the buffer assembles the tokens resulting in a complete token.
public abstract Commit ( char text, int off, int len ) : void
text char /// this is the text buffer to acquire the token from ///
off int /// this is the offset in the buffer token starts at ///
len int /// this is the length of the token to be committed ///
return void

IsDigit() public method

This is used to determine if the provided string evaluates to a digit character. This delegates to Character so that the full range of unicode characters are considered.
public IsDigit ( char ch ) : bool
ch char /// this is the character that is to be evaluated ///
return bool

IsLetter() public method

This is used to determine if the provided string evaluates to a letter character. This delegates to System.Char so that the full range of unicode characters are considered.
public IsLetter ( char ch ) : bool
ch char /// this is the character that is to be evaluated ///
return bool

IsSpecial() public method

This is used to determine if the provided string evaluates to a symbol character. This delegates to System.Char so that the full range of unicode characters are considered.
public IsSpecial ( char ch ) : bool
ch char /// this is the character that is to be evaluated ///
return bool

IsUpper() public method

This is used to determine if the provided string evaluates to an upper case letter. This delegates to System.Char so that the full range of unicode characters are considered.
public IsUpper ( char ch ) : bool
ch char /// this is the character that is to be evaluated ///
return bool

Number() public method

This is used to extract a number from the source string. Once a token has been extracted the Commit method is called to add it to the string being build. Each time this is called a token, if extracted, will be committed to the string.
public Number ( ) : bool
return bool

Parse() public abstract method

This is used to parse the provided text in to the style that is required. Manipulation of the text before committing it ensures that the text adheres to the required style.
public abstract Parse ( char text, int off, int len ) : void
text char /// this is the text buffer to acquire the token from ///
off int /// this is the offset in the buffer token starts at ///
len int /// this is the length of the token to be parsed ///
return void

Process() public method

This is used to process the internal string and convert it in to a styled string. The styled string can then be used as an XML attribute or element providing a consistent format to the document that is being generated.
public Process ( ) : String
return String

Splitter() public method

Constructor of the Splitter object. This is used to split the provided string in to individual words so that they can be assembled as a styled token, which can represent an XML attribute or element.
public Splitter ( String source ) : System.Text
source String /// this is the source that is to be split ///
return System.Text

ToLower() public method

This is used to convert the provided character to a lower case character. This delegates to System.Char to perform the conversion so unicode characters are considered.
public ToLower ( char ch ) : char
ch char /// this is the character that is to be converted ///
return char

ToUpper() public method

This is used to convert the provided character to an upper case character. This delegates to System.Char to perform the conversion so unicode characters are considered.
public ToUpper ( char ch ) : char
ch char /// this is the character that is to be converted ///
return char

Token() public method

This is used to extract a token from the source string. Once a token has been extracted the Commit method is called to add it to the string being build. Each time this is called a token, if extracted, will be committed to the string. Before being committed the string is parsed for styling.
public Token ( ) : void
return void

Property Details

builder protected_oe property

This is the string builder used to build the processed text.
protected StringBuilder builder
return StringBuilder

count protected_oe property

This is the number of characters to be considered for use.
protected int count
return int

off protected_oe property

This is the current read offset of the text string.
protected int off
return int

text protected_oe property

This is the original text that is to be split in to words.
protected char[] text
return char[]