From c16b34c3612049d41edf18cb533dbfc3b9b427a2 Mon Sep 17 00:00:00 2001 From: Minijackson Date: Mon, 23 Jul 2018 10:37:56 +0200 Subject: Convert selection in Reduce filter in datastorequery --- common/storage/key.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ common/storage/key.h | 13 +++++++++++++ 2 files changed, 54 insertions(+) (limited to 'common/storage') diff --git a/common/storage/key.cpp b/common/storage/key.cpp index 4dacca2..cfeb016 100644 --- a/common/storage/key.cpp +++ b/common/storage/key.cpp @@ -79,6 +79,21 @@ Identifier Identifier::fromDisplayByteArray(const QByteArray &bytes) return Identifier(QUuid(bytes)); } +bool Identifier::isNull() const +{ + return uid.isNull(); +} + +bool Identifier::operator==(const Identifier &other) const +{ + return uid == other.uid; +} + +bool Identifier::operator!=(const Identifier &other) const +{ + return !(*this == other); +} + // Revision QByteArray Revision::toInternalByteArray() const @@ -113,6 +128,16 @@ qint64 Revision::toQint64() const return rev; } +bool Revision::operator==(const Revision &other) const +{ + return rev == other.rev; +} + +bool Revision::operator!=(const Revision &other) const +{ + return !(*this == other); +} + // Key QByteArray Key::toInternalByteArray() const @@ -160,3 +185,19 @@ void Key::setRevision(const Revision &newRev) { rev = newRev; } + +bool Key::isNull() const +{ + return id.isNull(); +} + +bool Key::operator==(const Key &other) const +{ + return (id == other.id) && (rev == other.rev); +} + +bool Key::operator!=(const Key &other) const +{ + return !(*this == other); +} + diff --git a/common/storage/key.h b/common/storage/key.h index 151c333..a5b92bb 100644 --- a/common/storage/key.h +++ b/common/storage/key.h @@ -46,6 +46,11 @@ public: QByteArray toDisplayByteArray() const; static Identifier fromDisplayByteArray(const QByteArray &bytes); + bool isNull() const; + + bool operator==(const Identifier &other) const; + bool operator!=(const Identifier &other) const; + private: explicit Identifier(const QUuid &uid) : uid(uid) {} QUuid uid; @@ -67,6 +72,9 @@ public: static Revision fromDisplayByteArray(const QByteArray &bytes); qint64 toQint64() const; + bool operator==(const Revision &other) const; + bool operator!=(const Revision &other) const; + private: qint64 rev; }; @@ -89,6 +97,11 @@ public: const Revision &revision() const; void setRevision(const Revision &newRev); + bool isNull() const; + + bool operator==(const Key &other) const; + bool operator!=(const Key &other) const; + private: Identifier id; Revision rev; -- cgit v1.2.3