libopenraw
ifdfilecontainer.h
1 /*
2  * libopenraw - ifdfilecontainer.h
3  *
4  * Copyright (C) 2005-2006 Hubert Figuiere
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 
29 #ifndef _IFDFILECONTAINER_H_
30 #define _IFDFILECONTAINER_H_
31 
32 #include <vector>
33 
34 #include <libopenraw/consts.h>
35 #include <libopenraw/types.h>
36 
37 #include "rawcontainer.h"
38 #include "ifddir.h"
39 #include "ifdentry.h"
40 
41 namespace OpenRaw {
42  namespace Internals {
43 
44 
46  : public RawContainer
47  {
48  public:
54  IFDFileContainer(IO::Stream *file, off_t offset);
56  virtual ~IFDFileContainer();
57 
62  enum {
63  IFD_NONE = -1,
64  IFD_EXIF = -2,
65  IFD_GPS = -3,
67  };
68 
78  virtual EndianType isMagicHeader(const char *p, int len);
79 
86  IFDDir::Ref setDirectory(int dir);
92  int countDirectories(void);
96  std::vector<IFDDir::Ref> & directories();
97 
103  int currentDirectory();
104 
109  size_t getDirectoryDataSize();
110 
111 
116  int lastError() const
117  {
118  return m_error;
119  }
120 
121  int exifOffsetCorrection() const
122  {
123  return m_exif_offset_correction;
124  }
125  void setExifOffsetCorrection(int corr)
126  {
127  m_exif_offset_correction = corr;
128  }
129  protected:
131  virtual bool locateDirsPreHook();
132  private:
133  int m_error;
134  int m_exif_offset_correction;
135 
136  IFDDir::Ref m_current_dir;
137  std::vector<IFDDir::Ref> m_dirs;
138 
139  bool _locateDirs();
140  };
141 
142  }
143 }
144 
145 #endif