KiCad PCB EDA Suite
numEval::FILE_OUTPUTFORMATTER Class Reference

Class FILE_OUTPUTFORMATTER may be used for text file output. More...

Inheritance diagram for numEval::FILE_OUTPUTFORMATTER:
numEval::OUTPUTFORMATTER

Public Member Functions

 FILE_OUTPUTFORMATTER (const wxString &aFileName, const wxChar *aMode=wxT("wt"), char aQuoteChar= '"' )
 Constructor. More...
 
 ~FILE_OUTPUTFORMATTER ()
 
virtual const char * GetQuoteChar (const char *wrapee)
 Function GetQuoteChar performs quote character need determination. More...
 
int PRINTF_FUNC Print (int nestLevel, const char *fmt,...)
 Function Print formats and writes text to the output stream. More...
 
virtual std::string Quotes (const std::string &aWrapee)
 Function Quotes checks aWrapee input string for a need to be quoted (e.g. More...
 
std::string Quotew (const wxString &aWrapee)
 

Protected Member Functions

void write (const char *aOutBuf, int aCount) override
 Function write 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)
 Function GetQuoteChar performs quote character need determination according to the Specctra DSN specification. More...
 

Protected Attributes

FILE * m_fp
 takes ownership More...
 
wxString m_filename
 

Detailed Description

Class FILE_OUTPUTFORMATTER may be used for text file output.

It is about 8 times faster than STREAM_OUTPUTFORMATTER for file streams.

Definition at line 492 of file numeric_evaluator.cpp.

Constructor & Destructor Documentation

numEval::FILE_OUTPUTFORMATTER::FILE_OUTPUTFORMATTER ( const wxString &  aFileName,
const wxChar *  aMode = wxT("wt"),
char  aQuoteChar = '"' 
)

Constructor.

Parameters
aFileNameis the full filename to open and save to as a text file.
aModeis what you would pass to wxFopen()'s mode, defaults to wxT( "wt" ) for text files that are to be created here and now.
aQuoteCharis a char used for quoting problematic strings (with whitespace or special characters in them).
Exceptions
IO_ERRORif the file cannot be opened.
numEval::FILE_OUTPUTFORMATTER::~FILE_OUTPUTFORMATTER ( )

Member Function Documentation

static const char* numEval::OUTPUTFORMATTER::GetQuoteChar ( const char *  wrapee,
const char *  quote_char 
)
staticprotectedinherited

Function GetQuoteChar performs quote character need determination according to the Specctra DSN specification.

Parameters
wrapeeA string that might need wrapping on each end.
quote_charA single character C string which provides the current quote character, should it be needed by the wrapee.
Returns
const char* - the quote_char as a single character string, or "" if the wrapee does not need to be wrapped.
virtual const char* numEval::OUTPUTFORMATTER::GetQuoteChar ( const char *  wrapee)
virtualinherited

Function GetQuoteChar performs 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.

Parameters
wrapeeA string that might need wrapping on each end.
Returns
const char* - the quote_char as a single character string, or "" if the wrapee does not need to be wrapped.
int PRINTF_FUNC numEval::OUTPUTFORMATTER::Print ( int  nestLevel,
const char *  fmt,
  ... 
)
inherited

Function Print formats and writes text to the output stream.

Parameters
nestLevelThe multiple of spaces to precede the output with.
fmtA printf() style format string.
...a variable list of parameters that will get blended into the output under control of the format string.
Returns
int - the number of characters output.
Exceptions
IO_ERROR,ifthere is a problem outputting, such as a full disk.
virtual std::string numEval::OUTPUTFORMATTER::Quotes ( const std::string &  aWrapee)
virtualinherited

Function Quotes checks 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.

Parameters
aWrapeeis a string that might need wraping in double quotes, and it might need to have its internal content escaped, or not.
Returns
std::string - whose c_str() function can be called for passing to printf() style functions that output UTF8 encoded s-expression streams.
Exceptions
IO_ERROR,ifthere is any kind of problem with the input string.
std::string numEval::OUTPUTFORMATTER::Quotew ( const wxString &  aWrapee)
inherited
void numEval::FILE_OUTPUTFORMATTER::write ( const char *  aOutBuf,
int  aCount 
)
overrideprotectedvirtual

Function write should be coded in the interface implementation (derived) classes.

Parameters
aOutBufis the start of a byte buffer to write.
aCounttells how many bytes to write.
Exceptions
IO_ERROR,ifthere is a problem outputting, such as a full disk.

Implements numEval::OUTPUTFORMATTER.

Member Data Documentation

wxString numEval::FILE_OUTPUTFORMATTER::m_filename
protected

Definition at line 517 of file numeric_evaluator.cpp.

FILE* numEval::FILE_OUTPUTFORMATTER::m_fp
protected

takes ownership

Definition at line 516 of file numeric_evaluator.cpp.


The documentation for this class was generated from the following file: