C# Class CK.Text.JSONVisitor

Small JSON visitor.
Mostra file Open project: Invenietis/ck-core

Public Methods

Method Description
JSONVisitor ( StringMatcher m ) : System

Initializes a new JSONVisitor bound to a Matcher.

JSONVisitor ( string s ) : System

Initializes a new JSONVisitor on a string. A Matcher is automatically created.

Visit ( ) : bool

Visits any json item: it is either a terminal (VisitTerminalValue), {"an":"object"} (see VisitObjectContent or ["an","array"] (see VisitArrayContent).

VisitArrayContent ( ) : bool

Visits a comma seprarated list of json items until a closing ']' is found.

VisitObjectContent ( ) : bool

Visits a comma seprarated list of "property" : ... fields until a closing } is found or Matcher.IsEnd becomes true.

Protected Methods

Method Description
SkipWhiteSpaces ( ) : void

Skips white spaces: simply calls StringMatcher.MatchWhiteSpaces(int) with 0 minimal count of spaces.

VisitArrayCell ( int cellNumber ) : bool

Visits a cell in a Parent array.

VisitObjectProperty ( int startPropertyIndex, string propertyName, int propertyNumber ) : bool

Visits a "property" : ... JSON property.

VisitTerminalValue ( ) : bool

Visits a terminal value. This method simply calls Matcher.MatchWhiteSpaces(0) to skip any whitespace and TryMatchJSONTerminalValue to skip the value itself.

Method Details

JSONVisitor() public method

Initializes a new JSONVisitor bound to a Matcher.
public JSONVisitor ( StringMatcher m ) : System
m StringMatcher The string matcher.
return System

JSONVisitor() public method

Initializes a new JSONVisitor on a string. A Matcher is automatically created.
public JSONVisitor ( string s ) : System
s string The string to parse.
return System

SkipWhiteSpaces() protected method

Skips white spaces: simply calls StringMatcher.MatchWhiteSpaces(int) with 0 minimal count of spaces.
protected SkipWhiteSpaces ( ) : void
return void

Visit() public method

Visits any json item: it is either a terminal (VisitTerminalValue), {"an":"object"} (see VisitObjectContent or ["an","array"] (see VisitArrayContent).
public Visit ( ) : bool
return bool

VisitArrayCell() protected method

Visits a cell in a Parent array.
protected VisitArrayCell ( int cellNumber ) : bool
cellNumber int Zero based cell nummber.
return bool

VisitArrayContent() public method

Visits a comma seprarated list of json items until a closing ']' is found.
public VisitArrayContent ( ) : bool
return bool

VisitObjectContent() public method

Visits a comma seprarated list of "property" : ... fields until a closing } is found or Matcher.IsEnd becomes true.
public VisitObjectContent ( ) : bool
return bool

VisitObjectProperty() protected method

Visits a "property" : ... JSON property.
protected VisitObjectProperty ( int startPropertyIndex, string propertyName, int propertyNumber ) : bool
startPropertyIndex int /// Starting index of the in : /// this is the index of the opening quote ". ///
propertyName string Parsed property name.
propertyNumber int Zero based number of the property in the object.
return bool

VisitTerminalValue() protected method

Visits a terminal value. This method simply calls Matcher.MatchWhiteSpaces(0) to skip any whitespace and TryMatchJSONTerminalValue to skip the value itself.
protected VisitTerminalValue ( ) : bool
return bool