Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
FTokenStream Class Reference

#include <ExpressionParserTypes.h>

+ Collaboration diagram for FTokenStream:

Public Member Functions

TOptional< FStringTokenParseToken (TFunctionRef< EParseState(TCHAR)> Pred, FStringToken *Accumulate=nullptr) const
 
TOptional< FStringTokenParseToken (const TCHAR *Symbol, FStringToken *Accumulate=nullptr) const
 
TOptional< FStringTokenParseTokenIgnoreCase (const TCHAR *Symbol, FStringToken *Accumulate=nullptr) const
 
TOptional< FStringTokenParseSymbol (FStringToken *Accumulate=nullptr) const
 
TOptional< FStringTokenParseSymbol (TCHAR Symbol, FStringToken *Accumulate=nullptr) const
 
TOptional< FStringTokenParseWhitespace (FStringToken *Accumulate=nullptr) const
 
TOptional< FStringTokenGenerateToken (int32 NumChars, FStringToken *Accumulate=nullptr) const
 
 FTokenStream (const TCHAR *In)
 
TCHAR PeekChar (int32 Offset=0) const
 
int32 CharsRemaining () const
 
bool IsReadPosValid (const TCHAR *InPos, int32 MinNumChars=1) const
 
bool IsEmpty () const
 
int32 GetPosition () const
 
const TCHAR * GetStart () const
 
const TCHAR * GetRead () const
 
const TCHAR * GetEnd () const
 
FString GetErrorContext () const
 
void SetReadPos (const FStringToken &Token)
 

Private Attributes

const TCHAR * Start
 
const TCHAR * End
 
const TCHAR * ReadPos
 

Detailed Description

A token stream wraps up a raw string, providing accessors into it for consuming tokens

Definition at line 89 of file ExpressionParserTypes.h.

Constructor & Destructor Documentation

◆ FTokenStream()

FTokenStream::FTokenStream ( const TCHAR * In)

Constructor. The stream is only valid for the lifetime of the string provided

Member Function Documentation

◆ CharsRemaining()

int32 FTokenStream::CharsRemaining ( ) const

Get the number of characters remaining in the stream after the current read position

◆ GenerateToken()

TOptional< FStringToken > FTokenStream::GenerateToken ( int32 NumChars,
FStringToken * Accumulate = nullptr ) const

Generate a token for the specified number of chars, at the current read position (or end of Accumulate)

◆ GetEnd()

const TCHAR * FTokenStream::GetEnd ( ) const
inline

Definition at line 139 of file ExpressionParserTypes.h.

◆ GetErrorContext()

FString FTokenStream::GetErrorContext ( ) const

Get the error context from the current read position

◆ GetPosition()

int32 FTokenStream::GetPosition ( ) const

Get the current read position from the start of the stream

◆ GetRead()

const TCHAR * FTokenStream::GetRead ( ) const
inline

Definition at line 138 of file ExpressionParserTypes.h.

◆ GetStart()

const TCHAR * FTokenStream::GetStart ( ) const
inline

Definition at line 137 of file ExpressionParserTypes.h.

◆ IsEmpty()

bool FTokenStream::IsEmpty ( ) const

Check if the stream is empty

◆ IsReadPosValid()

bool FTokenStream::IsReadPosValid ( const TCHAR * InPos,
int32 MinNumChars = 1 ) const

Check if it is valid to read (the optional number of characters) from the specified position

◆ ParseSymbol() [1/2]

TOptional< FStringToken > FTokenStream::ParseSymbol ( FStringToken * Accumulate = nullptr) const

Return a string token for the next character in the stream (or accumulating into the specified existing token)

◆ ParseSymbol() [2/2]

TOptional< FStringToken > FTokenStream::ParseSymbol ( TCHAR Symbol,
FStringToken * Accumulate = nullptr ) const

Attempt parse out the specified pre-defined string from the current read position (or accumulating into the specified existing token)

◆ ParseToken() [1/2]

TOptional< FStringToken > FTokenStream::ParseToken ( const TCHAR * Symbol,
FStringToken * Accumulate = nullptr ) const

Attempt parse out the specified pre-defined string from the current read position (or accumulating into the specified existing token)

◆ ParseToken() [2/2]

TOptional< FStringToken > FTokenStream::ParseToken ( TFunctionRef< EParseState(TCHAR)> Pred,
FStringToken * Accumulate = nullptr ) const

Parse out a token using the supplied predicate. Will keep consuming characters into the resulting token provided the predicate returns EParseState::Continue or EParseState::StopAfter. Optionally supply a token to accumulate into Returns a string token for the stream, or empty on error

◆ ParseTokenIgnoreCase()

TOptional< FStringToken > FTokenStream::ParseTokenIgnoreCase ( const TCHAR * Symbol,
FStringToken * Accumulate = nullptr ) const

◆ ParseWhitespace()

TOptional< FStringToken > FTokenStream::ParseWhitespace ( FStringToken * Accumulate = nullptr) const

Parse a whitespace token

◆ PeekChar()

TCHAR FTokenStream::PeekChar ( int32 Offset = 0) const

Peek at the character at the specified offset from the current read position

◆ SetReadPos()

void FTokenStream::SetReadPos ( const FStringToken & Token)

Set the current read position to the character proceeding the specified token

Member Data Documentation

◆ End

const TCHAR* FTokenStream::End
private

The end of the expression

Definition at line 152 of file ExpressionParserTypes.h.

◆ ReadPos

const TCHAR* FTokenStream::ReadPos
private

The current read position in the expression

Definition at line 154 of file ExpressionParserTypes.h.

◆ Start

const TCHAR* FTokenStream::Start
private

The start of the expression

Definition at line 150 of file ExpressionParserTypes.h.


The documentation for this class was generated from the following file: