diff options
author | Minijackson <minijackson@riseup.net> | 2018-07-23 10:37:56 +0200 |
---|---|---|
committer | Minijackson <minijackson@riseup.net> | 2018-07-23 10:37:56 +0200 |
commit | c16b34c3612049d41edf18cb533dbfc3b9b427a2 (patch) | |
tree | 3875acde6d7b43f71cc220782d0be4117da2e448 /common/storage | |
parent | dad0fc3726c49f6c964480fb6115a35277af29b9 (diff) | |
download | sink-c16b34c3612049d41edf18cb533dbfc3b9b427a2.tar.gz sink-c16b34c3612049d41edf18cb533dbfc3b9b427a2.zip |
Convert selection in Reduce filter in datastorequerykey-for-datastorequery
Diffstat (limited to 'common/storage')
-rw-r--r-- | common/storage/key.cpp | 41 | ||||
-rw-r--r-- | common/storage/key.h | 13 |
2 files changed, 54 insertions, 0 deletions
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) | |||
79 | return Identifier(QUuid(bytes)); | 79 | return Identifier(QUuid(bytes)); |
80 | } | 80 | } |
81 | 81 | ||
82 | bool Identifier::isNull() const | ||
83 | { | ||
84 | return uid.isNull(); | ||
85 | } | ||
86 | |||
87 | bool Identifier::operator==(const Identifier &other) const | ||
88 | { | ||
89 | return uid == other.uid; | ||
90 | } | ||
91 | |||
92 | bool Identifier::operator!=(const Identifier &other) const | ||
93 | { | ||
94 | return !(*this == other); | ||
95 | } | ||
96 | |||
82 | // Revision | 97 | // Revision |
83 | 98 | ||
84 | QByteArray Revision::toInternalByteArray() const | 99 | QByteArray Revision::toInternalByteArray() const |
@@ -113,6 +128,16 @@ qint64 Revision::toQint64() const | |||
113 | return rev; | 128 | return rev; |
114 | } | 129 | } |
115 | 130 | ||
131 | bool Revision::operator==(const Revision &other) const | ||
132 | { | ||
133 | return rev == other.rev; | ||
134 | } | ||
135 | |||
136 | bool Revision::operator!=(const Revision &other) const | ||
137 | { | ||
138 | return !(*this == other); | ||
139 | } | ||
140 | |||
116 | // Key | 141 | // Key |
117 | 142 | ||
118 | QByteArray Key::toInternalByteArray() const | 143 | QByteArray Key::toInternalByteArray() const |
@@ -160,3 +185,19 @@ void Key::setRevision(const Revision &newRev) | |||
160 | { | 185 | { |
161 | rev = newRev; | 186 | rev = newRev; |
162 | } | 187 | } |
188 | |||
189 | bool Key::isNull() const | ||
190 | { | ||
191 | return id.isNull(); | ||
192 | } | ||
193 | |||
194 | bool Key::operator==(const Key &other) const | ||
195 | { | ||
196 | return (id == other.id) && (rev == other.rev); | ||
197 | } | ||
198 | |||
199 | bool Key::operator!=(const Key &other) const | ||
200 | { | ||
201 | return !(*this == other); | ||
202 | } | ||
203 | |||
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: | |||
46 | QByteArray toDisplayByteArray() const; | 46 | QByteArray toDisplayByteArray() const; |
47 | static Identifier fromDisplayByteArray(const QByteArray &bytes); | 47 | static Identifier fromDisplayByteArray(const QByteArray &bytes); |
48 | 48 | ||
49 | bool isNull() const; | ||
50 | |||
51 | bool operator==(const Identifier &other) const; | ||
52 | bool operator!=(const Identifier &other) const; | ||
53 | |||
49 | private: | 54 | private: |
50 | explicit Identifier(const QUuid &uid) : uid(uid) {} | 55 | explicit Identifier(const QUuid &uid) : uid(uid) {} |
51 | QUuid uid; | 56 | QUuid uid; |
@@ -67,6 +72,9 @@ public: | |||
67 | static Revision fromDisplayByteArray(const QByteArray &bytes); | 72 | static Revision fromDisplayByteArray(const QByteArray &bytes); |
68 | qint64 toQint64() const; | 73 | qint64 toQint64() const; |
69 | 74 | ||
75 | bool operator==(const Revision &other) const; | ||
76 | bool operator!=(const Revision &other) const; | ||
77 | |||
70 | private: | 78 | private: |
71 | qint64 rev; | 79 | qint64 rev; |
72 | }; | 80 | }; |
@@ -89,6 +97,11 @@ public: | |||
89 | const Revision &revision() const; | 97 | const Revision &revision() const; |
90 | void setRevision(const Revision &newRev); | 98 | void setRevision(const Revision &newRev); |
91 | 99 | ||
100 | bool isNull() const; | ||
101 | |||
102 | bool operator==(const Key &other) const; | ||
103 | bool operator!=(const Key &other) const; | ||
104 | |||
92 | private: | 105 | private: |
93 | Identifier id; | 106 | Identifier id; |
94 | Revision rev; | 107 | Revision rev; |