remwharead  0.7.1
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
remwharead::Export::ExportBase Class Referenceabstract

Base class for exports. More...

#include <remwharead/export/export.hpp>

Inheritance diagram for remwharead::Export::ExportBase:
remwharead::Export::AsciiDoc remwharead::Export::Bookmarks remwharead::Export::CSV remwharead::Export::Simple

Public Member Functions

 ExportBase (const list< Database::entry > &entries, ostream &out=cout)
 Export vector of Database::entry. More...
 
virtual void print () const =0
 Print output to std::ostream. More...
 

Protected Member Functions

const list< Database::entrysort_entries (list< Database::entry > entries) const
 Sort entries from newest to oldest. More...
 

Protected Attributes

const list< Database::entry_entries
 
ostream & _out
 

Detailed Description

Base class for exports.

Since
0.6.0

Constructor & Destructor Documentation

◆ ExportBase()

remwharead::Export::ExportBase::ExportBase ( const list< Database::entry > &  entries,
ostream &  out = cout 
)
explicit

Export vector of Database::entry.

Parameters
entriesVector of Database::entry to export.
outOutput stream.
25  : _entries(sort_entries(entries))
26  , _out(out)
27  {}
const list< Database::entry > sort_entries(list< Database::entry > entries) const
Sort entries from newest to oldest.
Definition: export.cpp:30

Member Function Documentation

◆ print()

virtual void remwharead::Export::ExportBase::print ( ) const
pure virtual

◆ sort_entries()

const list< Database::entry > remwharead::Export::ExportBase::sort_entries ( list< Database::entry entries) const
protected

Sort entries from newest to oldest.

Parameters
entriesVector of Database::entry to sort.
Returns
Sorted vector of Database::entry.
31  {
32  entries.sort([](const auto &a, const auto &b)
33  {
34  return (a.datetime > b.datetime);
35  });
36  return entries;
37  }

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