summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2011-11-13 19:40:15 +0100
committerPixel <pixel@nobis-crew.org>2011-11-13 14:54:13 -0700
commitb3b38455482f2d15f07a33ecf00f9dea113e7968 (patch)
treed60d3b22a97dd4009a3e75f65621e72565cbf486 /includes
parente5619a3635dcec97afa2cddb0dc0344466324f6d (diff)
Adding buffered streams; mainly for string parsing.
Diffstat (limited to 'includes')
-rw-r--r--includes/BStream.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/includes/BStream.h b/includes/BStream.h
new file mode 100644
index 0000000..73b7a96
--- /dev/null
+++ b/includes/BStream.h
@@ -0,0 +1,27 @@
+#pragma once
+
+#include <Handle.h>
+
+namespace Balau {
+
+class BStream : public Handle {
+ public:
+ BStream(const IO<Handle> & h);
+ virtual void close() throw (GeneralException);
+ virtual bool isClosed();
+ virtual bool isEOF();
+ virtual bool canRead();
+ virtual const char * getName();
+ virtual ssize_t read(void * buf, size_t count) throw (GeneralException);
+ virtual off_t getSize();
+ int peekNextByte();
+ String readString(bool putNL = false);
+ private:
+ IO<Handle> m_h;
+ uint8_t * m_buffer;
+ size_t m_availBytes;
+ size_t m_cursor;
+ String m_name;
+};
+
+};