Introduce interface for exporter.

This commit is contained in:
Florian Geyer 2014-05-16 12:30:47 +02:00
parent 204cd8d971
commit ea3375490c
4 changed files with 20 additions and 4 deletions

14
src/core/Exporter.h Normal file
View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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();