summaryrefslogtreecommitdiffstats
path: root/noatun-plugins/oblique/kbuffer.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/kbuffer.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/kbuffer.h')
-rw-r--r--noatun-plugins/oblique/kbuffer.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/noatun-plugins/oblique/kbuffer.h b/noatun-plugins/oblique/kbuffer.h
new file mode 100644
index 0000000..adc62ba
--- /dev/null
+++ b/noatun-plugins/oblique/kbuffer.h
@@ -0,0 +1,48 @@
+// Author: Eray Ozkural (exa) <erayo@cs.bilkent.edu.tr>, (c) 2002
+//
+// Copyright: GNU LGPL: http://www.gnu.org/licenses/lgpl.html
+
+#ifndef KBUFFER_H
+#define KBUFFER_H
+
+#include <qiodevice.h>
+#include <vector>
+#include <queue>
+
+/**A buffer device for flexible and efficient buffers.
+
+ *@author Eray Ozkural (exa)
+ */
+
+class KBuffer : public QIODevice {
+public:
+ KBuffer();
+ ~KBuffer();
+ /** open a memory buffer */
+ bool open(int mode);
+ /** read in a block of memory */
+ Q_LONG readBlock(char* data, long unsigned int maxLen);
+ /** query buffer size */
+ Q_ULONG size() const;
+ /** No descriptions */
+ void flush();
+ /** Close buffer */
+ void close();
+ /** write a block of memory */
+ Q_LONG writeBlock(const char *data, long unsigned int maxLen);
+ /** read a byte */
+ int getch();
+ /** undo last getch()
+ */
+ int ungetch(int);
+ /** write a byte */
+ int putch(int);
+ void* data() {
+ return &buf[0];
+ }
+private:
+ std::vector<char> buf;
+ std::vector<char>::iterator bufPos;
+};
+
+#endif