libopenraw
file.h
1 /*
2  * libopenraw - file.h
3  *
4  * Copyright (C) 2006 Hubert Figuière
5  *
6  * This library is free software: you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public License
8  * as published by the Free Software Foundation, either version 3 of
9  * the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library. If not, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
21 
22 
23 #ifndef __IO_FILE_H__
24 #define __IO_FILE_H__
25 
26 #include <sys/types.h>
27 #include <unistd.h>
28 
29 #include <libopenraw/libopenraw.h>
30 
31 #include "stream.h"
32 
33 
34 namespace OpenRaw {
35  namespace IO {
36 
37 
39  class File
40  : public Stream
41  {
42  public:
46  File(const char *filename);
47  virtual ~File();
48 
49 // file APIs
51  virtual Error open();
53  virtual int close();
55  virtual int seek(off_t offset, int whence);
57  virtual int read(void *buf, size_t count);
58  virtual off_t filesize();
59 // virtual void *mmap(size_t l, off_t offset);
60 // virtual int munmap(void *addr, size_t l);
61 
62  private:
64  File(const File& f);
66  File & operator=(const File&);
67 
69  ::io_methods *m_methods;
71  ::IOFileRef m_ioRef;
72  };
73 
74 
75  }
76 }
77 
78 #endif