summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2011-11-19 23:50:49 -0800
committerPixel <pixel@nobis-crew.org>2011-11-19 23:50:49 -0800
commit071e7f07901309a38c8cb5311aaecaa46c0c3542 (patch)
treef1b85e8e2e57a928ee870f5d13870656599324cd /includes
parentb9e2cb295e8f53f0311d8e3b5b0edf69bb76ea78 (diff)
Having the ability to create buffers from const memory.
Diffstat (limited to 'includes')
-rw-r--r--includes/Buffer.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/includes/Buffer.h b/includes/Buffer.h
index 50dd47b..be86162 100644
--- a/includes/Buffer.h
+++ b/includes/Buffer.h
@@ -6,7 +6,9 @@ namespace Balau {
class Buffer : public SeekableHandle {
public:
- Buffer() throw (GeneralException) : m_buffer(NULL), m_bufSize(0), m_numBlocks(0) { }
+ Buffer(const uint8_t * buffer) : m_buffer(const_cast<uint8_t *>(buffer)), m_fromConst(true) { }
+ Buffer() throw (GeneralException) : m_buffer(NULL), m_fromConst(false), m_bufSize(0), m_numBlocks(0) { }
+ virtual ~Buffer();
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);
@@ -19,6 +21,7 @@ class Buffer : public SeekableHandle {
void reset();
private:
uint8_t * m_buffer;
+ bool m_fromConst;
off_t m_bufSize, m_numBlocks;
};