remwharead/include/export/export.hpp

68 lines
1.8 KiB
C++
Raw Normal View History

2019-05-16 03:56:17 +02:00
/* This file is part of remwharead.
* Copyright © 2019 tastytea <tastytea@tastytea.de>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
2019-05-16 08:37:50 +02:00
#ifndef REMWHAREAD_EXPORT_HPP
#define REMWHAREAD_EXPORT_HPP
2019-05-16 03:56:17 +02:00
#include <vector>
#include <iostream>
#include "sqlite.hpp"
using std::vector;
using std::ostream;
using std::cout;
2019-07-27 09:59:43 +02:00
namespace remwharead
{
2019-06-06 16:06:25 +02:00
namespace Export
{
2019-07-28 00:07:22 +02:00
//! Base class for exports.
2019-06-06 16:06:25 +02:00
class ExportBase
{
public:
2019-07-27 22:29:43 +02:00
/*!
2019-07-28 02:14:06 +02:00
* @brief Export vector of Database::entry.
2019-07-27 22:29:43 +02:00
*
2019-07-28 02:14:06 +02:00
* @param entries Vector of Database::entry to export.
* @param out Output stream.
2019-07-27 22:29:43 +02:00
*/
2019-06-06 16:06:25 +02:00
explicit ExportBase(const vector<Database::entry> &entries,
ostream &out = cout);
2019-07-27 22:29:43 +02:00
/*!
2019-07-28 02:14:06 +02:00
* @brief Print output to std::ostream.
2019-07-27 22:29:43 +02:00
*/
2019-06-06 17:11:56 +02:00
virtual void print() const = 0;
2019-06-06 16:06:25 +02:00
protected:
const vector<Database::entry> _entries;
2019-06-06 16:06:25 +02:00
ostream &_out;
2019-07-27 22:29:43 +02:00
/*!
2019-07-28 02:14:06 +02:00
* @brief Sort entries from newest to oldest.
2019-07-27 22:29:43 +02:00
*
2019-07-28 02:14:06 +02:00
* @param entries Vector of Database::entry to sort.
2019-07-27 22:29:43 +02:00
*
2019-07-28 02:14:06 +02:00
* @return Sorted vector of Database::entry.
2019-07-27 22:29:43 +02:00
*/
const vector<Database::entry>
sort_entries(vector<Database::entry> entries) const;
2019-06-06 16:06:25 +02:00
};
2019-06-06 17:11:56 +02:00
}
2019-07-27 09:59:43 +02:00
}
2019-05-16 08:37:50 +02:00
#endif // REMWHAREAD_EXPORT_HPP