summaryrefslogtreecommitdiffstats
path: root/noatun-plugins/oblique/kdbt.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit84da08d7b7fcda12c85caeb5a10b4903770a6f69 (patch)
tree2a6aea76f2dfffb4cc04bb907c4725af94f70e72 /noatun-plugins/oblique/kdbt.h
downloadtdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.tar.gz
tdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaddons@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'noatun-plugins/oblique/kdbt.h')
-rw-r--r--noatun-plugins/oblique/kdbt.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/noatun-plugins/oblique/kdbt.h b/noatun-plugins/oblique/kdbt.h
new file mode 100644
index 0000000..acaae57
--- /dev/null
+++ b/noatun-plugins/oblique/kdbt.h
@@ -0,0 +1,59 @@
+// Author: Eray Ozkural (exa) <[email protected]>, (c) 2002
+//
+// Copyright: GNU LGPL: http://www.gnu.org/licenses/lgpl.html
+
+
+#ifndef KDbt_Interface
+#define KDbt_Interface
+
+#include <db_cxx.h>
+#include <qdatastream.h>
+#include <qbuffer.h>
+#include "kbuffer.h"
+
+/**A generic wrapper for "database thang" class that abstracts binary streaming operations.
+ *@author Eray Ozkural (exa)
+ */
+
+template <typename T>
+class KDbt : public Dbt {
+public:
+ /* assume streaming operators on QDataStream
+ QDataStream & operator>> ( QDataStream& >>, T &);
+ QDataStream & operator<< ( QDataStream& >>, T &);
+ */
+ KDbt() {
+ }
+ /** construct a Dbt from obj */
+ KDbt(const T& obj) {
+ set(obj);
+ }
+// operator Dbt() {
+// return Dbt(thang.data(), thang.size());
+// }
+ /** set "thang" to the contents of obj */
+ void set(const T& obj) {
+// KBuffer buffer(thang);
+ QDataStream ds(&thang);
+ ds << obj;
+// std::cerr << "thang size " << thang.size() << endl;
+// buffer.close();
+// set_data(thang.data());
+// set_size(buffer.size());
+ set_data(thang.data());
+ set_size(thang.size());
+ }
+ void get(T& obj) {
+ QByteArray buffer;
+ buffer.setRawData((char*)get_data(),get_size());
+ QDataStream ds(buffer,IO_ReadWrite);
+ ds >> obj;
+ buffer.resetRawData((char*)get_data(),get_size());
+ }
+private:
+ /** Internal data */
+// QByteArray thang;
+ KBuffer thang;
+};
+
+#endif