libopenraw
ifdfile.h
1 /*
2  * libopenraw - ifdfile.h
3  *
4  * Copyright (C) 2006-2008 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 
21 
22 
23 #ifndef _IFD_FILE_H_
24 #define _IFD_FILE_H_
25 
26 #include <vector>
27 #include <libopenraw/types.h>
28 #include <libopenraw/consts.h>
29 #include <libopenraw++/rawfile.h>
30 
31 #include "ifddir.h"
32 
33 namespace OpenRaw {
34  namespace IO {
35  class Stream;
36  class File;
37  }
38 
39  namespace Internals {
40  class IFFileContainer;
41 
43  struct IFDThumbDesc
44  {
45  IFDThumbDesc(uint32_t _x, uint32_t _y, ::or_data_type _type,
46  const IFDDir::Ref & _ifddir)
47  : x(_x), y(_y), type(_type), ifddir(_ifddir)
48  {
49  }
50  IFDThumbDesc()
51  : x(0), y(0), type(OR_DATA_TYPE_NONE), ifddir((IFDDir*)NULL)
52  {
53  }
54  uint32_t x;
55  uint32_t y;
56  ::or_data_type type;
57  IFDDir::Ref ifddir;
58  };
59 
60 
62  class IFDFile
63  : public OpenRaw::RawFile
64  {
65 
66  protected:
67  IFDFile(IO::Stream * s, Type _type,
68  bool instantiateContainer = true);
69  virtual ~IFDFile();
70 
76  virtual ::or_error _enumThumbnailSizes(std::vector<uint32_t> &list);
77 
83  virtual ::or_error _locateThumbnail(const IFDDir::Ref & dir,
84  std::vector<uint32_t> &list);
90  ::or_error _getRawDataFromDir(RawData & data, IFDDir::Ref & dir);
91 
92  typedef std::map<uint32_t, IFDThumbDesc> ThumbLocations;
93  ThumbLocations m_thumbLocations;
97  virtual IFDDir::Ref _locateCfaIfd() = 0;
98  virtual IFDDir::Ref _locateMainIfd() = 0;
99  virtual IFDDir::Ref _locateExifIfd();
100 
101  virtual void _identifyId();
102 
103  virtual MetaValue *_getMetaValue(int32_t meta_index);
104 
105  IFDDir::Ref m_cfaIfd;
106  IFDDir::Ref m_mainIfd;
110  IFDDir::Ref m_exifIfd;
111  private:
112 
113  IFDFile(const IFDFile&);
114  IFDFile & operator=(const IFDFile &);
115 
116  virtual ::or_error _getThumbnail(uint32_t size, Thumbnail & thumbnail);
117  };
118 
119  }
120 }
121 
122 
123 #endif