Ult3D
Implementation of "Ultimate 3D Game Engine Design & Architecture" by Allan Sherrod
Loading...
Searching...
No Matches
Ult::TokenStream Class Reference

#include <TokenStream.h>

Public Member Functions

 TokenStream ()
 
 ~TokenStream ()
 
void ResetStream ()
 
void SetTokenStream (const char *data)
 
bool GetNextToken (std::string *buffer)
 
bool GetNextToken (std::string *token, std::string *buffer)
 
bool MoveToNextLine (std::string *buffer)
 

Detailed Description

Class to parse and extract tokens from a string, where a token is a word/group of non-whitespace characters, or a group of characters surrounded by quotes (e.g. "my token here").

Constructor & Destructor Documentation

◆ TokenStream()

Ult::TokenStream::TokenStream ( )

TokenStream constructor.

◆ ~TokenStream()

Ult::TokenStream::~TokenStream ( )

TokenStream destructor.

Member Function Documentation

◆ GetNextToken() [1/2]

bool Ult::TokenStream::GetNextToken ( std::string * buffer)

Attempt to parse the next string token into buffer.

Parameters
bufferOptional string to store the token into.
Returns
True if a token was found, false otherwise.

◆ GetNextToken() [2/2]

bool Ult::TokenStream::GetNextToken ( std::string * token,
std::string * buffer )

Attempt to find the next instance of token and get the next token after that.

Parameters
bufferOptional string to store the token into.
Returns
True if the token after was found, false otherwise.

◆ MoveToNextLine()

bool Ult::TokenStream::MoveToNextLine ( std::string * buffer)

Read into buffer until a valid non-whitespace character is found.

Parameters
bufferOptional string to store the parsed characters into.
Returns
True if a new line was found, false otherwise.

◆ ResetStream()

void Ult::TokenStream::ResetStream ( )

Move parsing back to the beginning of the string.

◆ SetTokenStream()

void Ult::TokenStream::SetTokenStream ( const char * data)

Calls ResetStream and sets the string data to parse. Data is copied into a buffer internally.


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