]> git.saurik.com Git - wxWidgets.git/blob - src/tiff/contrib/stream/tiffstream.h
osx new layout
[wxWidgets.git] / src / tiff / contrib / stream / tiffstream.h
1 // tiff stream interface class definition
2
3 #ifndef _TIFF_STREAM_H_
4 #define _TIFF_STREAM_H_
5
6 #include <iostream.h>
7
8 #include "tiffio.h"
9
10 class TiffStream {
11
12 public:
13 // ctor/dtor
14 TiffStream();
15 ~TiffStream();
16
17 public:
18 enum SeekDir {
19 beg,
20 cur,
21 end,
22 };
23
24 public:
25 // factory methods
26 TIFF* makeFileStream(iostream* str);
27 TIFF* makeFileStream(istream* str);
28 TIFF* makeFileStream(ostream* str);
29
30 public:
31 // tiff client methods
32 static tsize_t read(thandle_t fd, tdata_t buf, tsize_t size);
33 static tsize_t write(thandle_t fd, tdata_t buf, tsize_t size);
34 static toff_t seek(thandle_t fd, toff_t offset, int origin);
35 static toff_t size(thandle_t fd);
36 static int close(thandle_t fd);
37 static int map(thandle_t fd, tdata_t* phase, toff_t* psize);
38 static void unmap(thandle_t fd, tdata_t base, tsize_t size);
39
40 public:
41 // query method
42 TIFF* getTiffHandle() const { return m_tif; }
43 unsigned int getStreamLength() { return m_streamLength; }
44
45 private:
46 // internal methods
47 unsigned int getSize(thandle_t fd);
48 unsigned int tell(thandle_t fd);
49 bool seekInt(thandle_t fd, unsigned int offset, int origin);
50 bool isOpen(thandle_t fd);
51
52 private:
53 thandle_t m_this;
54 TIFF* m_tif;
55 static const char* m_name;
56 istream* m_inStream;
57 ostream* m_outStream;
58 iostream* m_ioStream;
59 int m_streamLength;
60
61 };
62
63 #endif // _TIFF_STREAM_H_