KiCad PCB EDA Suite
richio.h File Reference
#include <vector>
#include <utf8.h>
#include <cstdio>
#include <wx/string.h>
#include <wx/stream.h>
#include <ki_exception.h>

Go to the source code of this file.

Classes

class  LINE_READER
 An abstract class from which implementation specific LINE_READERs may be derived to read single lines of text and manage a line number counter. More...
 
class  FILE_LINE_READER
 A LINE_READER that reads from an open file. More...
 
class  STRING_LINE_READER
 Is a LINE_READER that reads from a multiline 8 bit wide std::string. More...
 
class  INPUTSTREAM_LINE_READER
 A LINE_READER that reads from a wxInputStream object. More...
 
class  OUTPUTFORMATTER
 An interface used to output 8 bit text in a convenient way. More...
 
class  STRING_FORMATTER
 Implement an OUTPUTFORMATTER to a memory buffer. More...
 
class  FILE_OUTPUTFORMATTER
 Used for text file output. More...
 
class  STREAM_OUTPUTFORMATTER
 Implement an OUTPUTFORMATTER to a wxWidgets wxOutputStream. More...
 

Macros

#define LINE_READER_LINE_DEFAULT_MAX   1000000
 
#define LINE_READER_LINE_INITIAL_SIZE   5000
 
#define OUTPUTFMTBUFZ   500
 default buffer size for any OUTPUT_FORMATTER More...
 
#define PRINTF_FUNC
 

Functions

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. More...
 
std::string StrPrintf (const char *format,...)
 This is like sprintf() but the output is returned in a std::string instead of to a character array. More...
 

Macro Definition Documentation

◆ LINE_READER_LINE_DEFAULT_MAX

#define LINE_READER_LINE_DEFAULT_MAX   1000000

Definition at line 73 of file richio.h.

◆ LINE_READER_LINE_INITIAL_SIZE

#define LINE_READER_LINE_INITIAL_SIZE   5000

Definition at line 74 of file richio.h.

◆ OUTPUTFMTBUFZ

#define OUTPUTFMTBUFZ   500

default buffer size for any OUTPUT_FORMATTER

Definition at line 292 of file richio.h.

◆ PRINTF_FUNC

#define PRINTF_FUNC

Definition at line 350 of file richio.h.

Function Documentation

◆ StrPrintf() [1/2]

std::string StrPrintf ( const char *  format,
  ... 
)

This is like sprintf() but the output is returned in a std::string instead of to a character array.

Parameters
formatis a printf() style format string.
Returns
std::string - the result of the sprintf().

Definition at line 96 of file richio.cpp.

97{
98 std::string ret;
99 va_list args;
100
101 va_start( args, format );
102 ignore_unused( vprint( &ret, format, args ) );
103 va_end( args );
104
105 return ret;
106}
void ignore_unused(const T &)
Definition: ignore.h:24
static int vprint(std::string *result, const char *format, va_list ap)
Definition: richio.cpp:48

References ignore_unused(), and vprint().

◆ StrPrintf() [2/2]

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.

Parameters
aResultis the string to append to, previous text is not clear()ed.
aFormatis a printf() style format string.
Returns
the count of bytes appended to the result string, no terminating nul is included.

Definition at line 84 of file richio.cpp.

85{
86 va_list args;
87
88 va_start( args, format );
89 int ret = vprint( result, format, args );
90 va_end( args );
91
92 return ret;
93}

References vprint().

Referenced by IMPORT_PROJ_HELPER::AssociateFileWithProj(), fmt_mask(), PCB_PLUGIN::format(), FormatProbeItem(), GenCADLayerName(), GenCADLayerNameFlipped(), PCB_PARSER::init(), GENDRILL_WRITER_BASE::layerName(), PCB_EDIT_FRAME::OpenProjectFiles(), ReplaceIllegalFileNameChars(), SCH_EDIT_FRAME::SendCrossProbeNetName(), PCB_EDIT_FRAME::SendCrossProbeNetName(), and SCH_EDIT_FRAME::SetCrossProbeConnection().