GEOS
Public Member Functions | Static Public Attributes | List of all members
geos::TableCSVFormatter Class Referencefinal

class for CSV formatting More...

#include <TableFormatter.hpp>

Inheritance diagram for geos::TableCSVFormatter:
Inheritance graph
[legend]

Public Member Functions

 TableCSVFormatter ()
 Construct a default Table Formatter without layout specification (to only insert data in it, without any column / title). Feature is not tested.
 
 TableCSVFormatter (TableLayout const &tableLayout)
 Construct a new Table Formatter from a tableLayout. More...
 
 ~TableCSVFormatter ()
 Destroy the Table CSV Formatter object We launch GEOS_WARNING if we have encountered any errors.
 
string headerToString () const
 
string dataToString (TableData const &tableData) const
 Convert the table data to a CSV string.. More...
 
template<typename DATASOURCE >
string toString (DATASOURCE const &tableData) const
 Convert a data source to a CSV string. More...
 
void headerToStream (std::ostream &outputStream) const
 Output the formatted data to a stream. Adds appropriate messages to the error list when the operation fails. More...
 
void dataToStream (std::ostream &outputStream, TableData const &tableData) const
 Output the formatted data to a stream. Adds appropriate messages to the error list when the operation fails. More...
 
template<typename DATASOURCE >
void toStream (std::ostream &outputStream, DATASOURCE const &tableData) const
 Output the formatted data to a stream. Adds appropriate messages to the error list when the operation fails. More...
 
void showErrors (bool cond)
 Indicate if we print the encountered errors on destruction. Enabled by default. More...
 
template<>
string toString (TableData const &tableData) const
 Convert the TableData to a CSV string. More...
 
template<>
string toString (TableFunction const &tableData) const
 Template specialisation to convert a TableFunction to a table string. More...
 
- Public Member Functions inherited from geos::TableFormatter
TableErrorListinggetErrorsList () const
 

Static Public Attributes

static constexpr string_view m_separator = ","
 The column separator for the CSV output.
 

Additional Inherited Members

- Public Types inherited from geos::TableFormatter
using RowsCellInput = stdVector< stdVector< TableData::CellData > >
 Represent the TableData values.
 
using CellLayoutRows = stdVector< CellLayoutRow >
 Represent a table section (title + header or values) layout: view on the data and its layout settings.
 
- Protected Member Functions inherited from geos::TableFormatter
 TableFormatter ()
 Construct a default Table Formatter without layout specification (to only insert data in it, without any column / title). Feature is not tested.
 
 TableFormatter (TableLayout const &tableLayout)
 Construct a new Table Formatter from a tableLayout. More...
 
void toStreamImpl (std::ostream &outputStream, string_view content) const
 Implements the actual writing of content to an output stream. Adds appropriate messages to the error list when the operation fails. More...
 
- Protected Attributes inherited from geos::TableFormatter
PreparedTableLayout const m_tableLayout
 Layout for a table.
 
std::unique_ptr< geos::TableErrorListingm_errors = std::make_unique< geos::TableErrorListing >()
 Class used for listing all errors that may have occured during table generation.
 

Detailed Description

class for CSV formatting

Definition at line 91 of file TableFormatter.hpp.

Constructor & Destructor Documentation

◆ TableCSVFormatter()

geos::TableCSVFormatter::TableCSVFormatter ( TableLayout const &  tableLayout)

Construct a new Table Formatter from a tableLayout.

Parameters
tableLayoutContain all tableColumnData names and optionnaly the table title

Member Function Documentation

◆ dataToStream()

void geos::TableCSVFormatter::dataToStream ( std::ostream &  outputStream,
TableData const &  tableData 
) const
inline

Output the formatted data to a stream. Adds appropriate messages to the error list when the operation fails.

See also
toString( DATASOURCE const & tableData )
Parameters
tableDataThe table data
outputStreamThe stream to write the content to.

Definition at line 155 of file TableFormatter.hpp.

◆ dataToString()

string geos::TableCSVFormatter::dataToString ( TableData const &  tableData) const

Convert the table data to a CSV string..

Parameters
tableDataThe table data
Returns
The CSV string representation of the table data.

◆ headerToStream()

void geos::TableCSVFormatter::headerToStream ( std::ostream &  outputStream) const
inline

Output the formatted data to a stream. Adds appropriate messages to the error list when the operation fails.

See also
toString( DATASOURCE const & tableData )
Parameters
outputStreamThe stream to write the content to.

Definition at line 146 of file TableFormatter.hpp.

◆ headerToString()

string geos::TableCSVFormatter::headerToString ( ) const
Returns
The string with all tableColumnData names.

◆ showErrors()

void geos::TableCSVFormatter::showErrors ( bool  cond)
inline

Indicate if we print the encountered errors on destruction. Enabled by default.

Parameters
condThe boolean to turn on/off log errors

Definition at line 173 of file TableFormatter.hpp.

◆ toStream()

template<typename DATASOURCE >
void geos::TableCSVFormatter::toStream ( std::ostream &  outputStream,
DATASOURCE const &  tableData 
) const
inline

Output the formatted data to a stream. Adds appropriate messages to the error list when the operation fails.

See also
toString( DATASOURCE const & tableData )
Template Parameters
DATASOURCEThe source to convert
Parameters
tableDataThe data source to convert
outputStreamThe stream to write the content to.

Definition at line 166 of file TableFormatter.hpp.

◆ toString() [1/3]

template<typename DATASOURCE >
string geos::TableCSVFormatter::toString ( DATASOURCE const &  tableData) const

Convert a data source to a CSV string.

Template Parameters
DATASOURCEThe type of the source to convert
Parameters
tableDataThe data source to convert
Returns
The CSV string representation of a data source.

◆ toString() [2/3]

template<>
string geos::TableCSVFormatter::toString ( TableData const &  tableData) const

Convert the TableData to a CSV string.

Parameters
tableDataThe TableData to convert.
Returns
The CSV string representation of the TableData.

◆ toString() [3/3]

template<>
string geos::TableCSVFormatter::toString ( TableFunction const &  tableData) const

Template specialisation to convert a TableFunction to a table string.

Parameters
tableDataThe TableFunction object to convert.
Returns
The table string representation of the TableFunction.

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