diff options
author | Aaron Seigo <aseigo@kde.org> | 2014-12-06 00:57:35 +0100 |
---|---|---|
committer | Aaron Seigo <aseigo@kde.org> | 2014-12-06 00:57:35 +0100 |
commit | 0818f3de0fe44ad53358fafd57c6d7dea729d319 (patch) | |
tree | 6b613c86b05a166d9fbbe9abc40793a179a0549a /common/storage_common.cpp | |
parent | a9ae9ad67f6d030c1fc2ba9cd682fbec96ef8c44 (diff) | |
download | sink-0818f3de0fe44ad53358fafd57c6d7dea729d319.tar.gz sink-0818f3de0fe44ad53358fafd57c6d7dea729d319.zip |
place to put generic parts of the Storage class impl
Diffstat (limited to 'common/storage_common.cpp')
-rw-r--r-- | common/storage_common.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/common/storage_common.cpp b/common/storage_common.cpp new file mode 100644 index 0000000..bc1acc4 --- /dev/null +++ b/common/storage_common.cpp | |||
@@ -0,0 +1,21 @@ | |||
1 | #include "storage.h" | ||
2 | |||
3 | #include <iostream> | ||
4 | |||
5 | void errorHandler(const Storage::Error &error) | ||
6 | { | ||
7 | //TODO: allow this to be turned on / off globally | ||
8 | //TODO: log $SOMEWHERE $SOMEHOW rather than just spit to stderr | ||
9 | std::cerr << "Read error in " << error.store << ", code " << error.code << ", message: " << error.message << std::endl; | ||
10 | } | ||
11 | |||
12 | void Storage::read(const std::string &sKey, const std::function<bool(const std::string &value)> &resultHandler) | ||
13 | { | ||
14 | read(sKey, resultHandler, &errorHandler); | ||
15 | } | ||
16 | |||
17 | void Storage::read(const std::string &sKey, const std::function<bool(void *ptr, int size)> &resultHandler) | ||
18 | { | ||
19 | read(sKey, resultHandler, &errorHandler); | ||
20 | } | ||
21 | |||