summaryrefslogtreecommitdiff
path: root/includes/BStream.h
diff options
context:
space:
mode:
authorNicolas "Pixel" Noble <pixel@nobis-crew.org>2014-08-10 02:58:35 -0700
committerNicolas "Pixel" Noble <pixel@nobis-crew.org>2014-08-10 02:58:35 -0700
commitec0f82bb6ea911baee6b9654f799f037282bf5b9 (patch)
treef18dd08e58c9231de3353544191c1fa2dfdbcb2b /includes/BStream.h
parentbd06a6ec9ec3d0e10fe6e09bab4a156ceef6e0c8 (diff)
Introducing notion of filters.
Diffstat (limited to 'includes/BStream.h')
-rw-r--r--includes/BStream.h19
1 files changed, 5 insertions, 14 deletions
diff --git a/includes/BStream.h b/includes/BStream.h
index f39765d..0e7d5f6 100644
--- a/includes/BStream.h
+++ b/includes/BStream.h
@@ -4,31 +4,22 @@
namespace Balau {
-class BStream : public Handle {
+class BStream : public Filter {
public:
- BStream(const IO<Handle> & h);
- virtual void close() throw (GeneralException);
- virtual bool isClosed();
- virtual bool isEOF();
- virtual bool canRead();
- virtual bool canWrite() { return m_h->canWrite(); }
- virtual const char * getName();
+ BStream(IO<Handle> h);
+ virtual void close() throw (GeneralException) override;
+ virtual bool isEOF() override { return (m_availBytes == 0) && Filter::isEOF(); }
+ virtual const char * getName() override { return m_name.to_charp(); }
virtual ssize_t read(void * buf, size_t count) throw (GeneralException);
- virtual ssize_t write(const void * buf, size_t count) throw (GeneralException) { return m_h->write(buf, count); }
- virtual off64_t getSize();
int peekNextByte();
String readString(bool putNL = false);
bool isEmpty() { return m_availBytes == 0; }
- void detach() { m_detached = true; }
private:
- IO<Handle> m_h;
uint8_t * m_buffer = NULL;
size_t m_availBytes = 0;
size_t m_cursor = 0;
String m_name;
bool m_passThru = false;
- bool m_detached = false;
- bool m_closed = false;
};
};