From ea3375490c76ae410a7d1202cc8ce7a5e6d5f602 Mon Sep 17 00:00:00 2001 From: Florian Geyer Date: Fri, 16 May 2014 12:30:47 +0200 Subject: [PATCH] Introduce interface for exporter. --- src/core/Exporter.h | 14 ++++++++++++++ src/core/ToDbExporter.cpp | 2 +- src/core/ToDbExporter.h | 6 ++++-- tests/TestExporter.cpp | 2 +- 4 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 src/core/Exporter.h diff --git a/src/core/Exporter.h b/src/core/Exporter.h new file mode 100644 index 000000000..dedb1c8a5 --- /dev/null +++ b/src/core/Exporter.h @@ -0,0 +1,14 @@ +#ifndef KEEPASSX_EXPORTER_H +#define KEEPASSX_EXPORTER_H + +class Database; +class Group; + +class Exporter +{ +public: + virtual Database* exportGroup(Group* group) = 0; + virtual ~Exporter() {} +}; + +#endif // KEEPASSX_EXPORTER_H diff --git a/src/core/ToDbExporter.cpp b/src/core/ToDbExporter.cpp index 0601ca4b8..1f76fb744 100644 --- a/src/core/ToDbExporter.cpp +++ b/src/core/ToDbExporter.cpp @@ -21,7 +21,7 @@ #include "core/Group.h" #include "core/Metadata.h" -Database* ToDbExporter::exportToDb(Group* group) +Database* ToDbExporter::exportGroup(Group* group) { Database* oldDb = group->database(); Q_ASSERT(oldDb); diff --git a/src/core/ToDbExporter.h b/src/core/ToDbExporter.h index bd57a4b19..58c5efeb3 100644 --- a/src/core/ToDbExporter.h +++ b/src/core/ToDbExporter.h @@ -19,13 +19,15 @@ #ifndef KEEPASSX_TODBEXPORTER_H #define KEEPASSX_TODBEXPORTER_H +#include "core/Exporter.h" + class Database; class Group; -class ToDbExporter +class ToDbExporter : Exporter { public: - Database* exportToDb(Group* group); + Database* exportGroup(Group* group); }; #endif // KEEPASSX_TODBEXPORTER_H diff --git a/tests/TestExporter.cpp b/tests/TestExporter.cpp index 73bf407e9..16b4b23cb 100644 --- a/tests/TestExporter.cpp +++ b/tests/TestExporter.cpp @@ -57,7 +57,7 @@ void TestExporter::testToDbExporter() entryOrg->setIcon(Entry::DefaultIconNumber); entryOrg->endUpdate(); - Database* dbExp = ToDbExporter().exportToDb(groupOrg); + Database* dbExp = ToDbExporter().exportGroup(groupOrg); QCOMPARE(dbExp->rootGroup()->children().size(), 1); Group* groupExp = dbExp->rootGroup()->children().first();