Skip to content

Utils.StringParserQuickTextReader

robbyxp1 edited this page Feb 13, 2024 · 8 revisions

StringParserQuickTextReader Class

Text Reader Parser Quick for JSON system.

public class StringParserQuickTextReader :
QuickJSON.Utils.IStringParserQuick

Inheritance System.Object 🡒 StringParserQuickTextReader

Implements IStringParserQuick


Constructors


StringParserQuickTextReader.StringParserQuickTextReader(TextReader, int) Constructor

Constructor

public StringParserQuickTextReader(System.IO.TextReader textreader, int chunksize);
Parameters

textreader System.IO.TextReader
Textreader to read from

chunksize System.Int32
Chunk size to take each time from textreader. Make sure its big enough to read the longest number


Properties


StringParserQuickTextReader.Line Property

Text of line in whole

public string Line { get; }
Property Value

System.String

Implements Line


StringParserQuickTextReader.Position Property

Current parse position

public int Position { get; }
Property Value

System.Int32

Implements Position


Methods


StringParserQuickTextReader.BackUp() Method

Backup one position

public void BackUp();

Implements BackUp()


StringParserQuickTextReader.ChecksumCharBlock(Func<char,bool>, bool) Method

Calculate a checksum on the next char block.

public uint ChecksumCharBlock(System.Func<char,bool> test, bool skipafter=true);
Parameters

test System.Func<System.Char,System.Boolean>
Test character, if true, accept it and continue

skipafter System.Boolean
True to skip spaces after the block ends

Returns

System.UInt32
Checksum, 0 if no chars

Implements ChecksumCharBlock(Func<char,bool>, bool)


StringParserQuickTextReader.GetChar() Method

Get next character or char.MinValue if at EOL.

public char GetChar();
Returns

System.Char

Implements GetChar()


StringParserQuickTextReader.GetNextNonSpaceChar(bool) Method

Skip spaces, then get next character or char.MinValue if at EOL. Optionally skip afterwards

public char GetNextNonSpaceChar(bool skipspacesafter=true);
Parameters

skipspacesafter System.Boolean

Returns

System.Char

Implements GetNextNonSpaceChar(bool)


StringParserQuickTextReader.IsCharMoveOn(char, bool) Method

Is this character at the current position, if so, skip it. Optionally skip space afterwards

public bool IsCharMoveOn(char t, bool skipspaceafter=true);
Parameters

t System.Char

skipspaceafter System.Boolean

Returns

System.Boolean

Implements IsCharMoveOn(char, bool)


StringParserQuickTextReader.IsEOL() Method

Is at End of Line

public bool IsEOL();
Returns

System.Boolean

Implements IsEOL()


StringParserQuickTextReader.IsStringMoveOn(string) Method

Is this string at the current position, if so, skip it and skip space

public bool IsStringMoveOn(string s);
Parameters

s System.String

Returns

System.Boolean

Implements IsStringMoveOn(string)


StringParserQuickTextReader.JNextNumber(bool, bool) Method

Read next number: long, ulong, bigint or double.

public QuickJSON.JToken JNextNumber(bool sign, bool skipafter=true);
Parameters

sign System.Boolean
True if negative. Sign has been removed

skipafter System.Boolean
True to skip spaces after the string ends

Returns

JToken
New JToken of number, Long, BigInt or Double. Null if failed

Implements JNextNumber(bool, bool)


StringParserQuickTextReader.JNextValue(char[], bool) Method

Read next token value from string then skip on

public QuickJSON.JToken JNextValue(char[] buffer, bool inarray);
Parameters

buffer System.Char[]
Buffer to place string into

inarray System.Boolean
True if in a json array

Returns

JToken
New JToken of string, Long, ULong, BigInt or Double, Bool. Null if failed

Implements JNextValue(char[], bool)


StringParserQuickTextReader.NextCharBlock(char[], Func<char,bool>, bool) Method

Read a character block.

public int NextCharBlock(char[] buffer, System.Func<char,bool> test, bool skipafter=true);
Parameters

buffer System.Char[]
Buffer to place string into

test System.Func<System.Char,System.Boolean>
Test function, if true, accept it, else stop here (without removing it)

skipafter System.Boolean
True to skip spaces after the block ends

Returns

System.Int32
Number of characters in buffer. -1 if it runs out of buffer space

Implements NextCharBlock(char[], Func<char,bool>, bool)


StringParserQuickTextReader.NextQuotedString(char, char[], bool, bool) Method

Get the next quoted string into buffer. Quote has already been removed.

public int NextQuotedString(char quote, char[] buffer, bool replaceescape=false, bool skipafter=true);
Parameters

quote System.Char
Quote character to stop on

buffer System.Char[]
Buffer to place string into

replaceescape System.Boolean
True to replace escape sequences \, /, \b, \f, \n, \r, \t, uNNNN

skipafter System.Boolean
True to skip spaces after the string ends

Returns

System.Int32
Number of characters in buffer. -1 if it runs out of store buffer space or reached end of data

Implements NextQuotedString(char, char[], bool, bool)


StringParserQuickTextReader.PeekChar() Method

Peek next character or char.MinValue if at EOL.

public char PeekChar();
Returns

System.Char

Implements PeekChar()


StringParserQuickTextReader.SkipSpace() Method

Skip all white space

public void SkipSpace();

Implements SkipSpace()

Clone this wiki locally