OSVR-Core  0.6-1962-g59773924
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
osvr::util::CSVBase< Derived > Class Template Reference

#include <osvr/Util/CSV.h>

Inheritance diagram for osvr::util::CSVBase< Derived >:
osvr::util::detail::CSVCommonBase

Public Member Functions

RowProxy row ()
 
std::size_t numDataRows () const
 
std::size_t numRows () const
 

Protected Member Functions

void prepareForRow ()
 Called by CSVRowProxy life cycle, on row creation.
 
void dataForLatestRow (std::string const &heading, std::string const &data)
 Called by CSVRowProxy life cycle, on cell addition.
 
void finalizeLatestRow ()
 
DataRow & latestRow ()
 
void outputRow (std::ostream &os, DataRow const &row) const
 
void outputData (std::ostream &os) const
 Called by derived classes to output stored data rows.
 
void moveLatestRowToData ()
 utility function for use in derived finalizeLatestRow()
 

Detailed Description

template<typename Derived>
class osvr::util::CSVBase< Derived >

(Base) Class for easily outputting CSV files. Just call the .row() method and feed it << cell("header", yourdata) << cell("anotherheader", moredata); for as many rows as you want (one row call per row, of course).

Methods of outputting the CSV data to an ostream vary between subclasses. This is a "curiously-recurring template pattern" base class for compile-time polymorphism.

Definition at line 46 of file CSV.h.

Member Function Documentation

template<typename Derived>
RowProxy osvr::util::CSVBase< Derived >::row ( )
inline

Main call for the CSV object: returns a proxy object that you can redirect "cells" into, in order to add them to a new row in the CSV table.

Definition at line 255 of file CSV.h.

template<typename Derived>
std::size_t osvr::util::CSVBase< Derived >::numDataRows ( ) const
inline

Gets the number of rows in the internal data storage. Note that if the particular specialized CSV class you're using doesn't put all rows in the data storage (such as StreamCSV), this won't necessarily be equal to the number of rows that have been added.

Definition at line 261 of file CSV.h.

template<typename Derived>
std::size_t osvr::util::CSVBase< Derived >::numRows ( ) const
inline

Gets the total number of rows that have been streamed/added to this CSV object, whether or not they're in the internal data storage. That is, numRows() >= numDataRows()

Definition at line 266 of file CSV.h.

template<typename Derived>
void osvr::util::CSVBase< Derived >::finalizeLatestRow ( )
inlineprotected

Called by CSVRowProxy life cycle, on destruction of active row proxy. Delegates to derived classes, since this is a variance between them.

Definition at line 281 of file CSV.h.

template<typename Derived>
DataRow& osvr::util::CSVBase< Derived >::latestRow ( )
inlineprotected

Called internally and potentially by derived classes for access to the "latest row" temporary storage.

Definition at line 288 of file CSV.h.

template<typename Derived>
void osvr::util::CSVBase< Derived >::outputRow ( std::ostream &  os,
DataRow const &  row 
) const
inlineprotected

Called by outputData() and by derived classes to format individual rows.

Definition at line 292 of file CSV.h.


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