Blame include/exiv2/xmp_exiv2.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    xmp.hpp
Packit Service 21b5d1
  @brief   Encoding and decoding of XMP data
Packit Service 21b5d1
  @author  Andreas Huggel (ahu)
Packit Service 21b5d1
           ahuggel@gmx.net
Packit Service 21b5d1
  @date    13-Jul-07, ahu: created
Packit Service 21b5d1
 */
Packit Service 21b5d1
#ifndef XMP_HPP_
Packit Service 21b5d1
#define XMP_HPP_
Packit Service 21b5d1
Packit Service 21b5d1
// *****************************************************************************
Packit Service 21b5d1
#include "exiv2lib_export.h"
Packit Service 21b5d1
Packit Service 21b5d1
// included header files
Packit Service 21b5d1
#include "metadatum.hpp"
Packit Service 21b5d1
#include "properties.hpp"
Packit Service 21b5d1
Packit Service 21b5d1
// *****************************************************************************
Packit Service 21b5d1
// namespace extensions
Packit Service 21b5d1
namespace Exiv2 {
Packit Service 21b5d1
Packit Service 21b5d1
// *****************************************************************************
Packit Service 21b5d1
// class declarations
Packit Service 21b5d1
    class ExifData;
Packit Service 21b5d1
Packit Service 21b5d1
// *****************************************************************************
Packit Service 21b5d1
// class definitions
Packit Service 21b5d1
Packit Service 21b5d1
    /*!
Packit Service 21b5d1
      @brief Information related to an XMP property. An XMP metadatum consists
Packit Service 21b5d1
             of an XmpKey and a Value and provides methods to manipulate these.
Packit Service 21b5d1
     */
Packit Service 21b5d1
    class EXIV2API Xmpdatum : public Metadatum {
Packit Service 21b5d1
    public:
Packit Service 21b5d1
        //! @name Creators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Constructor for new tags created by an application. The
Packit Service 21b5d1
                 %Xmpdatum is created from a key / value pair. %Xmpdatum
Packit Service 21b5d1
                 copies (clones) the value if one is provided. Alternatively, a
Packit Service 21b5d1
                 program can create an 'empty' %Xmpdatum with only a key and
Packit Service 21b5d1
                 set the value using setValue().
Packit Service 21b5d1
Packit Service 21b5d1
          @param key The key of the %Xmpdatum.
Packit Service 21b5d1
          @param pValue Pointer to a %Xmpdatum value.
Packit Service 21b5d1
          @throw Error if the key cannot be parsed and converted
Packit Service 21b5d1
                 to a known schema namespace prefix and property name.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        explicit Xmpdatum(const XmpKey& key,
Packit Service 21b5d1
                          const Value* pValue =0);
Packit Service 21b5d1
        //! Copy constructor
Packit Service 21b5d1
        Xmpdatum(const Xmpdatum& rhs);
Packit Service 21b5d1
        //! Destructor
Packit Service 21b5d1
        virtual ~Xmpdatum();
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Manipulators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Assignment operator
Packit Service 21b5d1
        Xmpdatum& operator=(const Xmpdatum& rhs);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Assign std::string \em value to the %Xmpdatum.
Packit Service 21b5d1
                 Calls setValue(const std::string&).
Packit Service 21b5d1
         */
Packit Service 21b5d1
        Xmpdatum& operator=(const std::string& value);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Assign const char* \em value to the %Xmpdatum.
Packit Service 21b5d1
                 Calls operator=(const std::string&).
Packit Service 21b5d1
         */
Packit Service 21b5d1
        Xmpdatum& operator=(const char* value);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Assign a boolean \em value to the %Xmpdatum.
Packit Service 21b5d1
                 Translates the value to a string "true" or "false".
Packit Service 21b5d1
         */
Packit Service 21b5d1
        Xmpdatum& operator=(const bool& value);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Assign a \em value of any type with an output operator
Packit Service 21b5d1
                 to the %Xmpdatum. Calls operator=(const std::string&).
Packit Service 21b5d1
         */
Packit Service 21b5d1
        template<typename T>
Packit Service 21b5d1
        Xmpdatum& operator=(const T& value);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Assign Value \em value to the %Xmpdatum.
Packit Service 21b5d1
                 Calls setValue(const Value*).
Packit Service 21b5d1
         */
Packit Service 21b5d1
        Xmpdatum& operator=(const Value& value);
Packit Service 21b5d1
        void setValue(const Value* pValue);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Set the value to the string \em value. Uses Value::read(const
Packit Service 21b5d1
                 std::string&).  If the %Xmpdatum does not have a Value yet,
Packit Service 21b5d1
                 then a %Value of the correct type for this %Xmpdatum is
Packit Service 21b5d1
                 created. If the key is unknown, a XmpTextValue is used as
Packit Service 21b5d1
                 default. Return 0 if the value was read successfully.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        int setValue(const std::string& value);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Accessors
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Not implemented. Calling this method will raise an exception.
Packit Service 21b5d1
        long copy(byte* buf, ByteOrder byteOrder) const;
Packit Service 21b5d1
        std::ostream& write(std::ostream& os, const ExifData* pMetadata =0) const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Return the key of the Xmpdatum. The key is of the form
Packit Service 21b5d1
                 'Xmp.prefix.property'. Note however that the
Packit Service 21b5d1
                 key is not necessarily unique, i.e., an XmpData object may
Packit Service 21b5d1
                 contain multiple metadata with the same key.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        std::string key() const;
Packit Service 21b5d1
        const char* familyName() const;
Packit Service 21b5d1
        //! Return the (preferred) schema namespace prefix.
Packit Service 21b5d1
        std::string groupName() const;
Packit Service 21b5d1
        //! Return the property name.
Packit Service 21b5d1
        std::string tagName() const;
Packit Service 21b5d1
        std::string tagLabel() const;
Packit Service 21b5d1
        //! Properties don't have a tag number. Return 0.
Packit Service 21b5d1
        uint16_t tag() const;
Packit Service 21b5d1
        TypeId typeId() const;
Packit Service 21b5d1
        const char* typeName() const;
Packit Service 21b5d1
        // Todo: Remove this method from the baseclass
Packit Service 21b5d1
        //! The Exif typeSize doesn't make sense here. Return 0.
Packit Service 21b5d1
        long typeSize() const;
Packit Service 21b5d1
        long count() const;
Packit Service 21b5d1
        long size() const;
Packit Service 21b5d1
        std::string toString() const;
Packit Service 21b5d1
        std::string toString(long n) const;
Packit Service 21b5d1
        long toLong(long n =0) const;
Packit Service 21b5d1
        float toFloat(long n =0) const;
Packit Service 21b5d1
        Rational toRational(long n =0) const;
Packit Service 21b5d1
        Value::AutoPtr getValue() const;
Packit Service 21b5d1
        const Value& value() const;
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    private:
Packit Service 21b5d1
        // Pimpl idiom
Packit Service 21b5d1
        struct Impl;
Packit Service 21b5d1
        std::auto_ptr<Impl> p_;
Packit Service 21b5d1
Packit Service 21b5d1
    }; // class Xmpdatum
Packit Service 21b5d1
Packit Service 21b5d1
    //! Container type to hold all metadata
Packit Service 21b5d1
    typedef std::vector<Xmpdatum> XmpMetadata;
Packit Service 21b5d1
Packit Service 21b5d1
    /*!
Packit Service 21b5d1
      @brief A container for XMP data. This is a top-level class of
Packit Service 21b5d1
             the %Exiv2 library.
Packit Service 21b5d1
Packit Service 21b5d1
      Provide high-level access to the XMP data of an image:
Packit Service 21b5d1
      - read XMP information from an XML block
Packit Service 21b5d1
      - access metadata through keys and standard C++ iterators
Packit Service 21b5d1
      - add, modify and delete metadata
Packit Service 21b5d1
      - serialize XMP data to an XML block
Packit Service 21b5d1
    */
Packit Service 21b5d1
    class EXIV2API XmpData {
Packit Service 21b5d1
    public:
Packit Service 21b5d1
        //! Default constructor
Packit Service 21b5d1
        XmpData() : xmpMetadata_(), xmpPacket_(), usePacket_(0) {}
Packit Service 21b5d1
Packit Service 21b5d1
        //! XmpMetadata iterator type
Packit Service 21b5d1
        typedef XmpMetadata::iterator iterator;
Packit Service 21b5d1
        //! XmpMetadata const iterator type
Packit Service 21b5d1
        typedef XmpMetadata::const_iterator const_iterator;
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Manipulators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Returns a reference to the %Xmpdatum that is associated with a
Packit Service 21b5d1
                 particular \em key. If %XmpData does not already contain such
Packit Service 21b5d1
                 an %Xmpdatum, operator[] adds object \em Xmpdatum(key).
Packit Service 21b5d1
Packit Service 21b5d1
          @note  Since operator[] might insert a new element, it can't be a const
Packit Service 21b5d1
                 member function.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        Xmpdatum& operator[](const std::string& key);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Add an %Xmpdatum from the supplied key and value pair. This
Packit Service 21b5d1
                 method copies (clones) the value.
Packit Service 21b5d1
          @return 0 if successful.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        int add(const XmpKey& key, const Value* value);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Add a copy of the Xmpdatum to the XMP metadata.
Packit Service 21b5d1
          @return 0 if successful.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        int add(const Xmpdatum& xmpdatum);
Packit Service 21b5d1
        /*
Packit Service 21b5d1
        @brief Delete the Xmpdatum at iterator position pos, return the
Packit Service 21b5d1
                position of the next Xmpdatum.
Packit Service 21b5d1
Packit Service 21b5d1
        @note  Iterators into the metadata, including pos, are potentially
Packit Service 21b5d1
                invalidated by this call.
Packit Service 21b5d1
        @brief Delete the Xmpdatum at iterator position pos and update pos
Packit Service 21b5d1
        */
Packit Service 21b5d1
        iterator erase(XmpData::iterator pos);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Delete the Xmpdatum at iterator position pos and update pos
Packit Service 21b5d1
                 erases all following keys from the same family
Packit Service 21b5d1
                 See: https://github.com/Exiv2/exiv2/issues/521
Packit Service 21b5d1
         */
Packit Service 21b5d1
        void eraseFamily(XmpData::iterator& pos);
Packit Service 21b5d1
        //! Delete all Xmpdatum instances resulting in an empty container.
Packit Service 21b5d1
        void clear();
Packit Service 21b5d1
        //! Sort metadata by key
Packit Service 21b5d1
        void sortByKey();
Packit Service 21b5d1
        //! Begin of the metadata
Packit Service 21b5d1
        iterator begin();
Packit Service 21b5d1
        //! End of the metadata
Packit Service 21b5d1
        iterator end();
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Find the first Xmpdatum with the given key, return an iterator
Packit Service 21b5d1
                 to it.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        iterator findKey(const XmpKey& key);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Accessors
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Begin of the metadata
Packit Service 21b5d1
        const_iterator begin() const;
Packit Service 21b5d1
        //! End of the metadata
Packit Service 21b5d1
        const_iterator end() const;
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Find the first Xmpdatum with the given key, return a const
Packit Service 21b5d1
                 iterator to it.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        const_iterator findKey(const XmpKey& key) const;
Packit Service 21b5d1
        //! Return true if there is no XMP metadata
Packit Service 21b5d1
        bool empty() const;
Packit Service 21b5d1
        //! Get the number of metadata entries
Packit Service 21b5d1
        long count() const;
Packit Service 21b5d1
Packit Service 21b5d1
        //! are we to use the packet?
Packit Service 21b5d1
        bool usePacket() const { return usePacket_; } ;
Packit Service 21b5d1
Packit Service 21b5d1
        //! set usePacket_
Packit Service 21b5d1
        bool usePacket(bool b) { bool r = usePacket_; usePacket_=b ; return r; };
Packit Service 21b5d1
        //! setPacket
Packit Service 21b5d1
        void setPacket(const std::string& xmpPacket) { xmpPacket_ = xmpPacket ; usePacket(false); };
Packit Service 21b5d1
        // ! getPacket
Packit Service 21b5d1
        const std::string& xmpPacket() const { return xmpPacket_ ; };
Packit Service 21b5d1
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    private:
Packit Service 21b5d1
        // DATA
Packit Service 21b5d1
        XmpMetadata xmpMetadata_;
Packit Service 21b5d1
        std::string xmpPacket_  ;
Packit Service 21b5d1
        bool        usePacket_  ;
Packit Service 21b5d1
    }; // class XmpData
Packit Service 21b5d1
Packit Service 21b5d1
    /*!
Packit Service 21b5d1
      @brief Stateless parser class for XMP packets. Images use this
Packit Service 21b5d1
             class to parse and serialize XMP packets. The parser uses
Packit Service 21b5d1
             the XMP toolkit to do the job.
Packit Service 21b5d1
     */
Packit Service 21b5d1
    class EXIV2API XmpParser {
Packit Service 21b5d1
    public:
Packit Service 21b5d1
        //! Options to control the format of the serialized XMP packet.
Packit Service 21b5d1
        enum XmpFormatFlags {
Packit Service 21b5d1
            omitPacketWrapper   = 0x0010UL,  //!< Omit the XML packet wrapper.
Packit Service 21b5d1
            readOnlyPacket      = 0x0020UL,  //!< Default is a writeable packet.
Packit Service 21b5d1
            useCompactFormat    = 0x0040UL,  //!< Use a compact form of RDF.
Packit Service 21b5d1
            includeThumbnailPad = 0x0100UL,  //!< Include a padding allowance for a thumbnail image.
Packit Service 21b5d1
            exactPacketLength   = 0x0200UL,  //!< The padding parameter is the overall packet length.
Packit Service 21b5d1
            writeAliasComments  = 0x0400UL,  //!< Show aliases as XML comments.
Packit Service 21b5d1
            omitAllFormatting   = 0x0800UL   //!< Omit all formatting whitespace.
Packit Service 21b5d1
        };
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Decode XMP metadata from an XMP packet \em xmpPacket into
Packit Service 21b5d1
                 \em xmpData. The format of the XMP packet must follow the
Packit Service 21b5d1
                 XMP specification. This method clears any previous contents
Packit Service 21b5d1
                 of \em xmpData.
Packit Service 21b5d1
Packit Service 21b5d1
          @param xmpData   Container for the decoded XMP properties
Packit Service 21b5d1
          @param xmpPacket The raw XMP packet to decode
Packit Service 21b5d1
          @return 0 if successful;
Packit Service 21b5d1
                  1 if XMP support has not been compiled-in;
Packit Service 21b5d1
                  2 if the XMP toolkit failed to initialize;
Packit Service 21b5d1
                  3 if the XMP toolkit failed and raised an XMP_Error
Packit Service 21b5d1
        */
Packit Service 21b5d1
        static int decode(      XmpData&     xmpData,
Packit Service 21b5d1
                          const std::string& xmpPacket);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Encode (serialize) XMP metadata from \em xmpData into a
Packit Service 21b5d1
                 string xmpPacket. The XMP packet returned in the string
Packit Service 21b5d1
                 follows the XMP specification. This method only modifies
Packit Service 21b5d1
                 \em xmpPacket if the operations succeeds (return code 0).
Packit Service 21b5d1
Packit Service 21b5d1
          @param xmpPacket   Reference to a string to hold the encoded XMP
Packit Service 21b5d1
                             packet.
Packit Service 21b5d1
          @param xmpData     XMP properties to encode.
Packit Service 21b5d1
          @param formatFlags Flags that control the format of the XMP packet,
Packit Service 21b5d1
                             see enum XmpFormatFlags.
Packit Service 21b5d1
          @param padding     Padding length.
Packit Service 21b5d1
          @return 0 if successful;
Packit Service 21b5d1
                  1 if XMP support has not been compiled-in;
Packit Service 21b5d1
                  2 if the XMP toolkit failed to initialize;
Packit Service 21b5d1
                  3 if the XMP toolkit failed and raised an XMP_Error
Packit Service 21b5d1
        */
Packit Service 21b5d1
        static int encode(      std::string& xmpPacket,
Packit Service 21b5d1
                          const XmpData&     xmpData,
Packit Service 21b5d1
                                uint16_t     formatFlags =useCompactFormat,
Packit Service 21b5d1
                                uint32_t     padding =0);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Lock/unlock function type
Packit Service 21b5d1
Packit Service 21b5d1
          A function of this type can be passed to initialize() to
Packit Service 21b5d1
          make subsequent registration of XMP namespaces thread-safe.
Packit Service 21b5d1
          See the initialize() function for more information.
Packit Service 21b5d1
Packit Service 21b5d1
          @param pLockData Pointer to the pLockData passed to initialize()
Packit Service 21b5d1
          @param lockUnlock Indicates whether to lock (true) or unlock (false)
Packit Service 21b5d1
         */
Packit Service 21b5d1
        typedef void (*XmpLockFct)(void* pLockData, bool lockUnlock);
Packit Service 21b5d1
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Initialize the XMP Toolkit.
Packit Service 21b5d1
Packit Service 21b5d1
          Calling this method is usually not needed, as encode() and
Packit Service 21b5d1
          decode() will initialize the XMP Toolkit if necessary.
Packit Service 21b5d1
Packit Service 21b5d1
          The function takes optional pointers to a callback function
Packit Service 21b5d1
          \em xmpLockFct and related data \em pLockData that the parser
Packit Service 21b5d1
          uses when XMP namespaces are subsequently registered.
Packit Service 21b5d1
Packit Service 21b5d1
          The initialize() function itself still is not thread-safe and
Packit Service 21b5d1
          needs to be called in a thread-safe manner (e.g., on program
Packit Service 21b5d1
          startup), but if used with suitable additional locking
Packit Service 21b5d1
          parameters, any subsequent registration of namespaces will be
Packit Service 21b5d1
          thread-safe.
Packit Service 21b5d1
Packit Service 21b5d1
          Example usage on Windows using a critical section:
Packit Service 21b5d1
Packit Service 21b5d1
          @code
Packit Service 21b5d1
          void main()
Packit Service 21b5d1
          {
Packit Service 21b5d1
              struct XmpLock
Packit Service 21b5d1
              {
Packit Service 21b5d1
                  CRITICAL_SECTION cs;
Packit Service 21b5d1
                  XmpLock()  { InitializeCriticalSection(&cs); }
Packit Service 21b5d1
                  ~XmpLock() { DeleteCriticalSection(&cs); }
Packit Service 21b5d1
Packit Service 21b5d1
                  static void LockUnlock(void* pData, bool fLock)
Packit Service 21b5d1
                  {
Packit Service 21b5d1
                      XmpLock* pThis = reinterpret_cast<XmpLock*>(pData);
Packit Service 21b5d1
                      if (pThis)
Packit Service 21b5d1
                      {
Packit Service 21b5d1
                          (fLock) ? EnterCriticalSection(&pThis->cs)
Packit Service 21b5d1
                                  : LeaveCriticalSection(&pThis->cs);
Packit Service 21b5d1
                      }
Packit Service 21b5d1
                  }
Packit Service 21b5d1
              } xmpLock;
Packit Service 21b5d1
Packit Service 21b5d1
              // Pass the locking mechanism to the XMP parser on initialization.
Packit Service 21b5d1
              // Note however that this call itself is still not thread-safe.
Packit Service 21b5d1
              Exiv2::XmpParser::initialize(XmpLock::LockUnlock, &xmpLock);
Packit Service 21b5d1
Packit Service 21b5d1
              // Program continues here, subsequent registrations of XMP
Packit Service 21b5d1
              // namespaces are serialized using xmpLock.
Packit Service 21b5d1
Packit Service 21b5d1
          }
Packit Service 21b5d1
          @endcode
Packit Service 21b5d1
Packit Service 21b5d1
          @return True if the initialization was successful, else false.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        static bool initialize(XmpParser::XmpLockFct xmpLockFct =0, void* pLockData =0);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Terminate the XMP Toolkit and unregister custom namespaces.
Packit Service 21b5d1
Packit Service 21b5d1
          Call this method when the XmpParser is no longer needed to
Packit Service 21b5d1
          allow the XMP Toolkit to cleanly shutdown.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        static void terminate();
Packit Service 21b5d1
Packit Service 21b5d1
    private:
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Register a namespace with the XMP Toolkit.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        static void registerNs(const std::string& ns,
Packit Service 21b5d1
                               const std::string& prefix);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Delete a namespace from the XMP Toolkit.
Packit Service 21b5d1
Packit Service 21b5d1
          XmpProperties::unregisterNs calls this to synchronize namespaces.
Packit Service 21b5d1
        */
Packit Service 21b5d1
        static void unregisterNs(const std::string& ns);
Packit Service 21b5d1
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Get namespaces registered with XMPsdk
Packit Service 21b5d1
         */
Packit Service 21b5d1
        static void registeredNamespaces(Exiv2::Dictionary&);
Packit Service 21b5d1
Packit Service 21b5d1
        // DATA
Packit Service 21b5d1
        static bool initialized_; //! Indicates if the XMP Toolkit has been initialized
Packit Service 21b5d1
        static XmpLockFct xmpLockFct_;
Packit Service 21b5d1
        static void* pLockData_;
Packit Service 21b5d1
Packit Service 21b5d1
    friend class XmpProperties; // permit XmpProperties -> registerNs() and registeredNamespaces()
Packit Service 21b5d1
Packit Service 21b5d1
    }; // class XmpParser
Packit Service 21b5d1
Packit Service 21b5d1
// *****************************************************************************
Packit Service 21b5d1
// free functions, template and inline definitions
Packit Service 21b5d1
Packit Service 21b5d1
    inline Xmpdatum& Xmpdatum::operator=(const char* value)
Packit Service 21b5d1
    {
Packit Service 21b5d1
        return Xmpdatum::operator=(std::string(value));
Packit Service 21b5d1
    }
Packit Service 21b5d1
Packit Service 21b5d1
    inline Xmpdatum& Xmpdatum::operator=(const bool& value)
Packit Service 21b5d1
    {
Packit Service 21b5d1
        return operator=(value ? "True" : "False");
Packit Service 21b5d1
    }
Packit Service 21b5d1
Packit Service 21b5d1
    template<typename T>
Packit Service 21b5d1
    Xmpdatum& Xmpdatum::operator=(const T& value)
Packit Service 21b5d1
    {
Packit Service 21b5d1
        setValue(Exiv2::toString(value));
Packit Service 21b5d1
        return *this;
Packit Service 21b5d1
    }
Packit Service 21b5d1
Packit Service 21b5d1
}                                       // namespace Exiv2
Packit Service 21b5d1
Packit Service 21b5d1
#endif                                  // #ifndef XMP_HPP_