From fc2f5b2cd655f1391f2abda1b39e37cdec98a951 Mon Sep 17 00:00:00 2001 From: Felix Domke Date: Fri, 17 Oct 2003 15:35:43 +0000 Subject: Initial revision --- lib/base/buffer.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 lib/base/buffer.h (limited to 'lib/base/buffer.h') diff --git a/lib/base/buffer.h b/lib/base/buffer.h new file mode 100644 index 00000000..9108ba8b --- /dev/null +++ b/lib/base/buffer.h @@ -0,0 +1,40 @@ +#ifndef __src_lib_base_buffer_h +#define __src_lib_base_buffer_h + +#include +#include + +/** + * IO buffer. + */ +class eIOBuffer +{ + int allocationsize; + struct eIOBufferData + { + __u8 *data; + int len; + }; + std::list buffer; + void removeblock(); + eIOBufferData &addblock(); + int ptr; +public: + eIOBuffer(int allocationsize): allocationsize(allocationsize), ptr(0) + { + } + ~eIOBuffer(); + int size() const; + int empty() const; + void clear(); + int peek(void *dest, int len) const; + void skip(int len); + int read(void *dest, int len); + void write(const void *source, int len); + int fromfile(int fd, int len); + int tofile(int fd, int len); + + int searchchr(char ch) const; +}; + +#endif -- cgit v1.2.3