![]() |
KiCad PCB EDA Suite
|
Implement an OUTPUTFORMATTER to a memory buffer. More...
#include <richio.h>
Public Member Functions | |
STRING_FORMATTER (int aReserve=OUTPUTFMTBUFZ, char aQuoteChar='"' ) | |
Reserve space in the buffer. More... | |
void | Clear () |
Clear the buffer and empties the internal string. More... | |
void | StripUseless () |
Removes whitespace, '(', and ')' from the string. More... | |
const std::string & | GetString () |
virtual const char * | GetQuoteChar (const char *wrapee) const |
Perform quote character need determination. More... | |
int PRINTF_FUNC | Print (int nestLevel, const char *fmt,...) |
Format and write text to the output stream. 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 | |
void | write (const char *aOutBuf, int aCount) override |
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 Attributes | |
std::string | m_mystring |
Implement an OUTPUTFORMATTER to a memory buffer.
After Print()ing the string is available through GetString()
|
inline |
Reserve space in the buffer.
Definition at line 420 of file richio.h.
|
inline |
Clear the buffer and empties the internal string.
Definition at line 428 of file richio.h.
References m_mystring.
Referenced by PCB_PLUGIN::GetStringOutput(), and DSN::ELEM::makeHash().
|
staticprotectedinherited |
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 348 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 OUTPUTFORMATTER::GetQuoteChar().
|
virtualinherited |
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 382 of file richio.cpp.
References OUTPUTFORMATTER::GetQuoteChar(), and OUTPUTFORMATTER::quoteChar.
|
inline |
Definition at line 438 of file richio.h.
References m_mystring.
Referenced by SYMBOL_EDITOR_EDIT_TOOL::Copy(), SYMBOL_EDIT_FRAME::CopySymbolToClipboard(), SCH_EDITOR_CONTROL::doCopy(), PCB_PLUGIN::GetStringOutput(), PCB_EDIT_FRAME::KiwayMailIn(), SCH_EDIT_FRAME::KiwayMailIn(), DSN::ELEM::makeHash(), CLIPBOARD_IO::Save(), CVPCB_MAINFRAME::SaveFootprintAssociation(), CLIPBOARD_IO::SaveSelection(), SCH_EDIT_FRAME::sendNetlistToCvpcb(), FOOTPRINT_ASYNC_LOADER::Start(), PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::TransferDataFromWindow(), and PANEL_SETUP_BOARD_STACKUP::TransferDataFromWindow().
|
inherited |
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 426 of file richio.cpp.
References NESTWIDTH, OUTPUTFORMATTER::sprint(), and OUTPUTFORMATTER::vprint().
Referenced by PANEL_SYM_LIB_TABLE::convertLibrary(), PCB_CALCULATOR_DATAFILE::Format(), PCB_PLOT_PARAMS::Format(), COMPONENT_NET::Format(), TEMPLATE_FIELDNAME::Format(), XNODE::Format(), FP_LIB_TABLE::Format(), SCH_SEXPR_PLUGIN::Format(), SCH_LEGACY_PLUGIN::Format(), SYMBOL_LIB_TABLE::Format(), NETLIST_EXPORTER_PSPICE::Format(), TEMPLATES::Format(), TITLE_BLOCK::Format(), COMPONENT::Format(), DSN::POINT::Format(), PAGE_INFO::Format(), DSN::PROPERTY::Format(), LIB_TABLE_ROW::Format(), DSN::ELEM::Format(), PCB_PLUGIN::format(), NETLIST::Format(), EDA_TEXT::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(), 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(), formatFill(), PCB_PLUGIN::formatGeneral(), DSN::PIN_REF::FormatIt(), PCB_PLUGIN::formatLayer(), PCB_PLUGIN::formatLayers(), PCB_PLUGIN::formatNetInformation(), formatNode(), formatPoly(), PCB_PLUGIN::formatProperties(), formatRect(), PCB_PLUGIN::formatSetup(), formatStroke(), 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_SEXPR_PLUGIN::saveBitmap(), SCH_LEGACY_PLUGIN::saveBitmap(), SCH_SEXPR_PLUGIN::saveBusAlias(), SCH_LEGACY_PLUGIN::saveBusAlias(), SCH_SEXPR_PLUGIN::saveBusEntry(), SCH_LEGACY_PLUGIN::saveBusEntry(), SCH_LEGACY_PLUGIN_CACHE::saveCircle(), SCH_LEGACY_PLUGIN_CACHE::saveDocFile(), SCH_SEXPR_PLUGIN::saveField(), SCH_LEGACY_PLUGIN::saveField(), SCH_SEXPR_PLUGIN_CACHE::saveField(), SCH_LEGACY_PLUGIN_CACHE::saveField(), SCH_SEXPR_PLUGIN::saveInstances(), SCH_SEXPR_PLUGIN::saveJunction(), SCH_LEGACY_PLUGIN::saveJunction(), SCH_SEXPR_PLUGIN::saveLine(), SCH_LEGACY_PLUGIN::saveLine(), SCH_SEXPR_PLUGIN::saveNoConnect(), SCH_LEGACY_PLUGIN::saveNoConnect(), SCH_SEXPR_PLUGIN_CACHE::savePin(), SCH_LEGACY_PLUGIN_CACHE::savePin(), SCH_LEGACY_PLUGIN_CACHE::savePolyLine(), SCH_LEGACY_PLUGIN_CACHE::saveRectangle(), CLIPBOARD_IO::SaveSelection(), SCH_SEXPR_PLUGIN::saveSheet(), SCH_LEGACY_PLUGIN::saveSheet(), SCH_SEXPR_PLUGIN::saveSymbol(), SCH_LEGACY_PLUGIN::saveSymbol(), SCH_SEXPR_PLUGIN_CACHE::SaveSymbol(), SCH_LEGACY_PLUGIN_CACHE::SaveSymbol(), SCH_SEXPR_PLUGIN::saveText(), SCH_LEGACY_PLUGIN::saveText(), SCH_SEXPR_PLUGIN_CACHE::saveText(), SCH_LEGACY_PLUGIN_CACHE::saveText(), PANEL_REGULATOR::WriteDataFile(), NETLIST_EXPORTER_PSPICE_SIM::writeDirectives(), NETLIST_EXPORTER_PSPICE::writeDirectives(), and PCB_CALCULATOR_DATAFILE::WriteHeader().
|
virtualinherited |
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 455 of file richio.cpp.
Referenced by PCB_PLUGIN::format(), formatNode(), OUTPUTFORMATTER::Quotew(), and SCH_SEXPR_PLUGIN_CACHE::SaveSymbol().
|
inherited |
Definition at line 494 of file richio.cpp.
References OUTPUTFORMATTER::Quotes().
Referenced by PCB_CALCULATOR_DATAFILE::Format(), COMPONENT_NET::Format(), TEMPLATE_FIELDNAME::Format(), TITLE_BLOCK::Format(), COMPONENT::Format(), PAGE_INFO::Format(), LIB_TABLE_ROW::Format(), PCB_PLUGIN::format(), PCB_PLUGIN::formatBoardLayers(), BOARD_STACKUP::FormatBoardStackup(), XNODE::FormatContents(), PCB_PLUGIN::formatLayer(), PCB_PLUGIN::formatLayers(), PCB_PLUGIN::formatNetInformation(), PCB_PLUGIN::formatProperties(), SCH_SEXPR_PLUGIN::saveBusAlias(), SCH_SEXPR_PLUGIN::saveField(), SCH_SEXPR_PLUGIN_CACHE::saveField(), SCH_SEXPR_PLUGIN::saveInstances(), SCH_SEXPR_PLUGIN_CACHE::savePin(), SCH_SEXPR_PLUGIN::saveSymbol(), SCH_SEXPR_PLUGIN_CACHE::SaveSymbol(), SCH_SEXPR_PLUGIN::saveText(), SCH_SEXPR_PLUGIN_CACHE::saveText(), and PCB_CALCULATOR_DATAFILE::WriteHeader().
void STRING_FORMATTER::StripUseless | ( | ) |
Removes whitespace, '(', and ')' from the string.
Definition at line 512 of file richio.cpp.
References copy, and m_mystring.
Referenced by DSN::ELEM::makeHash().
|
overrideprotectedvirtual |
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. |
Implements OUTPUTFORMATTER.
Definition at line 507 of file richio.cpp.
References m_mystring.
|
private |
Definition at line 447 of file richio.h.
Referenced by Clear(), GetString(), StripUseless(), and write().