KiCad PCB EDA Suite
|
LINE_READER that wraps a given std::istream instance. More...
#include <stdstream_line_reader.h>
Public Member Functions | |
STDISTREAM_LINE_READER () | |
~STDISTREAM_LINE_READER () | |
char * | ReadLine () override |
Read a line of text into the buffer and increments the line number counter. More... | |
void | SetStream (std::istream &aStream) |
Set the stream for this line reader. More... | |
virtual const wxString & | GetSource () const |
Returns the name of the source of the lines in an abstract sense. More... | |
char * | Line () const |
Return a pointer to the last line that was read in. More... | |
operator char * () const | |
A casting operator that returns a char* pointer to the start of the line buffer. More... | |
virtual unsigned | LineNumber () const |
Return the line number of the last line read from this LINE_READER. More... | |
unsigned | Length () const |
Return the number of bytes in the last line read from this LINE_READER. More... | |
Protected Member Functions | |
void | expandCapacity (unsigned aNewsize) |
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 | |
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... | |
Private Attributes | |
std::string | m_buffer |
std::istream * | m_stream |
LINE_READER that wraps a given std::istream instance.
Definition at line 37 of file stdstream_line_reader.h.
STDISTREAM_LINE_READER::STDISTREAM_LINE_READER | ( | ) |
Definition at line 28 of file stdstream_line_reader.cpp.
References LINE_READER::m_line, and LINE_READER::m_lineNum.
STDISTREAM_LINE_READER::~STDISTREAM_LINE_READER | ( | ) |
Definition at line 37 of file stdstream_line_reader.cpp.
References LINE_READER::m_line.
|
protectedinherited |
Will expand the capacity of line up to maxLineLength but not greater, so be careful about making assumptions of capacity after calling this.
Definition at line 135 of file richio.cpp.
References LINE_READER::m_capacity, LINE_READER::m_length, LINE_READER::m_line, and LINE_READER::m_maxLineLength.
Referenced by FILE_LINE_READER::ReadLine(), STRING_LINE_READER::ReadLine(), and INPUTSTREAM_LINE_READER::ReadLine().
|
inlinevirtualinherited |
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.
Reimplemented in FILTER_READER, and WHITESPACE_FILTER_READER.
Definition at line 109 of file richio.h.
References LINE_READER::m_source.
Referenced by LEGACY_PLUGIN::biuParse(), LEGACY_PLUGIN::checkVersion(), DSNLEXER::CurSource(), LEGACY_PLUGIN::degParse(), WRLPROC::GetFileName(), FILTER_READER::GetSource(), WHITESPACE_FILTER_READER::GetSource(), CMP_READER::Load(), LEGACY_NETLIST_READER::loadComponent(), LEGACY_NETLIST_READER::loadFootprintFilters(), LEGACY_NETLIST_READER::loadNet(), SCH_LEGACY_PLUGIN_CACHE::LoadPart(), SCH_LEGACY_PLUGIN_CACHE::loadPin(), LEGACY_PLUGIN::loadSETUP(), SCH_LEGACY_PLUGIN::loadSymbol(), GPCB_FPL_CACHE::parseFOOTPRINT(), KICAD_NETLIST_PARSER::parseNet(), and WRLPROC::WRLPROC().
|
inlineinherited |
Return the number of bytes in the last line read from this LINE_READER.
Definition at line 143 of file richio.h.
References LINE_READER::m_length.
Referenced by LEGACY_NETLIST_READER::loadComponent(), LEGACY_NETLIST_READER::loadFootprintFilters(), LEGACY_NETLIST_READER::loadNet(), KICAD_NETLIST_PARSER::parseNet(), DSNLEXER::readLine(), FILTER_READER::ReadLine(), and WHITESPACE_FILTER_READER::ReadLine().
|
inlineinherited |
Return a pointer to the last line that was read in.
Definition at line 117 of file richio.h.
References LINE_READER::m_line.
Referenced by bench_string_lr(), bench_string_lr_reuse(), bench_wxbis(), bench_wxbis_reuse(), bench_wxis(), bench_wxis_reuse(), LEGACY_PLUGIN::biuParse(), LEGACY_PLUGIN::checkVersion(), LEGACY_PLUGIN::degParse(), detect_file_type(), NETLIST_READER::GuessNetlistFileType(), SCH_LEGACY_PLUGIN_CACHE::Load(), CMP_READER::Load(), SCH_LEGACY_PLUGIN_CACHE::loadAliases(), SCH_LEGACY_PLUGIN_CACHE::loadArc(), SCH_LEGACY_PLUGIN_CACHE::loadBezier(), SCH_LEGACY_PLUGIN::loadBitmap(), SCH_LEGACY_PLUGIN::loadBusAlias(), SCH_LEGACY_PLUGIN::loadBusEntry(), SCH_LEGACY_PLUGIN_CACHE::loadCircle(), SCH_LEGACY_PLUGIN::LoadContent(), BITMAP_BASE::LoadData(), SCH_LEGACY_PLUGIN_CACHE::loadDocs(), SCH_LEGACY_PLUGIN_CACHE::loadDrawEntries(), SCH_LEGACY_PLUGIN_CACHE::loadField(), SCH_LEGACY_PLUGIN::loadFile(), EXCELLON_IMAGE::LoadFile(), SCH_LEGACY_PLUGIN_CACHE::loadFootprintFilters(), LEGACY_PLUGIN::loadFP_SHAPE(), SCH_LEGACY_PLUGIN_CACHE::loadHeader(), SCH_LEGACY_PLUGIN::loadHeader(), SCH_LEGACY_PLUGIN::loadJunction(), LEGACY_PLUGIN::loadMODULE_TEXT(), LP_CACHE::LoadModules(), LEGACY_NETLIST_READER::LoadNetlist(), SCH_LEGACY_PLUGIN::loadNoConnect(), SCH_LEGACY_PLUGIN::loadPageSettings(), SCH_LEGACY_PLUGIN_CACHE::LoadPart(), SCH_LEGACY_PLUGIN_CACHE::loadPin(), SCH_LEGACY_PLUGIN_CACHE::loadPolyLine(), SCH_LEGACY_PLUGIN_CACHE::loadRect(), SCH_LEGACY_PLUGIN::loadSymbol(), SCH_LEGACY_PLUGIN::loadText(), SCH_LEGACY_PLUGIN_CACHE::loadText(), LEGACY_PLUGIN::loadTrackList(), SCH_LEGACY_PLUGIN::loadWire(), LINE_READER::operator char *(), KICAD_NETLIST_PARSER::parseNet(), GPCB_FPL_CACHE::parseParameters(), DSNLEXER::PopReader(), SCH_EDITOR_CONTROL::processCmpToFootprintLinkFile(), MWAVE_POLYGONAL_SHAPE_DLG::ReadDataShapeDescr(), DSNLEXER::readLine(), FILTER_READER::ReadLine(), LP_CACHE::SkipIndex(), EXCELLON_IMAGE::TestFileIsExcellon(), and GERBER_FILE_IMAGE::TestFileIsRS274().
|
inlinevirtualinherited |
Return the line number of the last line read from this LINE_READER.
Lines start from 1.
Reimplemented in FILTER_READER, and WHITESPACE_FILTER_READER.
Definition at line 135 of file richio.h.
References LINE_READER::m_lineNum.
Referenced by LEGACY_PLUGIN::biuParse(), SCH_SEXPR_PARSER::checkpoint(), SCH_LEGACY_PLUGIN::checkpoint(), LEGACY_PLUGIN::checkpoint(), DSNLEXER::CurLineNumber(), LEGACY_PLUGIN::degParse(), FILTER_READER::LineNumber(), WHITESPACE_FILTER_READER::LineNumber(), CMP_READER::Load(), LEGACY_NETLIST_READER::loadComponent(), SCH_LEGACY_PLUGIN_CACHE::loadDocs(), LEGACY_NETLIST_READER::loadFootprintFilters(), LEGACY_PLUGIN::loadFP_SHAPE(), LEGACY_NETLIST_READER::loadNet(), LEGACY_PLUGIN::loadPAD(), SCH_LEGACY_PLUGIN_CACHE::LoadPart(), SCH_LEGACY_PLUGIN_CACHE::loadPin(), LEGACY_PLUGIN::loadSHEET(), SCH_LEGACY_PLUGIN::loadSymbol(), GPCB_FPL_CACHE::parseFOOTPRINT(), and KICAD_NETLIST_PARSER::parseNet().
|
inlineinherited |
A casting operator that returns a char* pointer to the start of the line buffer.
Definition at line 125 of file richio.h.
References LINE_READER::Line().
|
overridevirtual |
Read a line of text into the buffer and increments the line number counter.
If the line is larger than the maximum length passed to the constructor, then an exception is thrown. The line is nul terminated.
IO_ERROR | when a line is too long. |
Implements LINE_READER.
Definition at line 44 of file stdstream_line_reader.cpp.
References m_buffer, LINE_READER::m_length, LINE_READER::m_line, LINE_READER::m_lineNum, and m_stream.
void STDISTREAM_LINE_READER::SetStream | ( | std::istream & | aStream | ) |
Set the stream for this line reader.
aStream | a stream to read |
Definition at line 61 of file stdstream_line_reader.cpp.
References m_stream.
Referenced by IFSTREAM_LINE_READER::IFSTREAM_LINE_READER(), parse(), and KI_TEST::ReadBoardItemFromStream().
|
private |
Definition at line 53 of file stdstream_line_reader.h.
Referenced by ReadLine().
|
protectedinherited |
no. bytes allocated for line.
Definition at line 159 of file richio.h.
Referenced by LINE_READER::expandCapacity(), LINE_READER::LINE_READER(), FILE_LINE_READER::ReadLine(), STRING_LINE_READER::ReadLine(), and INPUTSTREAM_LINE_READER::ReadLine().
|
protectedinherited |
no. bytes in line before trailing nul.
Definition at line 155 of file richio.h.
Referenced by LINE_READER::expandCapacity(), LINE_READER::Length(), FILTER_READER::ReadLine(), WHITESPACE_FILTER_READER::ReadLine(), FILE_LINE_READER::ReadLine(), STRING_LINE_READER::ReadLine(), INPUTSTREAM_LINE_READER::ReadLine(), and ReadLine().
|
protectedinherited |
the read line of UTF8 text
Definition at line 158 of file richio.h.
Referenced by LINE_READER::expandCapacity(), FILTER_READER::FILTER_READER(), LINE_READER::Line(), LINE_READER::LINE_READER(), FILTER_READER::ReadLine(), WHITESPACE_FILTER_READER::ReadLine(), FILE_LINE_READER::ReadLine(), STRING_LINE_READER::ReadLine(), INPUTSTREAM_LINE_READER::ReadLine(), ReadLine(), STDISTREAM_LINE_READER(), WHITESPACE_FILTER_READER::WHITESPACE_FILTER_READER(), FILTER_READER::~FILTER_READER(), LINE_READER::~LINE_READER(), ~STDISTREAM_LINE_READER(), and WHITESPACE_FILTER_READER::~WHITESPACE_FILTER_READER().
|
protectedinherited |
Definition at line 156 of file richio.h.
Referenced by FILE_LINE_READER::FILE_LINE_READER(), LINE_READER::LineNumber(), FILE_LINE_READER::ReadLine(), STRING_LINE_READER::ReadLine(), INPUTSTREAM_LINE_READER::ReadLine(), ReadLine(), FILE_LINE_READER::Rewind(), STDISTREAM_LINE_READER(), and STRING_LINE_READER::STRING_LINE_READER().
|
protectedinherited |
maximum allowed capacity using resizing.
Definition at line 161 of file richio.h.
Referenced by LINE_READER::expandCapacity(), FILE_LINE_READER::ReadLine(), STRING_LINE_READER::ReadLine(), and INPUTSTREAM_LINE_READER::ReadLine().
|
protectedinherited |
origin of text lines, e.g. filename or "clipboard"
Definition at line 163 of file richio.h.
Referenced by FILE_LINE_READER::FILE_LINE_READER(), LINE_READER::GetSource(), IFSTREAM_LINE_READER::IFSTREAM_LINE_READER(), INPUTSTREAM_LINE_READER::INPUTSTREAM_LINE_READER(), and STRING_LINE_READER::STRING_LINE_READER().
|
private |
Definition at line 54 of file stdstream_line_reader.h.
Referenced by ReadLine(), and SetStream().