tiffepfile.cpp

00001 /*
00002  * libopenraw - tiffepfile.cpp
00003  *
00004  * Copyright (C) 2007 Hubert Figuiere
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
00019  */
00020 
00021 #include <vector>
00022 
00023 #include "tiffepfile.h"
00024 #include "ifdfilecontainer.h"
00025 
00026 namespace OpenRaw {
00027     namespace Internals {
00028 
00029         TiffEpFile::TiffEpFile(const char* _filename, Type _type)
00030             : IFDFile(_filename, _type)
00031         {
00032         }
00033 
00034 
00035         IFDDir::Ref  TiffEpFile::_locateCfaIfd()
00036         {
00037             if(!m_mainIfd) {
00038                 m_mainIfd = _locateMainIfd();
00039             }
00040 
00041             std::vector<IFDDir::Ref> subdirs;
00042             if (!m_mainIfd || !m_mainIfd->getSubIFDs(subdirs)) {
00043                 // error
00044                 return IFDDir::Ref();
00045             }
00046             IFDDir::RefVec::const_iterator i = find_if(subdirs.begin(), 
00047                                                        subdirs.end(),
00048                                                        IFDDir::isPrimary());
00049             if (i != subdirs.end()) {
00050                 return *i;
00051             }
00052             return IFDDir::Ref();
00053         }
00054 
00055         IFDDir::Ref  TiffEpFile::_locateMainIfd()
00056         {
00057             return m_container->setDirectory(0);
00058         }
00059 
00060     }
00061 }

Generated on Sun Mar 23 09:30:49 2008 for libopenraw by  doxygen 1.5.5