54 __attribute__ ((format (printf, 2, 3)))
56 StrPrintf( std::string* aResult,
const char* aFormat, ... );
68 __attribute__ ((format (printf, 1, 2)))
85#define LINE_READER_LINE_DEFAULT_MAX 1000000
86#define LINE_READER_LINE_INITIAL_SIZE 5000
137 operator char* ()
const
165 void expandCapacity(
unsigned aNewsize );
201 FILE_LINE_READER(
const wxString& aFileName,
unsigned aStartingLineNumber = 0,
218 FILE_LINE_READER( FILE* aFile,
const wxString& aFileName,
bool doOwn =
true,
219 unsigned aStartingLineNumber = 0,
227 char* ReadLine()
override;
240 long int FileLength();
279 char* ReadLine()
override;
297 char* ReadLine()
override;
304#define OUTPUTFMTBUFZ 500
325 m_buffer( aReserve,
'\0' )
327 quoteChar[0] = aQuoteChar;
341 static const char* GetQuoteChar(
const char* wrapee,
const char* quote_char );
350 virtual void write(
const char* aOutBuf,
int aCount ) = 0;
358#define PRINTF_FUNC __attribute__( ( format( printf, 3, 4 ) ) )
379 int PRINTF_FUNC Print(
int nestLevel,
const char* fmt, ... );
396 virtual const char* GetQuoteChar(
const char* wrapee )
const;
410 virtual std::string Quotes(
const std::string& aWrapee )
const;
412 std::string Quotew(
const wxString& aWrapee )
const;
424 int sprint(
const char* fmt, ... );
425 int vprint(
const char* fmt, va_list ap );
465 void write(
const char* aOutBuf,
int aCount )
override;
490 char aQuoteChar =
'"' );
495 void write(
const char* aOutBuf,
int aCount )
override;
506 char aQuoteChar =
'"' );
514 bool Finish()
override;
517 void write(
const char* aOutBuf,
int aCount )
override;
A LINE_READER that reads from an open file.
void Rewind()
Rewind the file and resets the line number back to zero.
FILE * m_fp
I may own this file, but might not.
bool m_iOwn
if I own the file, I'll promise to close it, else not.
An abstract class from which implementation specific LINE_READERs may be derived to read single lines...
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.
Is a LINE_READER that reads from a multiline 8 bit wide std::string.
static int vprint(std::string *result, const char *format, va_list ap)
KICOMMON_API wxString SafeReadFile(const wxString &aFilePath, const wxString &aReadType)
Nominally opens a file and reads it into a string.
KICOMMON_API int StrPrintf(std::string *aResult, const char *aFormat,...)
This is like sprintf() but the output is appended to a std::string instead of to a character array.
#define OUTPUTFMTBUFZ
default buffer size for any OUTPUT_FORMATTER
#define LINE_READER_LINE_DEFAULT_MAX