libopenraw
|
00001 /* 00002 * libopenraw - streamclone.h 00003 * 00004 * Copyright (C) 2006 Hubert Figuière 00005 * 00006 * This library is free software: you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public License 00008 * as published by the Free Software Foundation, either version 3 of 00009 * the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library. If not, see 00018 * <http://www.gnu.org/licenses/>. 00019 */ 00020 00021 00022 #ifndef __IO_STREAMCLONE_H__ 00023 #define __IO_STREAMCLONE_H__ 00024 00025 #include <sys/types.h> 00026 #include <unistd.h> 00027 00028 #include "stream.h" 00029 00030 namespace OpenRaw { 00031 namespace IO { 00032 00035 class StreamClone 00036 : public Stream 00037 { 00038 public: 00039 StreamClone(Stream *clone, off_t offset); 00040 virtual ~StreamClone(); 00041 00042 virtual Error open(); 00043 virtual int close(); 00044 virtual int seek(off_t offset, int whence); 00045 virtual int read(void *buf, size_t count); 00046 virtual off_t filesize(); 00047 00048 00049 private: 00051 StreamClone(const StreamClone& f); 00053 StreamClone & operator=(const StreamClone&); 00054 00055 Stream *m_cloned; 00056 off_t m_offset; 00057 }; 00058 00059 } 00060 } 00061 00062 #endif