// ***************************************************************** -*- C++ -*- /* * Copyright (C) 2006 Andreas Huggel * * This program is part of the Exiv2 distribution. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. */ /*! @file tiffparser.hpp @brief Class TiffParser to parse TIFF data. @version $Rev$ @author Andreas Huggel (ahu) ahuggel@gmx.net @date 15-Mar-06, ahu: created */ #ifndef TIFFPARSER_HPP_ #define TIFFPARSER_HPP_ // ***************************************************************************** // included header files #include "tiffcomposite.hpp" #include "types.hpp" // + standard includes #include #include // ***************************************************************************** // namespace extensions namespace Exiv2 { // ***************************************************************************** // class declarations class Image; // ***************************************************************************** // class definitions /*! @brief TIFF component factory for standard TIFF components. */ class TiffCreator { public: /*! @brief Create the TiffComponent for TIFF entry \em extendedTag and \em group based on the embedded lookup table. If a tag and group combination is not found in the table, a TiffEntry is created. If the pointer that is returned is 0, then the TIFF entry should be ignored. */ static TiffComponent::AutoPtr create(uint32_t extendedTag, uint16_t group); private: static const TiffStructure tiffStructure_[]; //(extendedTag_ & 0xffff); } // DATA const char* make_; //!< Camera make for which this decoder function applies uint32_t extendedTag_; //!< Tag (32 bit so that it can contain special tags) uint16_t group_; //!< Group that contains the tag DecoderFct decoderFct_; //!< Decoder function for matching tags }; // struct TiffDecoderInfo //! Search key for TIFF decoder structures. struct TiffDecoderInfo::Key { //! Constructor Key(const std::string& m, uint32_t e, uint16_t g) : m_(m), e_(e), g_(g) {} std::string m_; //!< Camera make uint32_t e_; //!< Extended tag uint16_t g_; //!< %Group }; /*! @brief Table of special TIFF decoding functions and find function. This class is separated from the metadata decoder visitor so that the parser can be parametrized with a different table if needed. This is used, eg., for CR2 format. */ class TiffDecoderItems { public: /*! @brief Find the decoder function for a key. If the returned pointer is 0, the tag should not be decoded, else the decoder function should be used. @param make Camera make @param extendedTag Extended tag @param group %Group @return Pointer to the decoder function */ static const DecoderFct findDecoder(const std::string& make, uint32_t extendedTag, uint16_t group); private: static const TiffDecoderInfo tiffDecoderInfo_[]; //