Design Pattern Examples
Overview of object-oriented design patterns
IStateContext Struct Referenceabstract

Represents the context as passed to each state class. More...

#include <State_Class.h>

Collaboration diagram for IStateContext:
Collaboration graph

Public Types

using shared_ptr_t = std::shared_ptr< IStateContext >
 Alias to make using a shared pointer easier.
 

Public Member Functions

virtual ~IStateContext ()
 Virtual destructor as required for interfaces.
 
virtual char GetNextCharacter ()=0
 Get the next character from the input.
 
virtual void OutputCharacter (char character)=0
 Write the character to the context-> This is how the parser accumulates the filtered text.
 

Detailed Description

Represents the context as passed to each state class.

Each state class can access the next character or output the current character through this interface.

Definition at line 60 of file State_Class.h.

Member Typedef Documentation

◆ shared_ptr_t

using shared_ptr_t = std::shared_ptr<IStateContext>

Alias to make using a shared pointer easier.

Definition at line 65 of file State_Class.h.

Constructor & Destructor Documentation

◆ ~IStateContext()

virtual ~IStateContext ( )
inlinevirtual

Virtual destructor as required for interfaces.

Definition at line 70 of file State_Class.h.

Member Function Documentation

◆ GetNextCharacter()

virtual char GetNextCharacter ( )
pure virtual

Get the next character from the input.

Returns
Returns the next character. Returns EOF_CHAR if there is no more input.

◆ OutputCharacter()

virtual void OutputCharacter ( char  character)
pure virtual

Write the character to the context-> This is how the parser accumulates the filtered text.

Parameters
characterThe character to accumulate

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