Blame src/tiffcomposite_int.hpp

Packit Service 21b5d1
// ***************************************************************** -*- C++ -*-
Packit Service 21b5d1
/*
Packit Service 21b5d1
 * Copyright (C) 2004-2018 Exiv2 authors
Packit Service 21b5d1
 * This program is part of the Exiv2 distribution.
Packit Service 21b5d1
 *
Packit Service 21b5d1
 * This program is free software; you can redistribute it and/or
Packit Service 21b5d1
 * modify it under the terms of the GNU General Public License
Packit Service 21b5d1
 * as published by the Free Software Foundation; either version 2
Packit Service 21b5d1
 * of the License, or (at your option) any later version.
Packit Service 21b5d1
 *
Packit Service 21b5d1
 * This program is distributed in the hope that it will be useful,
Packit Service 21b5d1
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 21b5d1
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Service 21b5d1
 * GNU General Public License for more details.
Packit Service 21b5d1
 *
Packit Service 21b5d1
 * You should have received a copy of the GNU General Public License
Packit Service 21b5d1
 * along with this program; if not, write to the Free Software
Packit Service 21b5d1
 * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
Packit Service 21b5d1
 */
Packit Service 21b5d1
/*!
Packit Service 21b5d1
  @file    tiffcomposite_int.hpp
Packit Service 21b5d1
  @brief   Internal classes used in a TIFF composite structure
Packit Service 21b5d1
  @author  Andreas Huggel (ahu)
Packit Service 21b5d1
           ahuggel@gmx.net
Packit Service 21b5d1
  @date    11-Apr-06, ahu: created
Packit Service 21b5d1
 */
Packit Service 21b5d1
#ifndef TIFFCOMPOSITE_INT_HPP_
Packit Service 21b5d1
#define TIFFCOMPOSITE_INT_HPP_
Packit Service 21b5d1
Packit Service 21b5d1
// *****************************************************************************
Packit Service 21b5d1
// included header files
Packit Service 21b5d1
#include "value.hpp"
Packit Service 21b5d1
#include "tifffwd_int.hpp"
Packit Service 21b5d1
#include "types.hpp"
Packit Service 21b5d1
Packit Service 21b5d1
// + standard includes
Packit Service 21b5d1
#include <iosfwd>
Packit Service 21b5d1
#include <vector>
Packit Service 21b5d1
#include <string>
Packit Service 21b5d1
#include <cassert>
Packit Service 21b5d1
Packit Service 21b5d1
// *****************************************************************************
Packit Service 21b5d1
// namespace extensions
Packit Service 21b5d1
namespace Exiv2 {
Packit Service 21b5d1
Packit Service 21b5d1
    class BasicIo;
Packit Service 21b5d1
Packit Service 21b5d1
    namespace Internal {
Packit Service 21b5d1
Packit Service 21b5d1
// *****************************************************************************
Packit Service 21b5d1
// class definitions
Packit Service 21b5d1
Packit Service 21b5d1
    //! TIFF value type.
Packit Service 21b5d1
    typedef uint16_t TiffType;
Packit Service 21b5d1
Packit Service 21b5d1
    const TiffType ttUnsignedByte     = 1; //!< Exif BYTE type
Packit Service 21b5d1
    const TiffType ttAsciiString      = 2; //!< Exif ASCII type
Packit Service 21b5d1
    const TiffType ttUnsignedShort    = 3; //!< Exif SHORT type
Packit Service 21b5d1
    const TiffType ttUnsignedLong     = 4; //!< Exif LONG type
Packit Service 21b5d1
    const TiffType ttUnsignedRational = 5; //!< Exif RATIONAL type
Packit Service 21b5d1
    const TiffType ttSignedByte       = 6; //!< Exif SBYTE type
Packit Service 21b5d1
    const TiffType ttUndefined        = 7; //!< Exif UNDEFINED type
Packit Service 21b5d1
    const TiffType ttSignedShort      = 8; //!< Exif SSHORT type
Packit Service 21b5d1
    const TiffType ttSignedLong       = 9; //!< Exif SLONG type
Packit Service 21b5d1
    const TiffType ttSignedRational   =10; //!< Exif SRATIONAL type
Packit Service 21b5d1
    const TiffType ttTiffFloat        =11; //!< TIFF FLOAT type
Packit Service 21b5d1
    const TiffType ttTiffDouble       =12; //!< TIFF DOUBLE type
Packit Service 21b5d1
    const TiffType ttTiffIfd          =13; //!< TIFF IFD type
Packit Service 21b5d1
Packit Service 21b5d1
    //! Convert the \em tiffType of a \em tag and \em group to an Exiv2 \em typeId.
Packit Service 21b5d1
    TypeId toTypeId(TiffType tiffType, uint16_t tag, IfdId group);
Packit Service 21b5d1
    //! Convert the %Exiv2 \em typeId to a TIFF value type.
Packit Service 21b5d1
    TiffType toTiffType(TypeId typeId);
Packit Service 21b5d1
Packit Service 21b5d1
    /*!
Packit Service 21b5d1
      Special TIFF tags for the use in TIFF structures only
Packit Service 21b5d1
    */
Packit Service 21b5d1
    namespace Tag {
Packit Service 21b5d1
        const uint32_t none = 0x10000; //!< Dummy tag
Packit Service 21b5d1
        const uint32_t root = 0x20000; //!< Special tag: root IFD
Packit Service 21b5d1
        const uint32_t next = 0x30000; //!< Special tag: next IFD
Packit Service 21b5d1
        const uint32_t all  = 0x40000; //!< Special tag: all tags in a group
Packit Service 21b5d1
        const uint32_t pana = 0x80000; //!< Special tag: root IFD of Panasonic RAW images
Packit Service 21b5d1
    }
Packit Service 21b5d1
Packit Service 21b5d1
    /*!
Packit Service 21b5d1
      @brief A tupel consisting of extended Tag and group used as an item in
Packit Service 21b5d1
             TIFF paths.
Packit Service 21b5d1
    */
Packit Service 21b5d1
    class TiffPathItem {
Packit Service 21b5d1
    public:
Packit Service 21b5d1
        //! @name Creators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Constructor
Packit Service 21b5d1
        TiffPathItem(uint32_t extendedTag, IfdId group)
Packit Service 21b5d1
            : extendedTag_(extendedTag), group_(group) {}
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Accessors
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Return the tag corresponding to the extended tag
Packit Service 21b5d1
        uint16_t tag()         const { return static_cast<uint16_t>(extendedTag_ & 0xffff); }
Packit Service 21b5d1
        //! Return the extended tag (32 bit so that it can contain special tags)
Packit Service 21b5d1
        uint32_t extendedTag() const { return extendedTag_; }
Packit Service 21b5d1
        //! Return the group
Packit Service 21b5d1
        IfdId    group()       const { return group_; }
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    private:
Packit Service 21b5d1
        // DATA
Packit Service 21b5d1
        uint32_t extendedTag_;
Packit Service 21b5d1
        IfdId    group_;
Packit Service 21b5d1
    }; // class TiffPathItem
Packit Service 21b5d1
Packit Service 21b5d1
    /*!
Packit Service 21b5d1
      @brief Simple IO wrapper to ensure that the header is only written if there is
Packit Service 21b5d1
             any other data at all.
Packit Service 21b5d1
Packit Service 21b5d1
      The wrapper is initialized with an IO reference and a pointer to a TIFF header.
Packit Service 21b5d1
      Subsequently the wrapper is used by all TIFF write methods. It takes care that
Packit Service 21b5d1
      the TIFF header is written to the IO first before any other output and only if
Packit Service 21b5d1
      there is any other data.
Packit Service 21b5d1
     */
Packit Service 21b5d1
    class IoWrapper {
Packit Service 21b5d1
    public:
Packit Service 21b5d1
        //! @name Creators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          brief Constructor.
Packit Service 21b5d1
Packit Service 21b5d1
          The IO wrapper owns none of the objects passed in so the caller is
Packit Service 21b5d1
          responsible to keep them alive.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        IoWrapper(BasicIo& io, const byte* pHeader, long size, OffsetWriter* pow);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Manipulators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Wraps the corresponding BasicIo::write() method.
Packit Service 21b5d1
Packit Service 21b5d1
          Writes the TIFF header to the IO, if it hasn't been written yet, followed
Packit Service 21b5d1
          by the data passed in the arguments.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        long write(const byte* pData, long wcount);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Wraps the corresponding BasicIo::putb() method.
Packit Service 21b5d1
Packit Service 21b5d1
          Writes the TIFF header to the IO, if it hasn't been written yet, followed
Packit Service 21b5d1
          by the data passed in the argument.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        int putb(byte data);
Packit Service 21b5d1
        //! Wrapper for OffsetWriter::setTarget(), using an int instead of the enum to reduce include deps
Packit Service 21b5d1
        void setTarget(int id, uint32_t target);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    private:
Packit Service 21b5d1
        // DATA
Packit Service 21b5d1
        BasicIo& io_;              //! Reference for the IO instance.
Packit Service 21b5d1
        const byte* pHeader_;      //! Pointer to the header data.
Packit Service 21b5d1
        long size_;                //! Size of the header data.
Packit Service 21b5d1
        bool wroteHeader_;         //! Indicates if the header has been written.
Packit Service 21b5d1
        OffsetWriter* pow_;        //! Pointer to an offset-writer, if any, or 0
Packit Service 21b5d1
    }; // class IoWrapper
Packit Service 21b5d1
Packit Service 21b5d1
    /*!
Packit Service 21b5d1
      @brief Interface class for components of a TIFF directory hierarchy
Packit Service 21b5d1
             (Composite pattern).  Both TIFF directories as well as entries
Packit Service 21b5d1
             implement this interface.  A component can be uniquely identified
Packit Service 21b5d1
             by a tag, group tupel.  This class is implemented as a NVI
Packit Service 21b5d1
             (Non-Virtual Interface) and it has an interface for visitors
Packit Service 21b5d1
             (Visitor pattern) to perform operations on all components.
Packit Service 21b5d1
     */
Packit Service 21b5d1
    class TiffComponent {
Packit Service 21b5d1
    public:
Packit Service 21b5d1
        //! TiffComponent auto_ptr type
Packit Service 21b5d1
        typedef std::auto_ptr<TiffComponent> AutoPtr;
Packit Service 21b5d1
        //! Container type to hold all metadata
Packit Service 21b5d1
        typedef std::vector<TiffComponent*> Components;
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Creators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Constructor
Packit Service 21b5d1
        TiffComponent(uint16_t tag, IfdId group);
Packit Service 21b5d1
        //! Virtual destructor.
Packit Service 21b5d1
        virtual ~TiffComponent();
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Manipulators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Add a TIFF entry \em tag to the component. Components on
Packit Service 21b5d1
                 the path to the entry are added if they don't exist yet.
Packit Service 21b5d1
Packit Service 21b5d1
          @param tag      The tag of the new entry
Packit Service 21b5d1
          @param tiffPath A path from the TIFF root element to a TIFF entry.
Packit Service 21b5d1
          @param pRoot    Pointer to the root component of the TIFF composite.
Packit Service 21b5d1
          @param object   TIFF component to add. If 0, the correct entry will be
Packit Service 21b5d1
                          created.
Packit Service 21b5d1
Packit Service 21b5d1
          @return A pointer to the newly added TIFF entry.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        TiffComponent* addPath(uint16_t tag,
Packit Service 21b5d1
                               TiffPath& tiffPath,
Packit Service 21b5d1
                               TiffComponent* const pRoot,
Packit Service 21b5d1
                               AutoPtr object =AutoPtr(0));
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Add a child to the component. Default is to do nothing.
Packit Service 21b5d1
          @param tiffComponent Auto pointer to the component to add.
Packit Service 21b5d1
          @return Return a pointer to the newly added child element or 0.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        TiffComponent* addChild(AutoPtr tiffComponent);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
            @brief Add a "next" component to the component. Default is to do
Packit Service 21b5d1
                   nothing.
Packit Service 21b5d1
            @param tiffComponent Auto pointer to the component to add.
Packit Service 21b5d1
            @return Return a pointer to the newly added "next" element or 0.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        TiffComponent* addNext(AutoPtr tiffComponent);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Interface to accept visitors (Visitor pattern). Visitors
Packit Service 21b5d1
                 can perform operations on all components of the composite.
Packit Service 21b5d1
Packit Service 21b5d1
          @param visitor The visitor.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        void accept(TiffVisitor& visitor);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Set a pointer to the start of the binary representation of the
Packit Service 21b5d1
                 component in a memory buffer. The buffer must be allocated and
Packit Service 21b5d1
                 freed outside of this class.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        void setStart(const byte* pStart) { pStart_ = const_cast<byte*>(pStart); }
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Write a TiffComponent to a binary image.
Packit Service 21b5d1
Packit Service 21b5d1
          @param ioWrapper  IO wrapper to which the TiffComponent is written.
Packit Service 21b5d1
          @param byteOrder  Applicable byte order (little or big endian).
Packit Service 21b5d1
          @param offset     Offset from the start of the image (TIFF header) to
Packit Service 21b5d1
                            the component.
Packit Service 21b5d1
          @param valueIdx   Index of the component to be written relative to offset.
Packit Service 21b5d1
          @param dataIdx    Index of the data area of the component relative to offset.
Packit Service 21b5d1
          @param imageIdx   Index of the image data area relative to offset.
Packit Service 21b5d1
          @return           Number of bytes written to the IO wrapper including all
Packit Service 21b5d1
                            nested components.
Packit Service 21b5d1
          @throw            Error If the component cannot be written.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        uint32_t write(IoWrapper& ioWrapper,
Packit Service 21b5d1
                       ByteOrder byteOrder,
Packit Service 21b5d1
                       int32_t   offset,
Packit Service 21b5d1
                       uint32_t  valueIdx,
Packit Service 21b5d1
                       uint32_t  dataIdx,
Packit Service 21b5d1
                       uint32_t& imageIdx);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Accessors
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Return the tag of this entry.
Packit Service 21b5d1
        uint16_t tag()                        const { return tag_; }
Packit Service 21b5d1
        //! Return the group id of this component
Packit Service 21b5d1
        IfdId    group()                      const { return group_; }
Packit Service 21b5d1
        //! Return a pointer to the start of the binary representation of the component
Packit Service 21b5d1
        byte*    start()                      const { return pStart_; }
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Return an auto-pointer to a copy of itself (deep copy, but
Packit Service 21b5d1
                 without any children). The caller owns this copy and the
Packit Service 21b5d1
                 auto-pointer ensures that it will be deleted.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        AutoPtr clone() const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Write the IFD data of this component to a binary image.
Packit Service 21b5d1
                 Return the number of bytes written. Components derived from
Packit Service 21b5d1
                 TiffEntryBase implement this method if needed.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        uint32_t writeData(IoWrapper& ioWrapper,
Packit Service 21b5d1
                           ByteOrder byteOrder,
Packit Service 21b5d1
                           int32_t   offset,
Packit Service 21b5d1
                           uint32_t  dataIdx,
Packit Service 21b5d1
                           uint32_t& imageIdx) const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Write the image data of this component to a binary image.
Packit Service 21b5d1
                 Return the number of bytes written. TIFF components implement
Packit Service 21b5d1
                 this method if needed.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        uint32_t writeImage(IoWrapper& ioWrapper,
Packit Service 21b5d1
                            ByteOrder byteOrder) const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Return the size in bytes of the IFD value of this component
Packit Service 21b5d1
                 when written to a binary image.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        uint32_t size() const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Return the number of components in this component.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        uint32_t count() const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Return the size in bytes of the IFD data of this component when
Packit Service 21b5d1
                 written to a binary image.  This is a support function for
Packit Service 21b5d1
                 write(). Components derived from TiffEntryBase implement this
Packit Service 21b5d1
                 method corresponding to their implementation of writeData().
Packit Service 21b5d1
         */
Packit Service 21b5d1
        uint32_t sizeData() const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Return the size in bytes of the image data of this component
Packit Service 21b5d1
                 when written to a binary image.  This is a support function for
Packit Service 21b5d1
                 write(). TIFF components implement this method corresponding to
Packit Service 21b5d1
                 their implementation of writeImage().
Packit Service 21b5d1
         */
Packit Service 21b5d1
        uint32_t sizeImage() const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Return the unique id of the entry in the image.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        // Todo: This is only implemented in TiffEntryBase. It is needed here so that
Packit Service 21b5d1
        //       we can sort components by tag and idx. Something is not quite right.
Packit Service 21b5d1
        virtual int idx() const;
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    protected:
Packit Service 21b5d1
        //! @name Protected Manipulators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Implements addPath(). The default implementation does nothing.
Packit Service 21b5d1
        virtual TiffComponent* doAddPath(uint16_t  tag,
Packit Service 21b5d1
                                         TiffPath& tiffPath,
Packit Service 21b5d1
                                         TiffComponent* const pRoot,
Packit Service 21b5d1
                                         TiffComponent::AutoPtr object);
Packit Service 21b5d1
        //! Implements addChild(). The default implementation does nothing.
Packit Service 21b5d1
        virtual TiffComponent* doAddChild(AutoPtr tiffComponent);
Packit Service 21b5d1
        //! Implements addNext(). The default implementation does nothing.
Packit Service 21b5d1
        virtual TiffComponent* doAddNext(AutoPtr tiffComponent);
Packit Service 21b5d1
        //! Implements accept().
Packit Service 21b5d1
        virtual void doAccept(TiffVisitor& visitor) =0;
Packit Service 21b5d1
        //! Implements write().
Packit Service 21b5d1
        virtual uint32_t doWrite(IoWrapper& ioWrapper,
Packit Service 21b5d1
                                 ByteOrder byteOrder,
Packit Service 21b5d1
                                 int32_t   offset,
Packit Service 21b5d1
                                 uint32_t  valueIdx,
Packit Service 21b5d1
                                 uint32_t  dataIdx,
Packit Service 21b5d1
                                 uint32_t& imageIdx) =0;
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Protected Accessors
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Internal virtual copy constructor, implements clone().
Packit Service 21b5d1
        virtual TiffComponent* doClone() const =0;
Packit Service 21b5d1
        //! Implements writeData().
Packit Service 21b5d1
        virtual uint32_t doWriteData(IoWrapper& ioWrapper,
Packit Service 21b5d1
                                     ByteOrder byteOrder,
Packit Service 21b5d1
                                     int32_t   offset,
Packit Service 21b5d1
                                     uint32_t  dataIdx,
Packit Service 21b5d1
                                     uint32_t& imageIdx) const =0;
Packit Service 21b5d1
        //! Implements writeImage().
Packit Service 21b5d1
        virtual uint32_t doWriteImage(IoWrapper& ioWrapper,
Packit Service 21b5d1
                                      ByteOrder byteOrder) const =0;
Packit Service 21b5d1
        //! Implements size().
Packit Service 21b5d1
        virtual uint32_t doSize() const =0;
Packit Service 21b5d1
        //! Implements count().
Packit Service 21b5d1
        virtual uint32_t doCount() const =0;
Packit Service 21b5d1
        //! Implements sizeData().
Packit Service 21b5d1
        virtual uint32_t doSizeData() const =0;
Packit Service 21b5d1
        //! Implements sizeImage().
Packit Service 21b5d1
        virtual uint32_t doSizeImage() const =0;
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    private:
Packit Service 21b5d1
        // DATA
Packit Service 21b5d1
        uint16_t tag_;      //!< Tag that identifies the component
Packit Service 21b5d1
        IfdId    group_;    //!< Group id for this component
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          Pointer to the start of the binary representation of the component in
Packit Service 21b5d1
          a memory buffer. The buffer is allocated and freed outside of this class.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        byte*    pStart_;
Packit Service 21b5d1
Packit Service 21b5d1
    }; // class TiffComponent
Packit Service 21b5d1
Packit Service 21b5d1
    //! TIFF mapping table for functions to decode special cases
Packit Service 21b5d1
    struct TiffMappingInfo {
Packit Service 21b5d1
        struct Key;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Compare a TiffMappingInfo with a TiffMappingInfo::Key.
Packit Service 21b5d1
                 The two are equal if TiffMappingInfo::make_ equals a substring
Packit Service 21b5d1
                 of the key of the same size. E.g., mapping info = "OLYMPUS",
Packit Service 21b5d1
                 key = "OLYMPUS OPTICAL CO.,LTD" (found in the image) match,
Packit Service 21b5d1
                 the extendedTag is Tag::all or equal to the extended tag of the
Packit Service 21b5d1
                 key, and the group is equal to that of the key.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        bool operator==(const Key& key) const;
Packit Service 21b5d1
        //! Return the tag corresponding to the extended tag
Packit Service 21b5d1
        uint16_t tag() const { return static_cast<uint16_t>(extendedTag_ & 0xffff); }
Packit Service 21b5d1
Packit Service 21b5d1
        // DATA
Packit Service 21b5d1
        const char* make_;        //!< Camera make for which these mapping functions apply
Packit Service 21b5d1
        uint32_t    extendedTag_; //!< Tag (32 bit so that it can contain special tags)
Packit Service 21b5d1
        IfdId       group_;       //!< Group that contains the tag
Packit Service 21b5d1
        DecoderFct  decoderFct_;  //!< Decoder function for matching tags
Packit Service 21b5d1
        EncoderFct  encoderFct_;  //!< Encoder function for matching tags
Packit Service 21b5d1
Packit Service 21b5d1
    }; // struct TiffMappingInfo
Packit Service 21b5d1
Packit Service 21b5d1
    //! Search key for TIFF mapping structures.
Packit Service 21b5d1
    struct TiffMappingInfo::Key {
Packit Service 21b5d1
        //! Constructor
Packit Service 21b5d1
        Key(const std::string& m, uint32_t e, IfdId g) : m_(m), e_(e), g_(g) {}
Packit Service 21b5d1
        std::string m_;                    //!< Camera make
Packit Service 21b5d1
        uint32_t    e_;                    //!< Extended tag
Packit Service 21b5d1
        IfdId       g_;                    //!< %Group
Packit Service 21b5d1
    };
Packit Service 21b5d1
Packit Service 21b5d1
    /*!
Packit Service 21b5d1
      @brief This abstract base class provides the common functionality of an
Packit Service 21b5d1
             IFD directory entry and defines an extended interface for derived
Packit Service 21b5d1
             concrete entries, which allows access to the attributes of the
Packit Service 21b5d1
             entry.
Packit Service 21b5d1
     */
Packit Service 21b5d1
    class TiffEntryBase : public TiffComponent {
Packit Service 21b5d1
        friend class TiffReader;
Packit Service 21b5d1
        friend class TiffEncoder;
Packit Service 21b5d1
        friend int selectNikonLd(TiffBinaryArray* const, TiffComponent* const);
Packit Service 21b5d1
    public:
Packit Service 21b5d1
        //! @name Creators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Default constructor.
Packit Service 21b5d1
        TiffEntryBase(uint16_t tag, IfdId group, TiffType tiffType =ttUndefined);
Packit Service 21b5d1
        //! Virtual destructor.
Packit Service 21b5d1
        virtual ~TiffEntryBase();
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Manipulators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Encode a TIFF component from the metadatum provided and
Packit Service 21b5d1
                 information from the \em encoder as needed.
Packit Service 21b5d1
Packit Service 21b5d1
          Implemented as double-dispatch calls back to one of the specific
Packit Service 21b5d1
          encoding functions at the \em encoder.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        void encode(TiffEncoder& encoder, const Exifdatum* datum);
Packit Service 21b5d1
        //! Set the offset
Packit Service 21b5d1
        void setOffset(int32_t offset) { offset_ = offset; }
Packit Service 21b5d1
        //! Set pointer and size of the entry's data (not taking ownership of the data).
Packit Service 21b5d1
        void setData(byte* pData, int32_t size);
Packit Service 21b5d1
        //! Set the entry's data buffer, taking ownership of the data buffer passed in.
Packit Service 21b5d1
        void setData(DataBuf buf);
Packit Service 21b5d1
         /*!
Packit Service 21b5d1
          @brief Update the value. Takes ownership of the pointer passed in.
Packit Service 21b5d1
Packit Service 21b5d1
          Update binary value data and call setValue().
Packit Service 21b5d1
        */
Packit Service 21b5d1
        void updateValue(Value::AutoPtr value, ByteOrder byteOrder);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Set tag value. Takes ownership of the pointer passed in.
Packit Service 21b5d1
Packit Service 21b5d1
          Update type, count and the pointer to the value.
Packit Service 21b5d1
        */
Packit Service 21b5d1
        void setValue(Value::AutoPtr value);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Accessors
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Return the TIFF type
Packit Service 21b5d1
        TiffType tiffType()      const { return tiffType_; }
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Return the offset to the data area relative to the base
Packit Service 21b5d1
                 for the component (usually the start of the TIFF header)
Packit Service 21b5d1
         */
Packit Service 21b5d1
        int32_t offset()         const { return offset_; }
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Return the unique id of the entry in the image
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual int idx()        const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Return a pointer to the binary representation of the
Packit Service 21b5d1
                 value of this component.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        const byte* pData()      const { return pData_; }
Packit Service 21b5d1
        //! Return a const pointer to the converted value of this component
Packit Service 21b5d1
        const Value* pValue()    const { return pValue_; }
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    protected:
Packit Service 21b5d1
        //! @name Protected Creators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Copy constructor (used to implement clone()).
Packit Service 21b5d1
        TiffEntryBase(const TiffEntryBase& rhs);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Protected Manipulators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Implements encode().
Packit Service 21b5d1
        virtual void doEncode(TiffEncoder& encoder, const Exifdatum* datum) =0;
Packit Service 21b5d1
        //! Set the number of components in this entry
Packit Service 21b5d1
        void setCount(uint32_t count) { count_ = count; }
Packit Service 21b5d1
        //! Set the unique id of the entry in the image
Packit Service 21b5d1
        void setIdx(int idx) { idx_ = idx; }
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Implements write(). Write the value of a standard TIFF entry to
Packit Service 21b5d1
                 the \em ioWrapper, return the number of bytes written. Only the
Packit Service 21b5d1
                 \em ioWrapper and \em byteOrder arguments are used.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual uint32_t doWrite(IoWrapper& ioWrapper,
Packit Service 21b5d1
                                 ByteOrder byteOrder,
Packit Service 21b5d1
                                 int32_t   offset,
Packit Service 21b5d1
                                 uint32_t  valueIdx,
Packit Service 21b5d1
                                 uint32_t  dataIdx,
Packit Service 21b5d1
                                 uint32_t& imageIdx);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Protected Accessors
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Implements count().
Packit Service 21b5d1
        virtual uint32_t doCount() const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Implements writeData(). Standard TIFF entries have no data:
Packit Service 21b5d1
                 write nothing and return 0.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual uint32_t doWriteData(IoWrapper& ioWrapper,
Packit Service 21b5d1
                                     ByteOrder byteOrder,
Packit Service 21b5d1
                                     int32_t   offset,
Packit Service 21b5d1
                                     uint32_t  dataIdx,
Packit Service 21b5d1
                                     uint32_t& imageIdx) const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Implements writeImage(). Standard TIFF entries have no image data:
Packit Service 21b5d1
                 write nothing and return 0.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual uint32_t doWriteImage(IoWrapper& ioWrapper,
Packit Service 21b5d1
                                      ByteOrder byteOrder) const;
Packit Service 21b5d1
        //! Implements size(). Return the size of a standard TIFF entry
Packit Service 21b5d1
        virtual uint32_t doSize() const;
Packit Service 21b5d1
        //! Implements sizeData(). Return 0.
Packit Service 21b5d1
        virtual uint32_t doSizeData() const;
Packit Service 21b5d1
        //! Implements sizeImage(). Return 0.
Packit Service 21b5d1
        virtual uint32_t doSizeImage() const;
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! Helper function to write an \em offset to a preallocated binary buffer
Packit Service 21b5d1
        static uint32_t writeOffset(byte*     buf,
Packit Service 21b5d1
                                    int32_t   offset,
Packit Service 21b5d1
                                    TiffType  tiffType,
Packit Service 21b5d1
                                    ByteOrder byteOrder);
Packit Service 21b5d1
Packit Service 21b5d1
    private:
Packit Service 21b5d1
        //! @name NOT implemented
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Assignment operator.
Packit Service 21b5d1
        TiffEntryBase& operator=(const TiffEntryBase& rhs);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        // DATA
Packit Service 21b5d1
        TiffType tiffType_;   //!< Field TIFF type
Packit Service 21b5d1
        uint32_t count_;      //!< The number of values of the indicated type
Packit Service 21b5d1
        int32_t  offset_;     //!< Offset to the data area
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          Size of the data buffer holding the value in bytes, there is no
Packit Service 21b5d1
          minimum size.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        uint32_t size_;
Packit Service 21b5d1
        byte*    pData_;      //!< Pointer to the data area
Packit Service 21b5d1
        bool     isMalloced_; //!< True if this entry owns the value data
Packit Service 21b5d1
        int      idx_;        //!< Unique id of the entry in the image
Packit Service 21b5d1
        Value*   pValue_;     //!< Converted data value
Packit Service 21b5d1
Packit Service 21b5d1
    }; // class TiffEntryBase
Packit Service 21b5d1
Packit Service 21b5d1
    /*!
Packit Service 21b5d1
      @brief A standard TIFF IFD entry.
Packit Service 21b5d1
     */
Packit Service 21b5d1
    class TiffEntry : public TiffEntryBase {
Packit Service 21b5d1
    public:
Packit Service 21b5d1
        //! @name Creators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Constructor
Packit Service 21b5d1
        TiffEntry(uint16_t tag, IfdId group) : TiffEntryBase(tag, group) {}
Packit Service 21b5d1
        //! Virtual destructor.
Packit Service 21b5d1
        virtual ~TiffEntry();
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    protected:
Packit Service 21b5d1
        //! @name Manipulators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        virtual void doAccept(TiffVisitor& visitor);
Packit Service 21b5d1
        virtual void doEncode(TiffEncoder& encoder, const Exifdatum* datum);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Protected Accessors
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        virtual TiffEntry* doClone() const;
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    }; // class TiffEntry
Packit Service 21b5d1
Packit Service 21b5d1
    /*!
Packit Service 21b5d1
      @brief Interface for a standard TIFF IFD entry consisting of a value
Packit Service 21b5d1
             which is a set of offsets to a data area. The sizes of these "strips"
Packit Service 21b5d1
             are provided in a related TiffSizeEntry, tag and group of which are
Packit Service 21b5d1
             set in the constructor. The implementations of this interface differ
Packit Service 21b5d1
             in whether the data areas are extracted to the higher level metadata
Packit Service 21b5d1
             (TiffDataEntry) or not (TiffImageEntry).
Packit Service 21b5d1
     */
Packit Service 21b5d1
    class TiffDataEntryBase : public TiffEntryBase {
Packit Service 21b5d1
    public:
Packit Service 21b5d1
        //! @name Creators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Constructor
Packit Service 21b5d1
        TiffDataEntryBase(uint16_t tag, IfdId group, uint16_t szTag, IfdId szGroup)
Packit Service 21b5d1
            : TiffEntryBase(tag, group),
Packit Service 21b5d1
              szTag_(szTag), szGroup_(szGroup) {}
Packit Service 21b5d1
        //! Virtual destructor.
Packit Service 21b5d1
        virtual ~TiffDataEntryBase();
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Manipulators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Set the data areas ("strips").
Packit Service 21b5d1
Packit Service 21b5d1
          @param pSize Pointer to the Value holding the sizes corresponding
Packit Service 21b5d1
                       to this data entry.
Packit Service 21b5d1
          @param pData Pointer to the data area.
Packit Service 21b5d1
          @param sizeData Size of the data area.
Packit Service 21b5d1
          @param baseOffset Base offset into the data area.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual void setStrips(const Value* pSize,
Packit Service 21b5d1
                               const byte*  pData,
Packit Service 21b5d1
                               uint32_t     sizeData,
Packit Service 21b5d1
                               uint32_t     baseOffset) =0;
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Accessors
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Return the group of the entry which has the size
Packit Service 21b5d1
        uint16_t szTag()   const { return szTag_; }
Packit Service 21b5d1
        //! Return the group of the entry which has the size
Packit Service 21b5d1
        IfdId    szGroup() const { return szGroup_; }
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    private:
Packit Service 21b5d1
        // DATA
Packit Service 21b5d1
        const uint16_t szTag_;               //!< Tag of the entry with the size
Packit Service 21b5d1
        const IfdId    szGroup_;             //!< Group of the entry with the size
Packit Service 21b5d1
Packit Service 21b5d1
    }; // class TiffDataEntryBase
Packit Service 21b5d1
Packit Service 21b5d1
    /*!
Packit Service 21b5d1
      @brief A standard TIFF IFD entry consisting of a value which is an offset
Packit Service 21b5d1
             to a data area and the data area. The size of the data area is
Packit Service 21b5d1
             provided in a related TiffSizeEntry, tag and group of which are set
Packit Service 21b5d1
             in the constructor.
Packit Service 21b5d1
Packit Service 21b5d1
             This component extracts the data areas ("strips") and makes them
Packit Service 21b5d1
             available in the higher level metadata. It is used, e.g., for
Packit Service 21b5d1
             \em Exif.Thumbnail.JPEGInterchangeFormat for which the size
Packit Service 21b5d1
             is provided in \em Exif.Thumbnail.JPEGInterchangeFormatLength.
Packit Service 21b5d1
     */
Packit Service 21b5d1
    class TiffDataEntry : public TiffDataEntryBase {
Packit Service 21b5d1
        friend class TiffEncoder;
Packit Service 21b5d1
    public:
Packit Service 21b5d1
        //! @name Creators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Constructor
Packit Service 21b5d1
        TiffDataEntry(uint16_t tag, IfdId group, uint16_t szTag, IfdId szGroup)
Packit Service 21b5d1
            : TiffDataEntryBase(tag, group, szTag, szGroup),
Packit Service 21b5d1
              pDataArea_(0), sizeDataArea_(0) {}
Packit Service 21b5d1
        //! Virtual destructor.
Packit Service 21b5d1
        virtual ~TiffDataEntry();
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Manipulators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        virtual void setStrips(const Value* pSize,
Packit Service 21b5d1
                               const byte*  pData,
Packit Service 21b5d1
                               uint32_t     sizeData,
Packit Service 21b5d1
                               uint32_t     baseOffset);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    protected:
Packit Service 21b5d1
        //! @name Protected Manipulators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        virtual void doAccept(TiffVisitor& visitor);
Packit Service 21b5d1
        virtual void doEncode(TiffEncoder& encoder, const Exifdatum* datum);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Implements write(). Write pointers into the data area to the
Packit Service 21b5d1
                 \em ioWrapper, relative to the offsets in the value. Return the
Packit Service 21b5d1
                 number of bytes written. The \em valueIdx argument is not used.
Packit Service 21b5d1
Packit Service 21b5d1
          The number of components in the value determines how many offsets are
Packit Service 21b5d1
          written. Set the first value to 0, the second to the size of the first
Packit Service 21b5d1
          data area, etc. when creating a new data entry. Offsets will be adjusted
Packit Service 21b5d1
          on write. The type of the value can only be signed or unsigned short or
Packit Service 21b5d1
          long.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual uint32_t doWrite(IoWrapper& ioWrapper,
Packit Service 21b5d1
                                 ByteOrder byteOrder,
Packit Service 21b5d1
                                 int32_t   offset,
Packit Service 21b5d1
                                 uint32_t  valueIdx,
Packit Service 21b5d1
                                 uint32_t  dataIdx,
Packit Service 21b5d1
                                 uint32_t& imageIdx);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Protected Accessors
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        virtual TiffDataEntry* doClone() const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Implements writeData(). Write the data area to the \em ioWrapper.
Packit Service 21b5d1
                 Return the number of bytes written.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual uint32_t doWriteData(IoWrapper& ioWrapper,
Packit Service 21b5d1
                                     ByteOrder byteOrder,
Packit Service 21b5d1
                                     int32_t   offset,
Packit Service 21b5d1
                                     uint32_t  dataIdx,
Packit Service 21b5d1
                                     uint32_t& imageIdx) const;
Packit Service 21b5d1
        // Using doWriteImage from base class
Packit Service 21b5d1
        // Using doSize() from base class
Packit Service 21b5d1
        //! Implements sizeData(). Return the size of the data area.
Packit Service 21b5d1
        virtual uint32_t doSizeData() const;
Packit Service 21b5d1
        // Using doSizeImage from base class
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    private:
Packit Service 21b5d1
        // DATA
Packit Service 21b5d1
        byte*          pDataArea_;           //!< Pointer to the data area (never alloc'd)
Packit Service 21b5d1
        uint32_t       sizeDataArea_;        //!< Size of the data area
Packit Service 21b5d1
Packit Service 21b5d1
    }; // class TiffDataEntry
Packit Service 21b5d1
Packit Service 21b5d1
    /*!
Packit Service 21b5d1
      @brief A standard TIFF IFD entry consisting of a value which is an array
Packit Service 21b5d1
             of offsets to image data areas. The sizes of the image data areas are
Packit Service 21b5d1
             provided in a related TiffSizeEntry, tag and group of which are set
Packit Service 21b5d1
             in the constructor.
Packit Service 21b5d1
Packit Service 21b5d1
             The data is not extracted into the higher level metadata tags, it is
Packit Service 21b5d1
             only copied to the target image when the image is written.
Packit Service 21b5d1
             This component is used, e.g., for
Packit Service 21b5d1
             \em Exif.Image.StripOffsets for which the sizes are provided in
Packit Service 21b5d1
             \em Exif.Image.StripByteCounts.
Packit Service 21b5d1
     */
Packit Service 21b5d1
    class TiffImageEntry : public TiffDataEntryBase {
Packit Service 21b5d1
        friend class TiffEncoder;
Packit Service 21b5d1
    public:
Packit Service 21b5d1
        //! @name Creators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Constructor
Packit Service 21b5d1
        TiffImageEntry(uint16_t tag, IfdId group, uint16_t szTag, IfdId szGroup)
Packit Service 21b5d1
            : TiffDataEntryBase(tag, group, szTag, szGroup) {}
Packit Service 21b5d1
        //! Virtual destructor.
Packit Service 21b5d1
        virtual ~TiffImageEntry();
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Manipulators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        virtual void setStrips(const Value* pSize,
Packit Service 21b5d1
                               const byte*  pData,
Packit Service 21b5d1
                               uint32_t     sizeData,
Packit Service 21b5d1
                               uint32_t     baseOffset);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    protected:
Packit Service 21b5d1
        //! @name Protected Manipulators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        virtual void doAccept(TiffVisitor& visitor);
Packit Service 21b5d1
        virtual void doEncode(TiffEncoder& encoder, const Exifdatum* datum);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Implements write(). Write pointers into the image data area to the
Packit Service 21b5d1
                 \em ioWrapper. Return the number of bytes written. The \em valueIdx
Packit Service 21b5d1
                 and \em dataIdx  arguments are not used.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual uint32_t doWrite(IoWrapper& ioWrapper,
Packit Service 21b5d1
                                 ByteOrder byteOrder,
Packit Service 21b5d1
                                 int32_t   offset,
Packit Service 21b5d1
                                 uint32_t  valueIdx,
Packit Service 21b5d1
                                 uint32_t  dataIdx,
Packit Service 21b5d1
                                 uint32_t& imageIdx);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Protected Accessors
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        virtual TiffImageEntry* doClone() const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Implements writeData(). Write the image data area to the \em ioWrapper.
Packit Service 21b5d1
                 Return the number of bytes written.
Packit Service 21b5d1
Packit Service 21b5d1
          This function writes the image data to the data area of the current
Packit Service 21b5d1
          directory. It is used for TIFF image entries in the makernote (large
Packit Service 21b5d1
          preview images) so that the image data remains in the makernote IFD.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual uint32_t doWriteData(IoWrapper& ioWrapper,
Packit Service 21b5d1
                                     ByteOrder byteOrder,
Packit Service 21b5d1
                                     int32_t   offset,
Packit Service 21b5d1
                                     uint32_t  dataIdx,
Packit Service 21b5d1
                                     uint32_t& imageIdx) const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Implements writeImage(). Write the image data area to the \em ioWrapper.
Packit Service 21b5d1
                 Return the number of bytes written.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual uint32_t doWriteImage(IoWrapper& ioWrapper,
Packit Service 21b5d1
                                      ByteOrder byteOrder) const;
Packit Service 21b5d1
        //! Implements size(). Return the size of the strip pointers.
Packit Service 21b5d1
        virtual uint32_t doSize() const;
Packit Service 21b5d1
        //! Implements sizeData(). Return the size of the image data area.
Packit Service 21b5d1
        virtual uint32_t doSizeData() const;
Packit Service 21b5d1
        //! Implements sizeImage(). Return the size of the image data area.
Packit Service 21b5d1
        virtual uint32_t doSizeImage() const;
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    private:
Packit Service 21b5d1
        //! Pointers to the image data (strips) and their sizes.
Packit Service 21b5d1
        typedef std::vector<std::pair<const byte*, uint32_t> > Strips;
Packit Service 21b5d1
Packit Service 21b5d1
        // DATA
Packit Service 21b5d1
        Strips   strips_;       //!< Image strips data (never alloc'd) and sizes
Packit Service 21b5d1
Packit Service 21b5d1
    }; // class TiffImageEntry
Packit Service 21b5d1
Packit Service 21b5d1
    /*!
Packit Service 21b5d1
      @brief A TIFF IFD entry containing the size of a data area of a related
Packit Service 21b5d1
             TiffDataEntry. This component is used, e.g. for
Packit Service 21b5d1
             \em Exif.Thumbnail.JPEGInterchangeFormatLength, which contains the
Packit Service 21b5d1
             size of \em Exif.Thumbnail.JPEGInterchangeFormat.
Packit Service 21b5d1
     */
Packit Service 21b5d1
    class TiffSizeEntry : public TiffEntryBase {
Packit Service 21b5d1
    public:
Packit Service 21b5d1
        //! @name Creators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Constructor
Packit Service 21b5d1
        TiffSizeEntry(uint16_t tag, IfdId group, uint16_t dtTag, IfdId dtGroup)
Packit Service 21b5d1
            : TiffEntryBase(tag, group), dtTag_(dtTag), dtGroup_(dtGroup) {}
Packit Service 21b5d1
        //! Virtual destructor.
Packit Service 21b5d1
        virtual ~TiffSizeEntry();
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Accessors
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Return the group of the related entry which has the data area
Packit Service 21b5d1
        uint16_t dtTag()   const { return dtTag_; }
Packit Service 21b5d1
        //! Return the group of the related entry which has the data area
Packit Service 21b5d1
        IfdId    dtGroup() const { return dtGroup_; }
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    protected:
Packit Service 21b5d1
        //! @name Protected Manipulators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        virtual void doAccept(TiffVisitor& visitor);
Packit Service 21b5d1
        virtual void doEncode(TiffEncoder& encoder, const Exifdatum* datum);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Protected Accessors
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        virtual TiffSizeEntry* doClone() const;
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    private:
Packit Service 21b5d1
        // DATA
Packit Service 21b5d1
        const uint16_t dtTag_;        //!< Tag of the entry with the data area
Packit Service 21b5d1
        const IfdId    dtGroup_;      //!< Group of the entry with the data area
Packit Service 21b5d1
Packit Service 21b5d1
    }; // class TiffSizeEntry
Packit Service 21b5d1
Packit Service 21b5d1
    /*!
Packit Service 21b5d1
      @brief This class models a TIFF directory (%Ifd). It is a composite
Packit Service 21b5d1
             component of the TIFF tree.
Packit Service 21b5d1
     */
Packit Service 21b5d1
    class TiffDirectory : public TiffComponent {
Packit Service 21b5d1
        friend class TiffEncoder;
Packit Service 21b5d1
    public:
Packit Service 21b5d1
        //! @name Creators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Default constructor
Packit Service 21b5d1
        TiffDirectory(uint16_t tag, IfdId group, bool hasNext =true)
Packit Service 21b5d1
            : TiffComponent(tag, group), hasNext_(hasNext), pNext_(0) {}
Packit Service 21b5d1
        //! Virtual destructor
Packit Service 21b5d1
        virtual ~TiffDirectory();
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Accessors
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Return true if the directory has a next pointer
Packit Service 21b5d1
        bool hasNext() const { return hasNext_; }
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    protected:
Packit Service 21b5d1
        //! @name Protected Creators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Copy constructor (used to implement clone()).
Packit Service 21b5d1
        TiffDirectory(const TiffDirectory& rhs);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Protected Manipulators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        virtual TiffComponent* doAddPath(uint16_t tag,
Packit Service 21b5d1
                                         TiffPath& tiffPath,
Packit Service 21b5d1
                                         TiffComponent* const pRoot,
Packit Service 21b5d1
                                         TiffComponent::AutoPtr object);
Packit Service 21b5d1
        virtual TiffComponent* doAddChild(TiffComponent::AutoPtr tiffComponent);
Packit Service 21b5d1
        virtual TiffComponent* doAddNext(TiffComponent::AutoPtr tiffComponent);
Packit Service 21b5d1
        virtual void doAccept(TiffVisitor& visitor);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Implements write(). Write the TIFF directory, values and
Packit Service 21b5d1
                 additional data, including the next-IFD, if any, to the
Packit Service 21b5d1
                 \em ioWrapper, return the number of bytes written.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual uint32_t doWrite(IoWrapper& ioWrapper,
Packit Service 21b5d1
                                 ByteOrder byteOrder,
Packit Service 21b5d1
                                 int32_t   offset,
Packit Service 21b5d1
                                 uint32_t  valueIdx,
Packit Service 21b5d1
                                 uint32_t  dataIdx,
Packit Service 21b5d1
                                 uint32_t& imageIdx);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Protected Accessors
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        virtual TiffDirectory* doClone() const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief This class does not really implement writeData(), it only has
Packit Service 21b5d1
                 write(). This method must not be called; it commits suicide.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual uint32_t doWriteData(IoWrapper& ioWrapper,
Packit Service 21b5d1
                                     ByteOrder byteOrder,
Packit Service 21b5d1
                                     int32_t   offset,
Packit Service 21b5d1
                                     uint32_t  dataIdx,
Packit Service 21b5d1
                                     uint32_t& imageIdx) const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Implements writeImage(). Write the image data of the TIFF
Packit Service 21b5d1
                 directory to the \em ioWrapper by forwarding the call to each
Packit Service 21b5d1
                 component as well as the next-IFD, if there is any. Return the
Packit Service 21b5d1
                 number of bytes written.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual uint32_t doWriteImage(IoWrapper& ioWrapper,
Packit Service 21b5d1
                                      ByteOrder byteOrder) const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Implements size(). Return the size of the TIFF directory,
Packit Service 21b5d1
                 values and additional data, including the next-IFD, if any.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual uint32_t doSize() const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Implements count(). Return the number of entries in the TIFF
Packit Service 21b5d1
                 directory. Does not count entries which are marked as deleted.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual uint32_t doCount() const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief This class does not really implement sizeData(), it only has
Packit Service 21b5d1
                 size(). This method must not be called; it commits suicide.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual uint32_t doSizeData() const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Implements sizeImage(). Return the sum of the image sizes of
Packit Service 21b5d1
                 all components plus that of the next-IFD, if there is any.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual uint32_t doSizeImage() const;
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    private:
Packit Service 21b5d1
        //! @name NOT implemented
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Assignment operator.
Packit Service 21b5d1
        TiffDirectory& operator=(const TiffDirectory& rhs);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Private Accessors
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Write a binary directory entry for a TIFF component.
Packit Service 21b5d1
        uint32_t writeDirEntry(IoWrapper&     ioWrapper,
Packit Service 21b5d1
                               ByteOrder      byteOrder,
Packit Service 21b5d1
                               int32_t        offset,
Packit Service 21b5d1
                               TiffComponent* pTiffComponent,
Packit Service 21b5d1
                               uint32_t       valueIdx,
Packit Service 21b5d1
                               uint32_t       dataIdx,
Packit Service 21b5d1
                               uint32_t&      imageIdx) const;
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    private:
Packit Service 21b5d1
        // DATA
Packit Service 21b5d1
        Components components_; //!< List of components in this directory
Packit Service 21b5d1
        const bool hasNext_;    //!< True if the directory has a next pointer
Packit Service 21b5d1
        TiffComponent* pNext_;  //!< Pointer to the next IFD
Packit Service 21b5d1
Packit Service 21b5d1
    }; // class TiffDirectory
Packit Service 21b5d1
Packit Service 21b5d1
    /*!
Packit Service 21b5d1
      @brief This class models a TIFF sub-directory (sub-IFD). A sub-IFD
Packit Service 21b5d1
             is an entry with one or more values that are pointers to IFD
Packit Service 21b5d1
             structures containing an IFD. The TIFF standard defines
Packit Service 21b5d1
             some important tags to be sub-IFDs, including the %Exif and
Packit Service 21b5d1
             GPS tags.
Packit Service 21b5d1
     */
Packit Service 21b5d1
    class TiffSubIfd : public TiffEntryBase {
Packit Service 21b5d1
        friend class TiffReader;
Packit Service 21b5d1
    public:
Packit Service 21b5d1
        //! @name Creators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Default constructor
Packit Service 21b5d1
        TiffSubIfd(uint16_t tag, IfdId group, IfdId newGroup);
Packit Service 21b5d1
        //! Virtual destructor
Packit Service 21b5d1
        virtual ~TiffSubIfd();
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    protected:
Packit Service 21b5d1
        //! @name Protected Creators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Copy constructor (used to implement clone()).
Packit Service 21b5d1
        TiffSubIfd(const TiffSubIfd& rhs);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Protected Manipulators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        virtual TiffComponent* doAddPath(uint16_t tag,
Packit Service 21b5d1
                                         TiffPath& tiffPath,
Packit Service 21b5d1
                                         TiffComponent* const pRoot,
Packit Service 21b5d1
                                         TiffComponent::AutoPtr object);
Packit Service 21b5d1
        virtual TiffComponent* doAddChild(TiffComponent::AutoPtr tiffComponent);
Packit Service 21b5d1
        virtual void doAccept(TiffVisitor& visitor);
Packit Service 21b5d1
        virtual void doEncode(TiffEncoder& encoder, const Exifdatum* datum);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Implements write(). Write the sub-IFD pointers to the \em ioWrapper,
Packit Service 21b5d1
                 return the number of bytes written. The \em valueIdx and
Packit Service 21b5d1
                 \em imageIdx arguments are not used.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual uint32_t doWrite(IoWrapper& ioWrapper,
Packit Service 21b5d1
                                 ByteOrder byteOrder,
Packit Service 21b5d1
                                 int32_t   offset,
Packit Service 21b5d1
                                 uint32_t  valueIdx,
Packit Service 21b5d1
                                 uint32_t  dataIdx,
Packit Service 21b5d1
                                 uint32_t& imageIdx);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Protected Accessors
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        virtual TiffSubIfd* doClone() const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Implements writeData(). Write the sub-IFDs to the \em ioWrapper.
Packit Service 21b5d1
                 Return the number of bytes written.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual uint32_t doWriteData(IoWrapper& ioWrapper,
Packit Service 21b5d1
                                     ByteOrder byteOrder,
Packit Service 21b5d1
                                     int32_t   offset,
Packit Service 21b5d1
                                     uint32_t  dataIdx,
Packit Service 21b5d1
                                     uint32_t& imageIdx) const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Implements writeImage(). Write the image data of each sub-IFD to
Packit Service 21b5d1
                 the \em ioWrapper. Return the number of bytes written.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual uint32_t doWriteImage(IoWrapper& ioWrapper,
Packit Service 21b5d1
                                      ByteOrder byteOrder) const;
Packit Service 21b5d1
        //! Implements size(). Return the size of the sub-Ifd pointers.
Packit Service 21b5d1
        uint32_t doSize() const;
Packit Service 21b5d1
        //! Implements sizeData(). Return the sum of the sizes of all sub-IFDs.
Packit Service 21b5d1
        virtual uint32_t doSizeData() const;
Packit Service 21b5d1
        //! Implements sizeImage(). Return the sum of the image sizes of all sub-IFDs.
Packit Service 21b5d1
        virtual uint32_t doSizeImage() const;
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    private:
Packit Service 21b5d1
        //! @name NOT implemented
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Assignment operator.
Packit Service 21b5d1
        TiffSubIfd& operator=(const TiffSubIfd& rhs);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! A collection of TIFF directories (IFDs)
Packit Service 21b5d1
        typedef std::vector<TiffDirectory*> Ifds;
Packit Service 21b5d1
Packit Service 21b5d1
        // DATA
Packit Service 21b5d1
        IfdId    newGroup_; //!< Start of the range of group numbers for the sub-IFDs
Packit Service 21b5d1
        Ifds     ifds_;     //!< The subdirectories
Packit Service 21b5d1
Packit Service 21b5d1
    }; // class TiffSubIfd
Packit Service 21b5d1
Packit Service 21b5d1
    /*!
Packit Service 21b5d1
      @brief This class is the basis for Makernote support in TIFF. It contains
Packit Service 21b5d1
             a pointer to a concrete Makernote. The TiffReader visitor has the
Packit Service 21b5d1
             responsibility to create the correct Make/Model specific Makernote
Packit Service 21b5d1
             for a particular TIFF file. Calls to child management methods are
Packit Service 21b5d1
             forwarded to the concrete Makernote, if there is one.
Packit Service 21b5d1
     */
Packit Service 21b5d1
    class TiffMnEntry : public TiffEntryBase {
Packit Service 21b5d1
        friend class TiffReader;
Packit Service 21b5d1
        friend class TiffDecoder;
Packit Service 21b5d1
        friend class TiffEncoder;
Packit Service 21b5d1
    public:
Packit Service 21b5d1
        //! @name Creators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Default constructor
Packit Service 21b5d1
        TiffMnEntry(uint16_t tag, IfdId group, IfdId mnGroup);
Packit Service 21b5d1
        //! Virtual destructor
Packit Service 21b5d1
        virtual ~TiffMnEntry();
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    protected:
Packit Service 21b5d1
        //! @name Protected Manipulators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        virtual TiffComponent* doAddPath(uint16_t tag,
Packit Service 21b5d1
                                         TiffPath& tiffPath,
Packit Service 21b5d1
                                         TiffComponent* const pRoot,
Packit Service 21b5d1
                                         TiffComponent::AutoPtr object);
Packit Service 21b5d1
        virtual TiffComponent* doAddChild(TiffComponent::AutoPtr tiffComponent);
Packit Service 21b5d1
        virtual TiffComponent* doAddNext(TiffComponent::AutoPtr tiffComponent);
Packit Service 21b5d1
        virtual void doAccept(TiffVisitor& visitor);
Packit Service 21b5d1
        virtual void doEncode(TiffEncoder& encoder, const Exifdatum* datum);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Implements write() by forwarding the call to the actual
Packit Service 21b5d1
                 concrete Makernote, if there is one.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual uint32_t doWrite(IoWrapper& ioWrapper,
Packit Service 21b5d1
                                 ByteOrder byteOrder,
Packit Service 21b5d1
                                 int32_t   offset,
Packit Service 21b5d1
                                 uint32_t  valueIdx,
Packit Service 21b5d1
                                 uint32_t  dataIdx,
Packit Service 21b5d1
                                 uint32_t& imageIdx);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Protected Accessors
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        virtual TiffMnEntry* doClone() const;
Packit Service 21b5d1
        //! Implements count(). Return number of components in the entry.
Packit Service 21b5d1
        virtual uint32_t doCount() const;
Packit Service 21b5d1
        // Using doWriteData from base class
Packit Service 21b5d1
        // Using doWriteImage from base class
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Implements size() by forwarding the call to the actual
Packit Service 21b5d1
                 concrete Makernote, if there is one.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual uint32_t doSize() const;
Packit Service 21b5d1
        // Using doSizeData from base class
Packit Service 21b5d1
        // Using doSizeImage from base class
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    private:
Packit Service 21b5d1
        //! @name NOT implemented
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Copy constructor.
Packit Service 21b5d1
        TiffMnEntry(const TiffMnEntry& rhs);
Packit Service 21b5d1
        //! Assignment operator.
Packit Service 21b5d1
        TiffMnEntry& operator=(const TiffMnEntry& rhs);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        // DATA
Packit Service 21b5d1
        IfdId          mnGroup_;             //!< New group for concrete mn
Packit Service 21b5d1
        TiffComponent* mn_;                  //!< The Makernote
Packit Service 21b5d1
Packit Service 21b5d1
    }; // class TiffMnEntry
Packit Service 21b5d1
Packit Service 21b5d1
    /*!
Packit Service 21b5d1
      @brief Tiff IFD Makernote. This is a concrete class suitable for all
Packit Service 21b5d1
             IFD makernotes.
Packit Service 21b5d1
Packit Service 21b5d1
             Contains a makernote header (which can be 0) and an IFD and
Packit Service 21b5d1
             implements child mgmt functions to deal with the IFD entries. The
Packit Service 21b5d1
             various makernote weirdnesses are taken care of in the makernote
Packit Service 21b5d1
             header (and possibly in special purpose IFD entries).
Packit Service 21b5d1
     */
Packit Service 21b5d1
    class TiffIfdMakernote : public TiffComponent {
Packit Service 21b5d1
        friend class TiffReader;
Packit Service 21b5d1
    public:
Packit Service 21b5d1
        //! @name Creators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Default constructor
Packit Service 21b5d1
        TiffIfdMakernote(uint16_t  tag,
Packit Service 21b5d1
                         IfdId     group,
Packit Service 21b5d1
                         IfdId     mnGroup,
Packit Service 21b5d1
                         MnHeader* pHeader,
Packit Service 21b5d1
                         bool      hasNext =true);
Packit Service 21b5d1
        //! Virtual destructor
Packit Service 21b5d1
        virtual ~TiffIfdMakernote();
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Manipulators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Read the header from a data buffer, return true if successful.
Packit Service 21b5d1
Packit Service 21b5d1
          The default implementation simply returns true.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        bool readHeader(const byte* pData, uint32_t size, ByteOrder byteOrder);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Set the byte order for the makernote.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        void setByteOrder(ByteOrder byteOrder);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Set the byte order used for the image.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        void setImageByteOrder(ByteOrder byteOrder) { imageByteOrder_ = byteOrder; }
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Accessors
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Return the size of the header in bytes.
Packit Service 21b5d1
        uint32_t sizeHeader() const;
Packit Service 21b5d1
        //! Write the header to a data buffer, return the number of bytes written.
Packit Service 21b5d1
        uint32_t writeHeader(IoWrapper& ioWrapper, ByteOrder byteOrder) const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Return the offset to the makernote from the start of the
Packit Service 21b5d1
                 TIFF header.
Packit Service 21b5d1
        */
Packit Service 21b5d1
        uint32_t mnOffset() const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Return the offset to the start of the Makernote IFD from
Packit Service 21b5d1
                 the start of the Makernote.
Packit Service 21b5d1
                 Returns 0 if there is no header.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        uint32_t ifdOffset() const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Return the byte order for the makernote. Requires the image
Packit Service 21b5d1
                 byte order to be set (setImageByteOrder()).  Returns the byte
Packit Service 21b5d1
                 order for the image if there is no header or the byte order for
Packit Service 21b5d1
                 the header is \c invalidByteOrder.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        ByteOrder byteOrder() const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Return the byte order used for the image.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        ByteOrder imageByteOrder() const { return imageByteOrder_; }
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Return the base offset for use with the makernote IFD entries
Packit Service 21b5d1
                 relative to the start of the TIFF header.
Packit Service 21b5d1
                 Returns 0 if there is no header.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        uint32_t baseOffset() const;
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    protected:
Packit Service 21b5d1
        //! @name Protected Manipulators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        virtual TiffComponent* doAddPath(uint16_t tag,
Packit Service 21b5d1
                                         TiffPath& tiffPath,
Packit Service 21b5d1
                                         TiffComponent* const pRoot,
Packit Service 21b5d1
                                         TiffComponent::AutoPtr object);
Packit Service 21b5d1
        virtual TiffComponent* doAddChild(TiffComponent::AutoPtr tiffComponent);
Packit Service 21b5d1
        virtual TiffComponent* doAddNext(TiffComponent::AutoPtr tiffComponent);
Packit Service 21b5d1
        virtual void doAccept(TiffVisitor& visitor);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Implements write(). Write the Makernote header, TIFF directory,
Packit Service 21b5d1
                 values and additional data to the \em ioWrapper, return the
Packit Service 21b5d1
                 number of bytes written.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual uint32_t doWrite(IoWrapper& ioWrapper,
Packit Service 21b5d1
                                 ByteOrder byteOrder,
Packit Service 21b5d1
                                 int32_t   offset,
Packit Service 21b5d1
                                 uint32_t  valueIdx,
Packit Service 21b5d1
                                 uint32_t  dataIdx,
Packit Service 21b5d1
                                 uint32_t& imageIdx);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Protected Accessors
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        virtual TiffIfdMakernote* doClone() const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief This class does not really implement writeData(), it only has
Packit Service 21b5d1
                 write(). This method must not be called; it commits suicide.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual uint32_t doWriteData(IoWrapper& ioWrapper,
Packit Service 21b5d1
                                     ByteOrder byteOrder,
Packit Service 21b5d1
                                     int32_t   offset,
Packit Service 21b5d1
                                     uint32_t  dataIdx,
Packit Service 21b5d1
                                     uint32_t& imageIdx) const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Implements writeImage(). Write the image data of the IFD of
Packit Service 21b5d1
                 the Makernote. Return the number of bytes written.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual uint32_t doWriteImage(IoWrapper& ioWrapper,
Packit Service 21b5d1
                                      ByteOrder byteOrder) const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Implements size(). Return the size of the Makernote header,
Packit Service 21b5d1
                 TIFF directory, values and additional data.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual uint32_t doSize() const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Implements count(). Return the number of entries in the IFD
Packit Service 21b5d1
                 of the Makernote. Does not count entries which are marked as
Packit Service 21b5d1
                 deleted.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual uint32_t doCount() const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief This class does not really implement sizeData(), it only has
Packit Service 21b5d1
                 size(). This method must not be called; it commits suicide.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual uint32_t doSizeData() const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Implements sizeImage(). Return the total image data size of the
Packit Service 21b5d1
                 makernote IFD.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual uint32_t doSizeImage() const;
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    private:
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @name NOT implemented
Packit Service 21b5d1
Packit Service 21b5d1
          Implementing the copy constructor and assignment operator will require
Packit Service 21b5d1
          cloning the header, i.e., clone() functionality on the MnHeader
Packit Service 21b5d1
          hierarchy.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Copy constructor.
Packit Service 21b5d1
        TiffIfdMakernote(const TiffIfdMakernote& rhs);
Packit Service 21b5d1
        //! Assignment operator.
Packit Service 21b5d1
        TiffIfdMakernote& operator=(const TiffIfdMakernote& rhs);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        // DATA
Packit Service 21b5d1
        MnHeader*     pHeader_;                 //!< Makernote header
Packit Service 21b5d1
        TiffDirectory ifd_;                     //!< Makernote IFD
Packit Service 21b5d1
        uint32_t      mnOffset_;                //!< Makernote offset
Packit Service 21b5d1
        ByteOrder     imageByteOrder_;          //!< Byte order for the image
Packit Service 21b5d1
Packit Service 21b5d1
    }; // class TiffIfdMakernote
Packit Service 21b5d1
Packit Service 21b5d1
    /*!
Packit Service 21b5d1
      @brief Function pointer type for a function to determine which cfg + def
Packit Service 21b5d1
             of a corresponding array set to use.
Packit Service 21b5d1
     */
Packit Service 21b5d1
    typedef int (*CfgSelFct)(uint16_t, const byte*, uint32_t, TiffComponent* const);
Packit Service 21b5d1
Packit Service 21b5d1
    //! Function pointer type for a crypt function used for binary arrays.
Packit Service 21b5d1
    typedef DataBuf (*CryptFct)(uint16_t, const byte*, uint32_t, TiffComponent* const);
Packit Service 21b5d1
Packit Service 21b5d1
    //! Defines one tag in a binary array
Packit Service 21b5d1
    struct ArrayDef {
Packit Service 21b5d1
        //! Comparison with idx
Packit Service 21b5d1
        bool operator==(uint32_t idx) const { return idx_ == idx; }
Packit Service 21b5d1
        //! Get the size in bytes of a tag.
Packit Service 21b5d1
        uint32_t size(uint16_t tag, IfdId group) const;
Packit Service 21b5d1
        // DATA
Packit Service 21b5d1
        uint32_t idx_;             //!< Index in bytes from the start
Packit Service 21b5d1
        TiffType tiffType_;        //!< TIFF type of the element
Packit Service 21b5d1
        uint32_t count_;           //!< Number of components
Packit Service 21b5d1
    };
Packit Service 21b5d1
Packit Service 21b5d1
    //! Additional configuration for a binary array.
Packit Service 21b5d1
    struct ArrayCfg {
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Return the size of the default tag, which is used
Packit Service 21b5d1
                 to calculate tag numbers as idx/tagStep
Packit Service 21b5d1
         */
Packit Service 21b5d1
        uint32_t tagStep() const { return elDefaultDef_.size(0, group_); }
Packit Service 21b5d1
        //DATA
Packit Service 21b5d1
        IfdId       group_;        //!< Group for the elements
Packit Service 21b5d1
        ByteOrder   byteOrder_;    //!< Byte order, invalidByteOrder to inherit
Packit Service 21b5d1
        TiffType    elTiffType_;   //!< Type for the array entry and the size element, if any
Packit Service 21b5d1
        CryptFct    cryptFct_;     //!< Crypt function, 0 if not used
Packit Service 21b5d1
        bool        hasSize_;      //!< If true, first tag is the size element
Packit Service 21b5d1
        bool        hasFillers_;   //!< If true, write all defined tags
Packit Service 21b5d1
        bool        concat_;       //!< If true, concatenate gaps between defined tags to single tags
Packit Service 21b5d1
        ArrayDef    elDefaultDef_; //!< Default element
Packit Service 21b5d1
    };
Packit Service 21b5d1
Packit Service 21b5d1
    //! Combination of array configuration and definition for arrays
Packit Service 21b5d1
    struct ArraySet {
Packit Service 21b5d1
        const ArrayCfg  cfg_;      //!< Binary array configuration
Packit Service 21b5d1
        const ArrayDef* def_;      //!< Binary array definition array
Packit Service 21b5d1
        const int       defSize_;  //!< Size of the array definition array
Packit Service 21b5d1
    };
Packit Service 21b5d1
Packit Service 21b5d1
    /*!
Packit Service 21b5d1
      @brief Composite to model an array of different tags. The tag types as well
Packit Service 21b5d1
             as other aspects of the array are configurable. The elements of this
Packit Service 21b5d1
             component are of type TiffBinaryElement.
Packit Service 21b5d1
     */
Packit Service 21b5d1
    class TiffBinaryArray : public TiffEntryBase {
Packit Service 21b5d1
    public:
Packit Service 21b5d1
        //! @name Creators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Constructor
Packit Service 21b5d1
        TiffBinaryArray(uint16_t tag,
Packit Service 21b5d1
                        IfdId group,
Packit Service 21b5d1
                        const ArrayCfg* arrayCfg,
Packit Service 21b5d1
                        const ArrayDef* arrayDef,
Packit Service 21b5d1
                        int defSize);
Packit Service 21b5d1
        //! Constructor for a complex binary array
Packit Service 21b5d1
        TiffBinaryArray(uint16_t tag,
Packit Service 21b5d1
                        IfdId group,
Packit Service 21b5d1
                        const ArraySet* arraySet,
Packit Service 21b5d1
                        int setSize,
Packit Service 21b5d1
                        CfgSelFct cfgSelFct);
Packit Service 21b5d1
        //! Virtual destructor
Packit Service 21b5d1
        virtual ~TiffBinaryArray();
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Manipulators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Add an element to the binary array, return the size of the element
Packit Service 21b5d1
        uint32_t addElement(uint32_t idx, const ArrayDef& def);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Setup cfg and def for the component, in case of a complex binary array.
Packit Service 21b5d1
                 Else do nothing. Return true if the initialization succeeded, else false.
Packit Service 21b5d1
Packit Service 21b5d1
          This version of initialize() is used during intrusive writing. It determines the
Packit Service 21b5d1
          correct settings based on the \em group passed in (which is the group of the first
Packit Service 21b5d1
          tag that is added to the array). It doesn't require cfgSelFct_.
Packit Service 21b5d1
Packit Service 21b5d1
          @param group Group to setup the binary array for.
Packit Service 21b5d1
          @return true if the initialization succeeded, else false.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        bool initialize(IfdId group);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Setup cfg and def for the component, in case of a complex binary array.
Packit Service 21b5d1
                 Else do nothing. Return true if the initialization succeeded, else false.
Packit Service 21b5d1
Packit Service 21b5d1
          This version of initialize() is used for reading and non-intrusive writing. It
Packit Service 21b5d1
          calls cfgSelFct_ to determine the correct settings.
Packit Service 21b5d1
Packit Service 21b5d1
          @param pRoot Pointer to the root component of the TIFF tree.
Packit Service 21b5d1
          @return true if the initialization succeeded, else false.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        bool initialize(TiffComponent* const pRoot);
Packit Service 21b5d1
        //! Initialize the original data buffer and its size from the base entry.
Packit Service 21b5d1
        void iniOrigDataBuf();
Packit Service 21b5d1
        //! Update the original data buffer and its size, return true if successful.
Packit Service 21b5d1
        bool updOrigDataBuf(const byte* pData, uint32_t size);
Packit Service 21b5d1
        //! Set a flag to indicate if the array was decoded
Packit Service 21b5d1
        void setDecoded(bool decoded) { decoded_ = decoded; }
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Accessors
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Return a pointer to the configuration
Packit Service 21b5d1
        const ArrayCfg* cfg() const { return arrayCfg_; }
Packit Service 21b5d1
        //! Return a pointer to the definition
Packit Service 21b5d1
        const ArrayDef* def() const { return arrayDef_; }
Packit Service 21b5d1
        //! Return the number of elements in the definition
Packit Service 21b5d1
        int defSize() const { return defSize_; }
Packit Service 21b5d1
        //! Return the flag which indicates if the array was decoded
Packit Service 21b5d1
        bool decoded() const { return decoded_; }
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    protected:
Packit Service 21b5d1
        //! @name Protected Creators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Copy constructor (used to implement clone()).
Packit Service 21b5d1
        TiffBinaryArray(const TiffBinaryArray& rhs);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Protected Manipulators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Implements addPath(). Todo: Document it!
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual TiffComponent* doAddPath(uint16_t tag,
Packit Service 21b5d1
                                         TiffPath& tiffPath,
Packit Service 21b5d1
                                         TiffComponent* const pRoot,
Packit Service 21b5d1
                                         TiffComponent::AutoPtr object);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Implements addChild(). Todo: Document it!
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual TiffComponent* doAddChild(TiffComponent::AutoPtr tiffComponent);
Packit Service 21b5d1
        virtual void doAccept(TiffVisitor& visitor);
Packit Service 21b5d1
        virtual void doEncode(TiffEncoder& encoder, const Exifdatum* datum);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Implements write(). Todo: Document it!
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual uint32_t doWrite(IoWrapper& ioWrapper,
Packit Service 21b5d1
                                 ByteOrder byteOrder,
Packit Service 21b5d1
                                 int32_t   offset,
Packit Service 21b5d1
                                 uint32_t  valueIdx,
Packit Service 21b5d1
                                 uint32_t  dataIdx,
Packit Service 21b5d1
                                 uint32_t& imageIdx);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Protected Accessors
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        virtual TiffBinaryArray* doClone() const;
Packit Service 21b5d1
        //! Implements count(). Todo: Document it!
Packit Service 21b5d1
        virtual uint32_t doCount() const;
Packit Service 21b5d1
        // Using doWriteData from base class
Packit Service 21b5d1
        // Using doWriteImage from base class
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Implements size(). Todo: Document it!
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual uint32_t doSize() const;
Packit Service 21b5d1
        // Using doSizeData from base class
Packit Service 21b5d1
        // Using doSizeImage from base class
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    private:
Packit Service 21b5d1
        //! @name NOT implemented
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Assignment operator.
Packit Service 21b5d1
        TiffBinaryArray& operator=(const TiffBinaryArray& rhs);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        // DATA
Packit Service 21b5d1
        const CfgSelFct cfgSelFct_; //!< Pointer to a function to determine which cfg to use (may be 0)
Packit Service 21b5d1
        const ArraySet* arraySet_;  //!< Pointer to the array set, if any (may be 0)
Packit Service 21b5d1
        const ArrayCfg* arrayCfg_;  //!< Pointer to the array configuration (must not be 0, except for unrecognized complex binary arrays)
Packit Service 21b5d1
        const ArrayDef* arrayDef_;  //!< Pointer to the array definition (may be 0)
Packit Service 21b5d1
        int defSize_;               //!< Size of the array definition array (may be 0)
Packit Service 21b5d1
        int setSize_;               //!< Size of the array set (may be 0)
Packit Service 21b5d1
        Components elements_;       //!< List of elements in this composite
Packit Service 21b5d1
        byte* origData_;            //!< Pointer to the original data buffer (unencrypted)
Packit Service 21b5d1
        uint32_t origSize_;         //!< Size of the original data buffer
Packit Service 21b5d1
        TiffComponent* pRoot_;      //!< Pointer to the root component of the TIFF tree. (Only used for intrusive writing.)
Packit Service 21b5d1
        bool decoded_;              //!< Flag to indicate if the array was decoded
Packit Service 21b5d1
    }; // class TiffBinaryArray
Packit Service 21b5d1
Packit Service 21b5d1
    /*!
Packit Service 21b5d1
      @brief Element of a TiffBinaryArray.
Packit Service 21b5d1
     */
Packit Service 21b5d1
    class TiffBinaryElement : public TiffEntryBase {
Packit Service 21b5d1
    public:
Packit Service 21b5d1
        //! @name Creators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Constructor
Packit Service 21b5d1
        TiffBinaryElement(uint16_t tag, IfdId group);
Packit Service 21b5d1
        //! Virtual destructor.
Packit Service 21b5d1
        virtual ~TiffBinaryElement();
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Manipulators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Set the array definition for this element.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        void setElDef(const ArrayDef& def) { elDef_ = def; }
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Set the byte order of this element.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        void setElByteOrder(ByteOrder byteOrder) { elByteOrder_ = byteOrder; }
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Accessors
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Return the array definition of this element.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        const ArrayDef* elDef()       const { return &elDef_; }
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Return the byte order of this element.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        ByteOrder       elByteOrder() const { return elByteOrder_; }
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    protected:
Packit Service 21b5d1
        //! @name Protected Manipulators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        virtual void doAccept(TiffVisitor& visitor);
Packit Service 21b5d1
        virtual void doEncode(TiffEncoder& encoder, const Exifdatum* datum);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Implements write(). Todo: Document it!
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual uint32_t doWrite(IoWrapper& ioWrapper,
Packit Service 21b5d1
                                 ByteOrder byteOrder,
Packit Service 21b5d1
                                 int32_t   offset,
Packit Service 21b5d1
                                 uint32_t  valueIdx,
Packit Service 21b5d1
                                 uint32_t  dataIdx,
Packit Service 21b5d1
                                 uint32_t& imageIdx);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Protected Accessors
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        virtual TiffBinaryElement* doClone() const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Implements count(). Returns the count from the element definition.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual uint32_t doCount() const;
Packit Service 21b5d1
        // Using doWriteData from base class
Packit Service 21b5d1
        // Using doWriteImage from base class
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Implements size(). Returns count * type-size, both taken from
Packit Service 21b5d1
                 the element definition.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        virtual uint32_t doSize() const;
Packit Service 21b5d1
        // Using doSizeData from base class
Packit Service 21b5d1
        // Using doSizeImage from base class
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    private:
Packit Service 21b5d1
        // DATA
Packit Service 21b5d1
        ArrayDef  elDef_;        //!< The array element definition
Packit Service 21b5d1
        ByteOrder elByteOrder_;  //!< Byte order to read/write the element
Packit Service 21b5d1
Packit Service 21b5d1
    }; // class TiffBinaryElement
Packit Service 21b5d1
Packit Service 21b5d1
// *****************************************************************************
Packit Service 21b5d1
// template, inline and free functions
Packit Service 21b5d1
Packit Service 21b5d1
    /*!
Packit Service 21b5d1
      @brief Compare two TIFF component pointers by tag. Return true if the tag
Packit Service 21b5d1
             of component lhs is less than that of rhs.
Packit Service 21b5d1
     */
Packit Service 21b5d1
    bool cmpTagLt(TiffComponent const* lhs, TiffComponent const* rhs);
Packit Service 21b5d1
Packit Service 21b5d1
    /*!
Packit Service 21b5d1
      @brief Compare two TIFF component pointers by group. Return true if the
Packit Service 21b5d1
             group of component lhs is less than that of rhs.
Packit Service 21b5d1
     */
Packit Service 21b5d1
    bool cmpGroupLt(TiffComponent const* lhs, TiffComponent const* rhs);
Packit Service 21b5d1
Packit Service 21b5d1
    //! Function to create and initialize a new TIFF entry
Packit Service 21b5d1
    TiffComponent::AutoPtr newTiffEntry(uint16_t tag, IfdId group);
Packit Service 21b5d1
Packit Service 21b5d1
    //! Function to create and initialize a new TIFF makernote entry
Packit Service 21b5d1
    TiffComponent::AutoPtr newTiffMnEntry(uint16_t tag, IfdId group);
Packit Service 21b5d1
Packit Service 21b5d1
    //! Function to create and initialize a new binary array element
Packit Service 21b5d1
    TiffComponent::AutoPtr newTiffBinaryElement(uint16_t tag, IfdId group);
Packit Service 21b5d1
Packit Service 21b5d1
    //! Function to create and initialize a new TIFF directory
Packit Service 21b5d1
    template<IfdId newGroup>
Packit Service 21b5d1
    TiffComponent::AutoPtr newTiffDirectory(uint16_t tag, IfdId /*group*/)
Packit Service 21b5d1
    {
Packit Service 21b5d1
        return TiffComponent::AutoPtr(new TiffDirectory(tag, newGroup));
Packit Service 21b5d1
    }
Packit Service 21b5d1
Packit Service 21b5d1
    //! Function to create and initialize a new TIFF sub-directory
Packit Service 21b5d1
    template<IfdId newGroup>
Packit Service 21b5d1
    TiffComponent::AutoPtr newTiffSubIfd(uint16_t tag, IfdId group)
Packit Service 21b5d1
    {
Packit Service 21b5d1
        return TiffComponent::AutoPtr(new TiffSubIfd(tag, group, newGroup));
Packit Service 21b5d1
    }
Packit Service 21b5d1
Packit Service 21b5d1
    //! Function to create and initialize a new binary array entry
Packit Service 21b5d1
    template<const ArrayCfg* arrayCfg, int N, const ArrayDef (&arrayDef)[N]>
Packit Service 21b5d1
    TiffComponent::AutoPtr newTiffBinaryArray0(uint16_t tag, IfdId group)
Packit Service 21b5d1
    {
Packit Service 21b5d1
        // *& acrobatics is a workaround for a MSVC 7.1 bug
Packit Service 21b5d1
        return TiffComponent::AutoPtr(
Packit Service 21b5d1
            new TiffBinaryArray(tag, group, arrayCfg, *(&arrayDef), N));
Packit Service 21b5d1
    }
Packit Service 21b5d1
Packit Service 21b5d1
    //! Function to create and initialize a new simple binary array entry
Packit Service 21b5d1
    template<const ArrayCfg* arrayCfg>
Packit Service 21b5d1
    TiffComponent::AutoPtr newTiffBinaryArray1(uint16_t tag, IfdId group)
Packit Service 21b5d1
    {
Packit Service 21b5d1
        return TiffComponent::AutoPtr(
Packit Service 21b5d1
            new TiffBinaryArray(tag, group, arrayCfg, 0, 0));
Packit Service 21b5d1
    }
Packit Service 21b5d1
Packit Service 21b5d1
    //! Function to create and initialize a new complex binary array entry
Packit Service 21b5d1
    template<const ArraySet* arraySet, int N, CfgSelFct cfgSelFct>
Packit Service 21b5d1
    TiffComponent::AutoPtr newTiffBinaryArray2(uint16_t tag, IfdId group)
Packit Service 21b5d1
    {
Packit Service 21b5d1
        return TiffComponent::AutoPtr(
Packit Service 21b5d1
            new TiffBinaryArray(tag, group, arraySet, N, cfgSelFct));
Packit Service 21b5d1
    }
Packit Service 21b5d1
Packit Service 21b5d1
    //! Function to create and initialize a new TIFF entry for a thumbnail (data)
Packit Service 21b5d1
    template<uint16_t szTag, IfdId szGroup>
Packit Service 21b5d1
    TiffComponent::AutoPtr newTiffThumbData(uint16_t tag, IfdId group)
Packit Service 21b5d1
    {
Packit Service 21b5d1
        return TiffComponent::AutoPtr(
Packit Service 21b5d1
            new TiffDataEntry(tag, group, szTag, szGroup));
Packit Service 21b5d1
    }
Packit Service 21b5d1
Packit Service 21b5d1
    //! Function to create and initialize a new TIFF entry for a thumbnail (size)
Packit Service 21b5d1
    template<uint16_t dtTag, IfdId dtGroup>
Packit Service 21b5d1
    TiffComponent::AutoPtr newTiffThumbSize(uint16_t tag, IfdId group)
Packit Service 21b5d1
    {
Packit Service 21b5d1
        return TiffComponent::AutoPtr(
Packit Service 21b5d1
            new TiffSizeEntry(tag, group, dtTag, dtGroup));
Packit Service 21b5d1
    }
Packit Service 21b5d1
Packit Service 21b5d1
    //! Function to create and initialize a new TIFF entry for image data
Packit Service 21b5d1
    template<uint16_t szTag, IfdId szGroup>
Packit Service 21b5d1
    TiffComponent::AutoPtr newTiffImageData(uint16_t tag, IfdId group)
Packit Service 21b5d1
    {
Packit Service 21b5d1
        return TiffComponent::AutoPtr(
Packit Service 21b5d1
            new TiffImageEntry(tag, group, szTag, szGroup));
Packit Service 21b5d1
    }
Packit Service 21b5d1
Packit Service 21b5d1
    //! Function to create and initialize a new TIFF entry for image data (size)
Packit Service 21b5d1
    template<uint16_t dtTag, IfdId dtGroup>
Packit Service 21b5d1
    TiffComponent::AutoPtr newTiffImageSize(uint16_t tag, IfdId group)
Packit Service 21b5d1
    {
Packit Service 21b5d1
        // Todo: Same as newTiffThumbSize - consolidate (rename)?
Packit Service 21b5d1
        return TiffComponent::AutoPtr(
Packit Service 21b5d1
            new TiffSizeEntry(tag, group, dtTag, dtGroup));
Packit Service 21b5d1
    }
Packit Service 21b5d1
Packit Service 21b5d1
}}                                      // namespace Internal, Exiv2
Packit Service 21b5d1
Packit Service 21b5d1
#endif                                  // #ifndef TIFFCOMPOSITE_INT_HPP_