remwharead/include/export/export.hpp

72 lines
2.0 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/>.
*/
#ifndef REMWHAREAD_EXPORT_EXPORT_HPP
#define REMWHAREAD_EXPORT_EXPORT_HPP
2019-05-16 03:56:17 +02:00
#include <list>
2019-05-16 03:56:17 +02:00
#include <iostream>
#include "sqlite.hpp"
2019-07-27 09:59:43 +02:00
namespace remwharead
{
2019-06-06 16:06:25 +02:00
namespace Export
{
using std::list;
using std::ostream;
using std::cout;
/*!
* @brief Base class for exports.
*
* @since 0.6.0
*
* @headerfile export.hpp remwharead/export/export.hpp
*/
2019-06-06 16:06:25 +02:00
class ExportBase
{
public:
2019-07-27 22:29:43 +02:00
/*!
* @brief Export list of Database::entry.
2019-07-27 22:29:43 +02:00
*
* @param entries List of Database::entry to export.
2019-07-28 02:14:06 +02:00
* @param out Output stream.
2019-07-27 22:29:43 +02:00
*/
explicit ExportBase(const list<Database::entry> &entries,
2019-06-06 16:06:25 +02:00
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 list<Database::entry> _entries;
2019-06-06 16:06:25 +02:00
ostream &_out;
2019-07-27 22:29:43 +02:00
/*!
2019-09-20 18:19:33 +02:00
* @brief Sort entries from newest to oldest and remove duplicates.
2019-07-27 22:29:43 +02:00
*
* @param entries List of Database::entry to sort.
2019-07-27 22:29:43 +02:00
*
* @return Sorted list of Database::entry.
2019-07-27 22:29:43 +02:00
*/
list<Database::entry> sort_entries(list<Database::entry> entries) const;
2019-06-06 16:06:25 +02:00
};
} // namespace Export
} // namespace remwharead
#endif // REMWHAREAD_EXPORT_EXPORT_HPP