diff MemoryDbLink.hpp @ 0:a3834af36579

Working with memory backend.
author Tom Fredrik Blenning Klaussen <bfg@blenning.no>
date Mon, 20 Aug 2012 15:49:48 +0200
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MemoryDbLink.hpp	Mon Aug 20 15:49:48 2012 +0200
@@ -0,0 +1,25 @@
+#ifndef MEMORYDBLINK_HPP
+#define MEMORYDBLINK_HPP
+#include "FileDbLink.hpp"
+
+#include <QtCore/QMap>
+#include <QtCore/QSharedPointer>
+
+class MemoryDbLink : public FileDbLink {
+public:
+  virtual void addFile(const QString& path, qint64 size, const QDateTime& dtime, const QCryptographicHash& hash);
+  bool exists(const QString& path)
+  {
+    return (entries.contains(path));
+  }
+
+  QStringList toStringList();
+  const QList<QSharedPointer<DBInfo> > values() const;
+
+private:
+  void addFile(const DBInfo& info);
+  bool tryAddFile(const DBInfo& info);
+  QMap<QString, QSharedPointer<DBInfo> > entries;
+};
+
+#endif //MEMORYDBLINK_HPP