memstream.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __IO_MEMSTREAM_H__
00022 #define __IO_MEMSTREAM_H__
00023
00024
00025 #include "io/stream.h"
00026
00027 namespace OpenRaw {
00028 namespace IO {
00029
00030 class MemStream
00031 : public Stream
00032 {
00033 public:
00034 MemStream(void *ptr, size_t s);
00035
00036 virtual ~MemStream()
00037 {}
00038
00039 virtual or_error open();
00040 virtual int close();
00041 virtual int seek(off_t offset, int whence);
00042 virtual int read(void *buf, size_t count);
00043 virtual off_t filesize();
00044
00045
00046 private:
00047 void * m_ptr;
00048 size_t m_size;
00049 unsigned char * m_current;
00050
00052 MemStream(const MemStream& f);
00054 MemStream & operator=(const MemStream&);
00055 };
00056
00057 }
00058 }
00059
00060 #endif
00061