KiCad PCB EDA Suite
numEval::INPUTSTREAM_LINE_READER Class Reference

Class INPUTSTREAM_LINE_READER is a LINE_READER that reads from a wxInputStream object. More...

Inheritance diagram for numEval::INPUTSTREAM_LINE_READER:
numEval::LINE_READER

Public Member Functions

 INPUTSTREAM_LINE_READER (wxInputStream *aStream, const wxString &aSource)
 Constructor WXINPUTSTREAM_LINE_READER. More...
 
char * ReadLine () override
 Function ReadLine reads a line of text into the buffer and increments the line number counter. More...
 
virtual const wxString & GetSource () const
 Function GetSource returns the name of the source of the lines in an abstract sense. More...
 
char * Line () const
 Function Line returns a pointer to the last line that was read in. More...
 
 operator char * () const
 Operator char* is a casting operator that returns a char* pointer to the start of the line buffer. More...
 
virtual unsigned LineNumber () const
 Function Line Number returns the line number of the last line read from this LINE_READER. More...
 
unsigned Length () const
 Function Length returns the number of bytes in the last line read from this LINE_READER. More...
 

Protected Member Functions

void expandCapacity (unsigned aNewsize)
 Function expandCapacity will expand the capacity of line up to maxLineLength but not greater, so be careful about making assumptions of capacity after calling this. More...
 

Protected Attributes

wxInputStream * m_stream
 
unsigned m_length
 no. bytes in line before trailing nul. More...
 
unsigned m_lineNum
 
char * m_line
 the read line of UTF8 text More...
 
unsigned m_capacity
 no. bytes allocated for line. More...
 
unsigned m_maxLineLength
 maximum allowed capacity using resizing. More...
 
wxString m_source
 origin of text lines, e.g. filename or "clipboard" More...
 

Detailed Description

Class INPUTSTREAM_LINE_READER is a LINE_READER that reads from a wxInputStream object.

Definition at line 290 of file numeric_evaluator.cpp.

Constructor & Destructor Documentation

numEval::INPUTSTREAM_LINE_READER::INPUTSTREAM_LINE_READER ( wxInputStream *  aStream,
const wxString &  aSource 
)

Constructor WXINPUTSTREAM_LINE_READER.

Parameters
aStreamA pointer to a wxInputStream object to read.
aSourceThe name of the stream source, for error reporting purposes.

Member Function Documentation

void numEval::LINE_READER::expandCapacity ( unsigned  aNewsize)
protectedinherited

Function expandCapacity will expand the capacity of line up to maxLineLength but not greater, so be careful about making assumptions of capacity after calling this.

virtual const wxString& numEval::LINE_READER::GetSource ( ) const
inlinevirtualinherited

Function GetSource returns the name of the source of the lines in an abstract sense.

This may be a file or it may be the clipboard or any other source of lines of text. The returned string is useful for reporting error messages.

Definition at line 130 of file numeric_evaluator.cpp.

131 {
132  // Feed parser token after token until end of input.
133 
unsigned numEval::LINE_READER::Length ( ) const
inlineinherited

Function Length returns the number of bytes in the last line read from this LINE_READER.

Definition at line 168 of file numeric_evaluator.cpp.

char* numEval::LINE_READER::Line ( ) const
inlineinherited

Function Line returns a pointer to the last line that was read in.

Definition at line 139 of file numeric_evaluator.cpp.

140  {
141  m_parseFinished = true;
142  return true;
virtual unsigned numEval::LINE_READER::LineNumber ( ) const
inlinevirtualinherited

Function Line Number returns the line number of the last line read from this LINE_READER.

Lines start from 1.

Definition at line 159 of file numeric_evaluator.cpp.

163 {
numEval::LINE_READER::operator char * ( ) const
inlineinherited

Operator char* is a casting operator that returns a char* pointer to the start of the line buffer.

Definition at line 149 of file numeric_evaluator.cpp.

151  {
152  // Reset parser by passing zero as token ID, value is ignored.
char* numEval::INPUTSTREAM_LINE_READER::ReadLine ( )
overridevirtual

Function ReadLine reads a line of text into the buffer and increments the line number counter.

If the line is larger than aMaxLineLength passed to the constructor, then an exception is thrown. The line is nul terminated.

Returns
char* - The beginning of the read line, or NULL if EOF.
Exceptions
IO_ERRORwhen a line is too long.

Implements numEval::LINE_READER.

Member Data Documentation

unsigned numEval::LINE_READER::m_capacity
protectedinherited

no. bytes allocated for line.

Definition at line 88 of file numeric_evaluator.cpp.

unsigned numEval::LINE_READER::m_length
protectedinherited

no. bytes in line before trailing nul.

Definition at line 84 of file numeric_evaluator.cpp.

char* numEval::LINE_READER::m_line
protectedinherited

the read line of UTF8 text

Definition at line 87 of file numeric_evaluator.cpp.

unsigned numEval::LINE_READER::m_lineNum
protectedinherited

Definition at line 85 of file numeric_evaluator.cpp.

unsigned numEval::LINE_READER::m_maxLineLength
protectedinherited

maximum allowed capacity using resizing.

Definition at line 90 of file numeric_evaluator.cpp.

wxString numEval::LINE_READER::m_source
protectedinherited

origin of text lines, e.g. filename or "clipboard"

Definition at line 92 of file numeric_evaluator.cpp.

wxInputStream* numEval::INPUTSTREAM_LINE_READER::m_stream
protected

Definition at line 293 of file numeric_evaluator.cpp.


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