Gyoji Compiler
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Gyoji::misc::InputSource Class Referenceabstract

Input Source used by lexer. More...

#include <input-source.hpp>

Inheritance diagram for Gyoji::misc::InputSource:
Inheritance graph
[legend]

Public Member Functions

 InputSource ()
 Constructor just provides an interface.
 
 ~InputSource ()
 Move along, nothing to see here.
 
virtual void read (char *buf, int &result, int max_size)=0
 

Detailed Description

Input Source used by lexer.

This interface is used to provide the lexer/parser with a method of reading the input data. This can be implemented as a file reader to read data from a file and can also be implemented as a string buffer reader to read from memory.

Constructor & Destructor Documentation

◆ InputSource()

InputSource::InputSource ( )

Constructor just provides an interface.

This class has no concrete implementation, but is just an interface that other classes may provide implementations for.

◆ ~InputSource()

InputSource::~InputSource ( )

Move along, nothing to see here.

Move along, nothing to see here.

Member Function Documentation

◆ read()

virtual void Gyoji::misc::InputSource::read ( char *  buf,
int &  result,
int  max_size 
)
pure virtual

Sub-classes must implement this method to provide input to the parser.

Parameters
bufThis is the buffer provided by the parser. This method should place the result of the read into the buffer provided.
resultThis is the number of bytes actually read by the input source.
max_sizeThis is the maximum number of bytes to be read from the input source. Note that result must always be less than or equal to max_size in order to ensure that the buffer is not overflowed.

Implemented in Gyoji::misc::InputSourceFile.


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