summaryrefslogtreecommitdiffstats
path: root/common/storage_common.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/storage_common.cpp')
-rw-r--r--common/storage_common.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/common/storage_common.cpp b/common/storage_common.cpp
index bdae9dd..ff2a2cd 100644
--- a/common/storage_common.cpp
+++ b/common/storage_common.cpp
@@ -25,6 +25,9 @@
25namespace Akonadi2 25namespace Akonadi2
26{ 26{
27 27
28static const char *s_internalPrefix = "__internal";
29static const int s_internalPrefixSize = strlen(s_internalPrefix);
30
28void errorHandler(const Storage::Error &error) 31void errorHandler(const Storage::Error &error)
29{ 32{
30 //TODO: allow this to be turned on / off globally 33 //TODO: allow this to be turned on / off globally
@@ -71,4 +74,23 @@ qint64 Storage::maxRevision()
71 return r; 74 return r;
72} 75}
73 76
77bool Storage::isInternalKey(const char *key)
78{
79 return key && strncmp(key, s_internalPrefix, s_internalPrefixSize) == 0;
80}
81
82bool Storage::isInternalKey(void *key, int size)
83{
84 if (size < 1) {
85 return false;
86 }
87
88 return key && strncmp(static_cast<char *>(key), s_internalPrefix, (size > s_internalPrefixSize ? s_internalPrefixSize : size)) == 0;
89}
90
91bool Storage::isInternalKey(const QByteArray &key)
92{
93 return key.startsWith(s_internalPrefix);
94}
95
74} // namespace Akonadi2 96} // namespace Akonadi2