58#define LINE_READER_LINE_DEFAULT_MAX 1000000
59#define LINE_READER_LINE_INITIAL_SIZE 5000
110 operator char* ()
const
138 void expandCapacity(
unsigned aNewsize );
174 FILE_LINE_READER(
const wxString& aFileName,
unsigned aStartingLineNumber = 0,
191 FILE_LINE_READER( FILE* aFile,
const wxString& aFileName,
bool doOwn =
true,
192 unsigned aStartingLineNumber = 0,
213 long int FileLength();
277#define OUTPUTFMTBUFZ 500
314 static const char* GetQuoteChar(
const char* wrapee,
const char* quote_char );
323 virtual void write(
const char* aOutBuf,
int aCount ) = 0;
331#define PRINTF_FUNC_N __attribute__( ( format( printf, 3, 4 ) ) )
332#define PRINTF_FUNC __attribute__( ( format( printf, 2, 3 ) ) )
354 int PRINTF_FUNC_N Print(
int nestLevel,
const char* fmt, ... );
382 virtual const char* GetQuoteChar(
const char* wrapee )
const;
396 virtual std::string Quotes(
const std::string& aWrapee )
const;
398 std::string Quotew(
const wxString& aWrapee )
const;
410 int sprint(
const char* fmt, ... );
411 int vprint(
const char* fmt, va_list ap );
456 void write(
const char* aOutBuf,
int aCount )
override;
481 char aQuoteChar =
'"' );
486 void write(
const char* aOutBuf,
int aCount )
override;
497 KICAD_FORMAT::FORMAT_MODE aFormatMode = KICAD_FORMAT::FORMAT_MODE::NORMAL,
498 const wxChar* aMode = wxT(
"wt" ),
char aQuoteChar =
'"' );
509 void write(
const char* aOutBuf,
int aCount )
override;
void Rewind()
Rewind the file and resets the line number back to zero.
FILE_LINE_READER(const wxString &aFileName, unsigned aStartingLineNumber=0, unsigned aMaxLineLength=LINE_READER_LINE_DEFAULT_MAX)
Take aFileName and the size of the desired line buffer and opens the file and assumes the obligation ...
FILE * m_fp
I may own this file, but might not.
char * ReadLine() override
Read a line of text into the buffer and increments the line number counter.
bool m_iOwn
if I own the file, I'll promise to close it, else not.
LINE_READER(unsigned aMaxLineLength=LINE_READER_LINE_DEFAULT_MAX)
Build a line reader and fixes the length of the maximum supported line length to aMaxLineLength.
virtual char * ReadLine()=0
Read a line of text into the buffer and increments the line number counter.
virtual const wxString & GetSource() const
Returns the name of the source of the lines in an abstract sense.
unsigned m_maxLineLength
maximum allowed capacity using resizing.
unsigned m_length
no. bytes in line before trailing nul.
unsigned m_capacity
no. bytes allocated for line.
char * m_line
the read line of UTF8 text
virtual unsigned LineNumber() const
Return the line number of the last line read from this LINE_READER.
wxString m_source
origin of text lines, e.g. filename or "clipboard"
unsigned Length() const
Return the number of bytes in the last line read from this LINE_READER.
char * Line() const
Return a pointer to the last line that was read in.
STRING_LINE_READER(const std::string &aString, const wxString &aSource)
Construct a string line reader.
char * ReadLine() override
Read a line of text into the buffer and increments the line number counter.
KICOMMON_API wxString SafeReadFile(const wxString &aFilePath, const wxString &aReadType)
Nominally opens a file and reads it into a string.
#define OUTPUTFMTBUFZ
default buffer size for any OUTPUT_FORMATTER
#define LINE_READER_LINE_DEFAULT_MAX