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

Base class for exports. More...

#include <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 vector< 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 vector< Database::entrysort_entries (vector< Database::entry > entries) const
 Sort entries from newest to oldest. More...
 

Protected Attributes

const vector< Database::entry_entries
 
ostream & _out
 

Detailed Description

Base class for exports.

Constructor & Destructor Documentation

◆ ExportBase()

remwharead::Export::ExportBase::ExportBase ( const vector< 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 vector< Database::entry > sort_entries(vector< 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 vector< Database::entry > remwharead::Export::ExportBase::sort_entries ( vector< 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  std::sort(entries.begin(), entries.end(),
33  [](const auto &a, const auto &b)
34  {
35  return (a.datetime > b.datetime);
36  });
37  return entries;
38  }

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