// SPDX-License-Identifier: GPL-2.0-or-later #ifndef MAKERNOTE_INT_HPP_ #define MAKERNOTE_INT_HPP_ // ***************************************************************************** // included header files #include "tags_int.hpp" #include "types.hpp" // namespace extensions namespace Exiv2::Internal { class IoWrapper; class TiffComponent; // ***************************************************************************** // function prototypes /*! @brief Determine the path to the Exiv2 configuration file */ std::string getExiv2ConfigPath(); /*! @brief Read value from Exiv2 configuration file */ std::string readExiv2Config(const std::string& section, const std::string& value, const std::string& def); // ***************************************************************************** // class definitions //! Type for a pointer to a function creating a makernote (image) using NewMnFct = TiffComponent* (*)(uint16_t tag, IfdId group, IfdId mnGroup, const byte* pData, size_t size, ByteOrder byteOrder); //! Type for a pointer to a function creating a makernote (group) using NewMnFct2 = TiffComponent* (*)(uint16_t tag, IfdId group, IfdId mnGroup); //! Makernote registry structure struct TiffMnRegistry { struct MakeKey; /*! @brief Compare a TiffMnRegistry structure with a key being the make string from the image. The two are equal if TiffMnRegistry::make_ equals a substring of the key of the same size. E.g., registry = "OLYMPUS", key = "OLYMPUS OPTICAL CO.,LTD" (found in the image) match. */ bool operator==(const std::string& key) const; //! Compare a TiffMnRegistry structure with a makernote group bool operator==(IfdId key) const; // DATA const char* make_; //!< Camera make IfdId mnGroup_; //!< Group identifier NewMnFct newMnFct_; //!< Makernote create function (image) NewMnFct2 newMnFct2_; //!< Makernote create function (group) }; /*! @brief TIFF makernote factory for concrete TIFF makernotes. */ class TiffMnCreator { public: /*! @brief Create the Makernote for camera \em make and details from the makernote entry itself if needed. Return a pointer to the newly created TIFF component. Set tag and group of the new component to \em tag and \em group. This method is used when a makernote is parsed from the Exif block. @note Ownership for the component is transferred to the caller, who is responsible to delete the component. No smart pointer is used to indicate this transfer here in order to reduce file dependencies. */ static TiffComponent* create(uint16_t tag, IfdId group, const std::string& make, const byte* pData, size_t size, ByteOrder byteOrder); /*! @brief Create the Makernote for a given group. This method is used when a makernote is written back from Exif tags. */ static TiffComponent* create(uint16_t tag, IfdId group, IfdId mnGroup); //! Prevent destruction (needed if used as a policy class) ~TiffMnCreator() = delete; private: static const TiffMnRegistry registry_[]; //