mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Introduce interface for exporter.
This commit is contained in:
parent
204cd8d971
commit
ea3375490c
14
src/core/Exporter.h
Normal file
14
src/core/Exporter.h
Normal 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
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user