diff options
author | Pixel <Pixel> | 2001-12-08 13:57:52 +0000 |
---|---|---|
committer | Pixel <Pixel> | 2001-12-08 13:57:52 +0000 |
commit | a83a43e57be59ed407d98f465d02953af5ae0160 (patch) | |
tree | 91aa1ea4a24e5b85ef26686828054e858cec21aa /lib/Buffer.cc | |
parent | c54dfe9b844f6c5d8969669f5144e721e2af82b0 (diff) |
*hum* some changes...
Diffstat (limited to 'lib/Buffer.cc')
-rw-r--r-- | lib/Buffer.cc | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/Buffer.cc b/lib/Buffer.cc index 2c2c955..e8335d9 100644 --- a/lib/Buffer.cc +++ b/lib/Buffer.cc @@ -3,7 +3,7 @@ #include "General.h" #include "config.h" -Buffer::Buffer() : Handle(-1), buffer(0), realsiz(0), bufsiz(0), ptr(0) { } +Buffer::Buffer() : Handle(-1), buffer(0), zero(0), realsiz(0), bufsiz(0), ptr(0) { } Buffer::~Buffer() { free(buffer); @@ -75,3 +75,23 @@ Buffer Buffer::operator=(const Buffer & b) { bool Buffer::CanWatch() { return false; } + +ssize_t Buffer::GetSize() { + return realsiz; +} + +char Buffer::operator[](size_t p) const { + if (p >= realsiz) { + return 0; + } else { + return buffer[ptr + p]; + } +} + +char & Buffer::operator[](size_t p) { + if (p >= realsiz) { + return zero; + } else { + return buffer[ptr + p]; + } +} |