diff options
author | Aaron Seigo <aseigo@kde.org> | 2015-01-27 18:44:03 +0100 |
---|---|---|
committer | Aaron Seigo <aseigo@kde.org> | 2015-01-27 18:45:54 +0100 |
commit | 142bf3d8bc6569a432e065e851f026a46e9595ed (patch) | |
tree | 631d40828e2dcc63e0a12e5b9de1e8c0e3ebddf0 /common/messagequeue.cpp | |
parent | 7137cb09a1f7a4d36e9865d9c9e1f54d59ddbc68 (diff) | |
download | sink-142bf3d8bc6569a432e065e851f026a46e9595ed.tar.gz sink-142bf3d8bc6569a432e065e851f026a46e9595ed.zip |
introduce a set of isInternalKey functions to hide this impl detail
Diffstat (limited to 'common/messagequeue.cpp')
-rw-r--r-- | common/messagequeue.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/common/messagequeue.cpp b/common/messagequeue.cpp index 3754b16..76f8162 100644 --- a/common/messagequeue.cpp +++ b/common/messagequeue.cpp | |||
@@ -1,4 +1,5 @@ | |||
1 | #include "messagequeue.h" | 1 | #include "messagequeue.h" |
2 | #include "storage.h" | ||
2 | #include <QDebug> | 3 | #include <QDebug> |
3 | 4 | ||
4 | MessageQueue::MessageQueue(const QString &storageRoot, const QString &name) | 5 | MessageQueue::MessageQueue(const QString &storageRoot, const QString &name) |
@@ -24,7 +25,7 @@ void MessageQueue::dequeue(const std::function<void(void *ptr, int size, std::fu | |||
24 | bool readValue = false; | 25 | bool readValue = false; |
25 | mStorage.scan("", 0, [this, resultHandler, &readValue](void *keyPtr, int keySize, void *valuePtr, int valueSize) -> bool { | 26 | mStorage.scan("", 0, [this, resultHandler, &readValue](void *keyPtr, int keySize, void *valuePtr, int valueSize) -> bool { |
26 | const auto key = QByteArray::fromRawData(static_cast<char*>(keyPtr), keySize); | 27 | const auto key = QByteArray::fromRawData(static_cast<char*>(keyPtr), keySize); |
27 | if (key.startsWith("__internal")) { | 28 | if (Akonadi2::Storage::isInternalKey(key)) { |
28 | return true; | 29 | return true; |
29 | } | 30 | } |
30 | readValue = true; | 31 | readValue = true; |
@@ -55,7 +56,7 @@ bool MessageQueue::isEmpty() | |||
55 | int count = 0; | 56 | int count = 0; |
56 | mStorage.scan("", [&count](void *keyPtr, int keySize, void *valuePtr, int valueSize) -> bool { | 57 | mStorage.scan("", [&count](void *keyPtr, int keySize, void *valuePtr, int valueSize) -> bool { |
57 | const auto key = QByteArray::fromRawData(static_cast<char*>(keyPtr), keySize); | 58 | const auto key = QByteArray::fromRawData(static_cast<char*>(keyPtr), keySize); |
58 | if (!key.startsWith("__internal")) { | 59 | if (!Akonadi2::Storage::isInternalKey(key)) { |
59 | count++; | 60 | count++; |
60 | return false; | 61 | return false; |
61 | } | 62 | } |