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/Group.h"
|
||||||
#include "core/Metadata.h"
|
#include "core/Metadata.h"
|
||||||
|
|
||||||
Database* ToDbExporter::exportToDb(Group* group)
|
Database* ToDbExporter::exportGroup(Group* group)
|
||||||
{
|
{
|
||||||
Database* oldDb = group->database();
|
Database* oldDb = group->database();
|
||||||
Q_ASSERT(oldDb);
|
Q_ASSERT(oldDb);
|
||||||
|
@ -19,13 +19,15 @@
|
|||||||
#ifndef KEEPASSX_TODBEXPORTER_H
|
#ifndef KEEPASSX_TODBEXPORTER_H
|
||||||
#define KEEPASSX_TODBEXPORTER_H
|
#define KEEPASSX_TODBEXPORTER_H
|
||||||
|
|
||||||
|
#include "core/Exporter.h"
|
||||||
|
|
||||||
class Database;
|
class Database;
|
||||||
class Group;
|
class Group;
|
||||||
|
|
||||||
class ToDbExporter
|
class ToDbExporter : Exporter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Database* exportToDb(Group* group);
|
Database* exportGroup(Group* group);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KEEPASSX_TODBEXPORTER_H
|
#endif // KEEPASSX_TODBEXPORTER_H
|
||||||
|
@ -57,7 +57,7 @@ void TestExporter::testToDbExporter()
|
|||||||
entryOrg->setIcon(Entry::DefaultIconNumber);
|
entryOrg->setIcon(Entry::DefaultIconNumber);
|
||||||
entryOrg->endUpdate();
|
entryOrg->endUpdate();
|
||||||
|
|
||||||
Database* dbExp = ToDbExporter().exportToDb(groupOrg);
|
Database* dbExp = ToDbExporter().exportGroup(groupOrg);
|
||||||
|
|
||||||
QCOMPARE(dbExp->rootGroup()->children().size(), 1);
|
QCOMPARE(dbExp->rootGroup()->children().size(), 1);
|
||||||
Group* groupExp = dbExp->rootGroup()->children().first();
|
Group* groupExp = dbExp->rootGroup()->children().first();
|
||||||
|
Loading…
Reference in New Issue
Block a user