KiCad PCB EDA Suite
|
An interface used to output 8 bit text in a convenient way. More...
#include <richio.h>
Public Member Functions | |
int PRINTF_FUNC | Print (int nestLevel, const char *fmt,...) |
Format and write text to the output stream. More... | |
virtual const char * | GetQuoteChar (const char *wrapee) const |
Perform quote character need determination. More... | |
virtual std::string | Quotes (const std::string &aWrapee) const |
Check aWrapee input string for a need to be quoted (e.g. More... | |
std::string | Quotew (const wxString &aWrapee) const |
Protected Member Functions | |
OUTPUTFORMATTER (int aReserve=OUTPUTFMTBUFZ, char aQuoteChar='"' ) | |
virtual | ~OUTPUTFORMATTER () |
virtual void | write (const char *aOutBuf, int aCount)=0 |
Should be coded in the interface implementation (derived) classes. More... | |
Static Protected Member Functions | |
static const char * | GetQuoteChar (const char *wrapee, const char *quote_char) |
Perform quote character need determination according to the Specctra DSN specification. More... | |
Private Member Functions | |
int | sprint (const char *fmt,...) |
int | vprint (const char *fmt, va_list ap) |
Private Attributes | |
std::vector< char > | m_buffer |
char | quoteChar [2] |
An interface used to output 8 bit text in a convenient way.
The primary interface is "printf() - like" but with support for indentation control. The destination of the 8 bit wide text is up to the implementer.
The implementer only has to implement the write() function, but can also optionally re-implement GetQuoteChar().
If you want to output a wxString, then use TO_UTF8() on it before passing it as an argument to Print().
Since this is an abstract interface, only classes derived from this one may actually be used.
|
inlineprotected |
|
inlineprotectedvirtual |
|
virtual |
Perform quote character need determination.
It returns the quote character as a single character string for a given input wrapee string. If the wrappee does not need to be quoted, the return value is "" (the null string), such as when there are no delimiters in the input wrapee string. If you want the quote_char to be assuredly not "", then pass in "(" as the wrappee.
Implementations are free to override the default behavior, which is to call the static function of the same name.
wrapee | A string that might need wrapping on each end. |
Definition at line 389 of file richio.cpp.
References GetQuoteChar(), and quoteChar.
|
staticprotected |
Perform quote character need determination according to the Specctra DSN specification.
wrapee | A string that might need wrapping on each end. |
quote_char | A single character C string which provides the current quote character, should it be needed by the wrapee. |
Definition at line 355 of file richio.cpp.
Referenced by DSN::PROPERTY::Format(), DSN::RECTANGLE::Format(), DSN::LAYER_RULE::Format(), DSN::PATH::Format(), DSN::CIRCLE::Format(), DSN::QARC::Format(), DSN::KEEPOUT::Format(), DSN::VIA::Format(), DSN::LAYER::Format(), DSN::SPECCTRA_LAYER_PAIR::Format(), DSN::STRINGPROP::Format(), DSN::PLACE::Format(), DSN::COMPONENT::Format(), DSN::PIN::Format(), DSN::IMAGE::Format(), DSN::PADSTACK::Format(), DSN::FROMTO::Format(), DSN::COMP_ORDER::Format(), DSN::NET::Format(), DSN::CLASS::Format(), DSN::WIRE::Format(), DSN::WIRE_VIA::Format(), DSN::PCB::Format(), DSN::ANCESTOR::Format(), DSN::SUPPLY_PIN::Format(), DSN::NET_OUT::Format(), DSN::SESSION::Format(), DSN::PARSER::FormatContents(), DSN::CLASSES::FormatContents(), DSN::REGION::FormatContents(), DSN::PADSTACK::FormatContents(), DSN::HISTORY::FormatContents(), DSN::PIN_REF::FormatIt(), and GetQuoteChar().
int OUTPUTFORMATTER::Print | ( | int | nestLevel, |
const char * | fmt, | ||
... | |||
) |
Format and write text to the output stream.
nestLevel | The multiple of spaces to precede the output with. |
fmt | A printf() style format string. |
... | a variable list of parameters that will get blended into the output under control of the format string. |
IO_ERROR,if | there is a problem outputting, such as a full disk. |
Definition at line 433 of file richio.cpp.
References NESTWIDTH, sprint(), and vprint().
Referenced by PANEL_SYM_LIB_TABLE::convertLibrary(), PCB_PLUGIN::format(), NETLIST::Format(), DS_DATA_MODEL_IO::format(), DS_DATA_MODEL_IO::Format(), PCB_CALCULATOR_DATAFILE::Format(), PCB_PLOT_PARAMS::Format(), EDA_TEXT::Format(), PAGE_INFO::Format(), TITLE_BLOCK::Format(), COMPONENT_NET::Format(), COMPONENT::Format(), SYMBOL_LIB_TABLE::Format(), FP_LIB_TABLE::Format(), STROKE_PARAMS::Format(), XNODE::Format(), DSN::ELEM::Format(), LIB_TABLE_ROW::Format(), TEMPLATE_FIELDNAME::Format(), DSN::POINT::Format(), DSN::PROPERTY::Format(), DSN::UNIT_RES::Format(), DSN::RECTANGLE::Format(), DSN::RULE::Format(), DSN::LAYER_RULE::Format(), DSN::PATH::Format(), DSN::BOUNDARY::Format(), DSN::CIRCLE::Format(), DSN::QARC::Format(), DSN::WINDOW::Format(), DSN::KEEPOUT::Format(), DSN::VIA::Format(), DSN::CONTROL::Format(), DSN::LAYER::Format(), DSN::SPECCTRA_LAYER_PAIR::Format(), DSN::LAYER_NOISE_WEIGHT::Format(), DSN::TOKPROP::Format(), DSN::STRINGPROP::Format(), DSN::GRID::Format(), DSN::PLACE::Format(), DSN::COMPONENT::Format(), DSN::SHAPE::Format(), DSN::PIN::Format(), DSN::IMAGE::Format(), DSN::PADSTACK::Format(), DSN::FROMTO::Format(), DSN::COMP_ORDER::Format(), DSN::NET::Format(), DSN::CLASS::Format(), DSN::WIRE::Format(), DSN::WIRE_VIA::Format(), DSN::PCB::Format(), DSN::ANCESTOR::Format(), DSN::SUPPLY_PIN::Format(), DSN::NET_OUT::Format(), DSN::SESSION::Format(), TEMPLATES::Format(), SCH_SEXPR_PLUGIN::Format(), SCH_LEGACY_PLUGIN::Format(), formatArc(), formatBezier(), PCB_PLUGIN::formatBoardLayers(), BOARD_STACKUP::FormatBoardStackup(), formatCircle(), XNODE::FormatContents(), DSN::PARSER::FormatContents(), DSN::CLASSES::FormatContents(), DSN::REGION::FormatContents(), DSN::PLACEMENT::FormatContents(), DSN::IMAGE::FormatContents(), DSN::PADSTACK::FormatContents(), DSN::HISTORY::FormatContents(), DSN::ROUTE::FormatContents(), DSN::WAS_IS::FormatContents(), DS_DATA_MODEL_IO::formatCoordinate(), formatFill(), PCB_PLUGIN::formatGeneral(), DSN::PIN_REF::FormatIt(), PCB_PLUGIN::formatLayer(), PCB_PLUGIN::formatLayers(), PCB_PLUGIN::formatNetInformation(), formatNode(), DS_DATA_MODEL_IO::formatOptions(), formatPoly(), PCB_PLUGIN::formatPolyPts(), PCB_PLUGIN::formatProperties(), formatRect(), PCB_PLUGIN::formatRenderCache(), DS_DATA_MODEL_IO::formatRepeatParameters(), PCB_PLUGIN::formatSetup(), GENDRILL_WRITER_BASE::GenDrillReportFile(), GENDRILL_WRITER_BASE::printToolSummary(), CLIPBOARD_IO::Save(), PCB_PLUGIN::Save(), SCH_LEGACY_PLUGIN_CACHE::saveArc(), SCH_LEGACY_PLUGIN_CACHE::saveBezier(), SCH_LEGACY_PLUGIN::saveBitmap(), SCH_SEXPR_PLUGIN::saveBitmap(), SCH_LEGACY_PLUGIN::saveBusAlias(), SCH_SEXPR_PLUGIN::saveBusAlias(), SCH_LEGACY_PLUGIN::saveBusEntry(), SCH_SEXPR_PLUGIN::saveBusEntry(), SCH_LEGACY_PLUGIN_CACHE::saveCircle(), SCH_LEGACY_PLUGIN_CACHE::saveDocFile(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_SEXPR_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN::saveField(), SCH_SEXPR_PLUGIN::saveField(), SCH_SEXPR_PLUGIN::saveInstances(), SCH_LEGACY_PLUGIN::saveJunction(), SCH_SEXPR_PLUGIN::saveJunction(), SCH_LEGACY_PLUGIN::saveLine(), SCH_SEXPR_PLUGIN::saveLine(), SCH_LEGACY_PLUGIN::saveNoConnect(), SCH_SEXPR_PLUGIN::saveNoConnect(), SCH_LEGACY_PLUGIN_CACHE::savePin(), SCH_SEXPR_PLUGIN_CACHE::savePin(), SCH_LEGACY_PLUGIN_CACHE::savePolyLine(), SCH_LEGACY_PLUGIN_CACHE::saveRectangle(), CLIPBOARD_IO::SaveSelection(), SCH_LEGACY_PLUGIN::saveSheet(), SCH_SEXPR_PLUGIN::saveSheet(), SCH_SEXPR_PLUGIN_CACHE::SaveSymbol(), SCH_LEGACY_PLUGIN_CACHE::SaveSymbol(), SCH_LEGACY_PLUGIN::saveSymbol(), SCH_SEXPR_PLUGIN::saveSymbol(), SCH_LEGACY_PLUGIN_CACHE::saveText(), SCH_SEXPR_PLUGIN_CACHE::saveText(), SCH_LEGACY_PLUGIN::saveText(), SCH_SEXPR_PLUGIN::saveText(), SCH_SEXPR_PLUGIN_CACHE::saveTextBox(), SCH_SEXPR_PLUGIN::saveTextBox(), PANEL_REGULATOR::WriteDataFile(), NETLIST_EXPORTER_SPICE::WriteDirectives(), NGSPICE_CIRCUIT_MODEL::WriteDirectives(), NETLIST_EXPORTER_SPICE::WriteHead(), NETLIST_EXPORTER_SPICE_MODEL::WriteHead(), PCB_CALCULATOR_DATAFILE::WriteHeader(), NETLIST_EXPORTER_SPICE::writeInclude(), NETLIST_EXPORTER_SPICE::writeItems(), NETLIST_EXPORTER_SPICE::writeModels(), NETLIST_EXPORTER_SPICE::WriteTail(), and NETLIST_EXPORTER_SPICE_MODEL::WriteTail().
|
virtual |
Check aWrapee input string for a need to be quoted (e.g.
contains a ')' character or a space), and for " double quotes within the string that need to be escaped such that the DSNLEXER will correctly parse the string from a file later.
aWrapee | is a string that might need wrapping in double quotes, and it might need to have its internal content escaped, or not. |
IO_ERROR,if | there is any kind of problem with the input string. |
Definition at line 462 of file richio.cpp.
Referenced by PCB_PLUGIN::format(), formatNode(), Quotew(), and SCH_SEXPR_PLUGIN_CACHE::SaveSymbol().
std::string OUTPUTFORMATTER::Quotew | ( | const wxString & | aWrapee | ) | const |
Definition at line 501 of file richio.cpp.
References Quotes().
Referenced by PCB_PLUGIN::format(), DS_DATA_MODEL_IO::format(), PCB_CALCULATOR_DATAFILE::Format(), EDA_TEXT::Format(), PAGE_INFO::Format(), TITLE_BLOCK::Format(), COMPONENT_NET::Format(), COMPONENT::Format(), LIB_TABLE_ROW::Format(), TEMPLATE_FIELDNAME::Format(), PCB_PLUGIN::formatBoardLayers(), BOARD_STACKUP::FormatBoardStackup(), XNODE::FormatContents(), PCB_PLUGIN::formatLayer(), PCB_PLUGIN::formatLayers(), PCB_PLUGIN::formatNetInformation(), PCB_PLUGIN::formatProperties(), PCB_PLUGIN::formatRenderCache(), SCH_SEXPR_PLUGIN::saveBusAlias(), SCH_SEXPR_PLUGIN_CACHE::saveField(), SCH_SEXPR_PLUGIN::saveField(), SCH_SEXPR_PLUGIN::saveInstances(), SCH_SEXPR_PLUGIN_CACHE::savePin(), SCH_SEXPR_PLUGIN::saveSheet(), SCH_SEXPR_PLUGIN_CACHE::SaveSymbol(), SCH_SEXPR_PLUGIN::saveSymbol(), SCH_SEXPR_PLUGIN_CACHE::saveText(), SCH_SEXPR_PLUGIN::saveText(), SCH_SEXPR_PLUGIN_CACHE::saveTextBox(), SCH_SEXPR_PLUGIN::saveTextBox(), and PCB_CALCULATOR_DATAFILE::WriteHeader().
|
private |
Definition at line 421 of file richio.cpp.
References vprint().
Referenced by Print().
|
private |
Definition at line 395 of file richio.cpp.
|
protectedpure virtual |
Should be coded in the interface implementation (derived) classes.
aOutBuf | is the start of a byte buffer to write. |
aCount | tells how many bytes to write. |
IO_ERROR,if | there is a problem outputting, such as a full disk. |
Implemented in STRING_FORMATTER, FILE_OUTPUTFORMATTER, and STREAM_OUTPUTFORMATTER.
Referenced by vprint().
|
private |
|
private |
Definition at line 401 of file richio.h.
Referenced by GetQuoteChar(), and OUTPUTFORMATTER().