summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2011-11-12 21:52:02 +0100
committerPixel <pixel@nobis-crew.org>2011-11-12 21:52:02 +0100
commite6385cb74c35eb5a346237acecc846e52c4d6bd4 (patch)
treec3feffa44aea1a327f67a6298bf76f9d60cd41bc /includes
parenteb773a11ab557e01569b95254d7e21a53706640d (diff)
Adding seekable buffers. Probably would need a few more tests in the Handles unit test.
Diffstat (limited to 'includes')
-rw-r--r--includes/Buffer.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/includes/Buffer.h b/includes/Buffer.h
new file mode 100644
index 0000000..99a57f0
--- /dev/null
+++ b/includes/Buffer.h
@@ -0,0 +1,24 @@
+#pragma once
+
+#include <Handle.h>
+
+namespace Balau {
+
+class Buffer : public SeekableHandle {
+ public:
+ Buffer() throw (GeneralException) : m_buffer(NULL), m_bufSize(0), m_numBlocks(0) { }
+ virtual void close() throw (GeneralException);
+ virtual ssize_t read(void * buf, size_t count) throw (GeneralException);
+ virtual ssize_t write(const void * buf, size_t count) throw (GeneralException);
+ virtual bool isClosed();
+ virtual bool canRead();
+ virtual bool canWrite();
+ virtual const char * getName();
+ virtual off_t getSize();
+ void reset();
+ private:
+ uint8_t * m_buffer;
+ off_t m_bufSize, m_numBlocks;
+};
+
+};