libopenraw
tiffepfile.cpp
1 /*
2  * libopenraw - tiffepfile.cpp
3  *
4  * Copyright (C) 2007-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 #include <vector>
22 
23 #include "tiffepfile.h"
24 #include "ifdfilecontainer.h"
25 
26 namespace OpenRaw {
27 namespace Internals {
28 
29 TiffEpFile::TiffEpFile(IO::Stream * s, Type _type)
30  : IFDFile(s, _type)
31 {
32 }
33 
34 
35 IFDDir::Ref TiffEpFile::_locateCfaIfd()
36 {
37  if(!m_mainIfd) {
38  m_mainIfd = _locateMainIfd();
39  }
40 
41  std::vector<IFDDir::Ref> subdirs;
42  if (!m_mainIfd || !m_mainIfd->getSubIFDs(subdirs)) {
43  // error
44  return IFDDir::Ref();
45  }
46  IFDDir::RefVec::const_iterator i = find_if(subdirs.begin(),
47  subdirs.end(),
48  IFDDir::isPrimary());
49  if (i != subdirs.end()) {
50  return *i;
51  }
52  return IFDDir::Ref();
53 }
54 
55 IFDDir::Ref TiffEpFile::_locateMainIfd()
56 {
57  return m_container->setDirectory(0);
58 }
59 
61 ::or_error TiffEpFile::_getRawData(RawData & /*data*/, uint32_t /*options*/)
62 {
63  return OR_ERROR_NOT_FOUND;
64 }
65 
66 }
67 }
68 /*
69  Local Variables:
70  mode:c++
71  c-file-style:"stroustrup"
72  c-file-offsets:((innamespace . 0))
73  indent-tabs-mode:nil
74  fill-column:80
75  End:
76 */