|
WSF
|
#include <WsfCoverageTextOutputWriter.hpp>
Public Member Functions | |
| TextOutputWriter ()=default | |
| TextOutputWriter (const TextOutputWriter &aOther) | |
| virtual | ~TextOutputWriter ()=default |
| virtual TextOutputWriter * | Clone () const |
| virtual bool | OpenStream (const std::string &aFileName) |
Open the file stream to write to the given aFileName. | |
| virtual void | CloseStream () |
| Close the file stream. | |
| virtual std::ostream & | GetStream () |
| Return the underlying stream object. | |
| virtual bool | CreateContainingFolder (const std::string &aPath) const |
| bool | OpenFile (const std::string &aOutputDir, const std::string &aFileName) |
| int | GetPrecision () const |
| Get the field precision. | |
| int | GetWidth () const |
| Get the field width. | |
| bool | IsRightJustified () const |
| Return if output should be right justified. | |
| bool | IsFixedFormat () const |
| Return if output should be in fixed format. | |
| void | SetPrecision (int aPrecision) |
| Set the field precision. | |
| void | SetWidth (int aWidth) |
| Set the field width. | |
| void | SetRightJustified (bool aRightJustify) |
| void | SetFixedFormat (bool aFixedFormat) |
| template<typename T> | |
| void | WriteFieldWidth (const T &aValue, int aWidth, bool aEndLine=false) |
| template<typename T> | |
| void | WriteField (const T &aValue, bool aEndLine=false) |
| void | SetStreamJustify () |
| Set the configured justification on the stream. | |
| void | SetStreamFormat () |
| Set the configured format on the stream. | |
Static Public Attributes | |
| static constexpr int | cMIN_PRECISION {6} |
| static constexpr int | cDEFAULT_PRECISION {6} |
| static constexpr int | cMAX_PRECISION {20} |
| static constexpr int | cMIN_WIDTH {9} |
| static constexpr int | cDEFAULT_WIDTH {15} |
| static constexpr int | cMAX_WIDTH {23} |
Class defining the capability to write field formatted output into a stream.
The output produced by this class is designed around making readable CSV format. Clients can set the format, justification, precision, and width of the fields written by this object.
|
default |
References TextOutputWriter().
Referenced by Clone(), TextOutputWriter(), and TextOutputWriter().
| wsf::coverage::TextOutputWriter::TextOutputWriter | ( | const TextOutputWriter & | aOther | ) |
References TextOutputWriter().
|
virtualdefault |
|
inlinevirtual |
References TextOutputWriter().
|
virtual |
Close the file stream.
Referenced by wsf::coverage::OverlayOutput::Write(), wsf::coverage::RawDataOutput::Write(), and wsf::coverage::Grid::WriteGridDataFile().
|
virtual |
Create the path up to the containing folder.
This will ensure that all folders exist in the given aPath. This method returns true if the folder is successfully created, or if the folder already exists.
| aPath | - The folder whose existence is to be ensured. |
Referenced by wsf::coverage::OverlayOutput::Write(), wsf::coverage::RawDataOutput::Write(), and wsf::coverage::Grid::WriteGridDataFile().
|
inline |
Get the field precision.
|
inlinevirtual |
Return the underlying stream object.
Referenced by SetStreamFormat(), SetStreamJustify(), and WriteFieldWidth().
|
inline |
Get the field width.
|
inline |
Return if output should be in fixed format.
|
inline |
Return if output should be right justified.
| bool wsf::coverage::TextOutputWriter::OpenFile | ( | const std::string & | aOutputDir, |
| const std::string & | aFileName ) |
Template pattern method for opening the file stream.
This will open the file for writing with the given aFileName in the given aOutputDir. Subclasses are free to ignore the arguments.
Open the file.
This is a template pattern method that calls into the appropriate members of the interface in the correct order.
References OpenStream().
Referenced by wsf::coverage::OverlayOutput::Write(), and wsf::coverage::RawDataOutput::Write().
|
virtual |
Open the file stream to write to the given aFileName.
Referenced by OpenFile(), and wsf::coverage::Grid::WriteGridDataFile().
|
inline |
Set if output should be in fixed format.
| aFixedFormat | - true if data should be in fixed format; false for scientific notation format. |
Referenced by wsf::coverage::OverlayOutput::Write(), and wsf::coverage::RawDataOutput::Write().
|
inline |
Set the field precision.
Referenced by wsf::coverage::Grid::WriteGridDataFile().
|
inline |
Set if output is to be right justified.
| aRightJustify | - true if data should be right justified; false for left justification. |
Referenced by wsf::coverage::OverlayOutput::Write(), and wsf::coverage::RawDataOutput::Write().
| void wsf::coverage::TextOutputWriter::SetStreamFormat | ( | ) |
Set the configured format on the stream.
References GetStream().
Referenced by wsf::coverage::OverlayOutput::Write(), wsf::coverage::RawDataOutput::Write(), and wsf::coverage::Grid::WriteGridDataFile().
| void wsf::coverage::TextOutputWriter::SetStreamJustify | ( | ) |
Set the configured justification on the stream.
References GetStream().
Referenced by wsf::coverage::OverlayOutput::Write(), wsf::coverage::RawDataOutput::Write(), and wsf::coverage::Grid::WriteGridDataFile().
|
inline |
Set the field width.
Referenced by wsf::coverage::OverlayOutput::Write(), wsf::coverage::RawDataOutput::Write(), and wsf::coverage::Grid::WriteGridDataFile().
|
inline |
Write a value to the stream.
This will write the given value to the field, respecting the options set on this object. A comma is added after the field if aEndLine is false, otherwise a newline is appended.
| aValue | - The value to add to the stream. |
| aEndLine | - true if this is to be the last field on a line. |
References WriteFieldWidth().
Referenced by wsf::coverage::Grid::WriteGridDataFile().
|
inline |
Write a value to the stream, overriding the field width.
This will write the given value to the field, respecting the options set on this object, but overriding the field width with the given aWidth. A comma is added after the field if aEndLine is false, otherwise a newline is appended.
| aValue | - The value to add to the stream. |
| aWidth | - The width of the field to stream. |
| aEndLine | - true if this is to be the last field on a line. |
References GetStream().
Referenced by WriteField().
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
Referenced by wsf::coverage::MeasureTextOutput::ProcessInput().
|
staticconstexpr |
Referenced by wsf::coverage::MeasureTextOutput::ProcessInput().
|
staticconstexpr |
Referenced by wsf::coverage::MeasureTextOutput::ProcessInput().
|
staticconstexpr |
Referenced by wsf::coverage::MeasureTextOutput::ProcessInput().