Blame include/exiv2/pgfimage.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    pgfimage.hpp
Packit Service 21b5d1
  @brief   PGF image, implemented using the following references:
Packit Service 21b5d1
           PGF specification from libpgf web site
Packit Service 21b5d1
  @author  Andreas Huggel (ahu)
Packit Service 21b5d1
           ahuggel@gmx.net
Packit Service 21b5d1
  @author  Gilles Caulier (cgilles)
Packit Service 21b5d1
           caulier dot gilles at gmail dot com
Packit Service 21b5d1
  @date    16-Jun-09, gc: submitted
Packit Service 21b5d1
 */
Packit Service 21b5d1
#ifndef PGFIMAGE_HPP_
Packit Service 21b5d1
#define PGFIMAGE_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 "image.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
// *****************************************************************************
Packit Service 21b5d1
// class definitions
Packit Service 21b5d1
Packit Service 21b5d1
    // Add PGF to the supported image formats
Packit Service 21b5d1
    namespace ImageType
Packit Service 21b5d1
    {
Packit Service 21b5d1
        const int pgf = 17;          //!< PGF image type (see class PgfImage)
Packit Service 21b5d1
    }
Packit Service 21b5d1
Packit Service 21b5d1
    /*!
Packit Service 21b5d1
      @brief Class to access PGF images. Exif and IPTC metadata are supported
Packit Service 21b5d1
          directly.
Packit Service 21b5d1
     */
Packit Service 21b5d1
    class EXIV2API PgfImage : public Image {
Packit Service 21b5d1
    public:
Packit Service 21b5d1
        //! @name Creators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Constructor that can either open an existing PGF image or create
Packit Service 21b5d1
              a new image from scratch. If a new image is to be created, any
Packit Service 21b5d1
              existing data is overwritten. Since the constructor can not return
Packit Service 21b5d1
              a result, callers should check the good() method after object
Packit Service 21b5d1
              construction to determine success or failure.
Packit Service 21b5d1
          @param io An auto-pointer that owns a BasicIo instance used for
Packit Service 21b5d1
              reading and writing image metadata. \b Important: The constructor
Packit Service 21b5d1
              takes ownership of the passed in BasicIo instance through the
Packit Service 21b5d1
              auto-pointer. Callers should not continue to use the BasicIo
Packit Service 21b5d1
              instance after it is passed to this method.  Use the Image::io()
Packit Service 21b5d1
              method to get a temporary reference.
Packit Service 21b5d1
          @param create Specifies if an existing image should be read (false)
Packit Service 21b5d1
              or if a new file should be created (true).
Packit Service 21b5d1
         */
Packit Service 21b5d1
        PgfImage(BasicIo::AutoPtr io, bool create);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Manipulators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        void readMetadata();
Packit Service 21b5d1
        void writeMetadata();
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Accessors
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        std::string mimeType() const { return "image/pgf"; }
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    private:
Packit Service 21b5d1
        bool bSwap_; // true for bigEndian hardware, else false
Packit Service 21b5d1
        //! @name NOT implemented
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Copy constructor
Packit Service 21b5d1
        PgfImage(const PgfImage& rhs);
Packit Service 21b5d1
        //! Assignment operator
Packit Service 21b5d1
        PgfImage& operator=(const PgfImage& rhs);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Provides the main implementation of writeMetadata() by
Packit Service 21b5d1
                writing all buffered metadata to the provided BasicIo.
Packit Service 21b5d1
          @param oIo BasicIo instance to write to (a temporary location).
Packit Service 21b5d1
Packit Service 21b5d1
          @return 4 if opening or writing to the associated BasicIo fails
Packit Service 21b5d1
         */
Packit Service 21b5d1
        void doWriteMetadata(BasicIo& oIo);
Packit Service 21b5d1
        //! Read Magick number. Only version >= 6 is supported.
Packit Service 21b5d1
        byte readPgfMagicNumber(BasicIo& iIo);
Packit Service 21b5d1
        //! Read PGF Header size encoded in 32 bits integer.
Packit Service 21b5d1
        uint32_t readPgfHeaderSize(BasicIo& iIo);
Packit Service 21b5d1
        //! Read header structure.
Packit Service 21b5d1
        DataBuf readPgfHeaderStructure(BasicIo& iIo, int& width,int & height);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    }; // class PgfImage
Packit Service 21b5d1
Packit Service 21b5d1
// *****************************************************************************
Packit Service 21b5d1
// template, inline and free functions
Packit Service 21b5d1
Packit Service 21b5d1
    // These could be static private functions on Image subclasses but then
Packit Service 21b5d1
    // ImageFactory needs to be made a friend.
Packit Service 21b5d1
    /*!
Packit Service 21b5d1
      @brief Create a new PgfImage instance and return an auto-pointer to it.
Packit Service 21b5d1
             Caller owns the returned object and the auto-pointer ensures that
Packit Service 21b5d1
             it will be deleted.
Packit Service 21b5d1
     */
Packit Service 21b5d1
    EXIV2API Image::AutoPtr newPgfInstance(BasicIo::AutoPtr io, bool create);
Packit Service 21b5d1
Packit Service 21b5d1
    //! Check if the file iIo is a PGF image.
Packit Service 21b5d1
    EXIV2API bool isPgfType(BasicIo& iIo, bool advance);
Packit Service 21b5d1
Packit Service 21b5d1
}                                       // namespace Exiv2
Packit Service 21b5d1
Packit Service 21b5d1
#endif                                  // #ifndef PGFIMAGE_HPP_