libopenraw
|
00001 /* 00002 * libopenraw - file.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 00023 #ifndef __IO_FILE_H__ 00024 #define __IO_FILE_H__ 00025 00026 #include <sys/types.h> 00027 #include <unistd.h> 00028 00029 #include <libopenraw/libopenraw.h> 00030 00031 #include "stream.h" 00032 00033 00034 namespace OpenRaw { 00035 namespace IO { 00036 00037 00039 class File 00040 : public Stream 00041 { 00042 public: 00046 File(const char *filename); 00047 virtual ~File(); 00048 00049 // file APIs 00051 virtual Error open(); 00053 virtual int close(); 00055 virtual int seek(off_t offset, int whence); 00057 virtual int read(void *buf, size_t count); 00058 virtual off_t filesize(); 00059 // virtual void *mmap(size_t l, off_t offset); 00060 // virtual int munmap(void *addr, size_t l); 00061 00062 private: 00064 File(const File& f); 00066 File & operator=(const File&); 00067 00069 ::io_methods *m_methods; 00071 ::IOFileRef m_ioRef; 00072 }; 00073 00074 00075 } 00076 } 00077 00078 #endif