00001 /* 00002 * libopenraw - ifdfilecontainer.h 00003 * 00004 * Copyright (C) 2005-2006 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 */ 00020 00029 #ifndef _IFDFILECONTAINER_H_ 00030 #define _IFDFILECONTAINER_H_ 00031 00032 #include <vector> 00033 00034 #include <libopenraw/consts.h> 00035 #include <libopenraw/types.h> 00036 00037 #include "rawcontainer.h" 00038 #include "ifddir.h" 00039 #include "ifdentry.h" 00040 00041 namespace OpenRaw { 00042 namespace Internals { 00043 00044 00045 class IFDFileContainer 00046 : public RawContainer 00047 { 00048 public: 00054 IFDFileContainer(IO::Stream *file, off_t offset); 00056 virtual ~IFDFileContainer(); 00057 00062 enum { 00063 IFD_NONE = -1, 00064 IFD_EXIF = -2, 00065 IFD_GPS = -3, 00066 IFD_INTEROP = -4 00067 }; 00068 00078 virtual EndianType isMagicHeader(const char *p, int len); 00079 00086 IFDDir::Ref setDirectory(int dir); 00092 int countDirectories(void); 00096 std::vector<IFDDir::Ref> & directories(); 00097 00103 int currentDirectory(); 00104 00109 size_t getDirectoryDataSize(); 00110 00111 00116 int lastError() const 00117 { 00118 return m_error; 00119 } 00120 00121 private: 00122 int m_error; 00123 00124 IFDDir::Ref m_current_dir; 00125 std::vector<IFDDir::Ref> m_dirs; 00126 00127 bool _locateDirs(); 00128 }; 00129 00130 } 00131 } 00132 00133 #endif