Blame include/exiv2/bmpimage.hpp

Packit 01d647
// ***************************************************************** -*- C++ -*-
Packit 01d647
/*
Packit 01d647
 * Copyright (C) 2004-2018 Exiv2 authors
Packit 01d647
 * This program is part of the Exiv2 distribution.
Packit 01d647
 *
Packit 01d647
 * This program is free software; you can redistribute it and/or
Packit 01d647
 * modify it under the terms of the GNU General Public License
Packit 01d647
 * as published by the Free Software Foundation; either version 2
Packit 01d647
 * of the License, or (at your option) any later version.
Packit 01d647
 *
Packit 01d647
 * This program is distributed in the hope that it will be useful,
Packit 01d647
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 01d647
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 01d647
 * GNU General Public License for more details.
Packit 01d647
 *
Packit 01d647
 * You should have received a copy of the GNU General Public License
Packit 01d647
 * along with this program; if not, write to the Free Software
Packit 01d647
 * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
Packit 01d647
 */
Packit 01d647
/*!
Packit 01d647
  @file    bmpimage.hpp
Packit 01d647
  @brief   Windows Bitmap (BMP) image
Packit 01d647
  @author  Marco Piovanelli, Ovolab (marco)
Packit 01d647
           marco.piovanelli@pobox.com
Packit 01d647
  @date    05-Mar-2007, marco: created
Packit 01d647
 */
Packit 01d647
#ifndef BMPIMAGE_HPP_
Packit 01d647
#define BMPIMAGE_HPP_
Packit 01d647
Packit 01d647
// *****************************************************************************
Packit 01d647
#include "exiv2lib_export.h"
Packit 01d647
Packit 01d647
// included header files
Packit 01d647
#include "image.hpp"
Packit 01d647
Packit 01d647
// *****************************************************************************
Packit 01d647
// namespace extensions
Packit 01d647
namespace Exiv2 {
Packit 01d647
Packit 01d647
// *****************************************************************************
Packit 01d647
// class definitions
Packit 01d647
Packit 01d647
    // Add Windows Bitmap (BMP) to the supported image formats
Packit 01d647
    namespace ImageType {
Packit 01d647
        const int bmp = 14; //!< Windows bitmap (bmp) image type (see class BmpImage)
Packit 01d647
    }
Packit 01d647
Packit 01d647
    /*!
Packit 01d647
      @brief Class to access Windows bitmaps. This is just a stub - we only
Packit 01d647
          read width and height.
Packit 01d647
     */
Packit 01d647
    class EXIV2API BmpImage : public Image {
Packit 01d647
        //! @name NOT Implemented
Packit 01d647
        //@{
Packit 01d647
        //! Copy constructor
Packit 01d647
        BmpImage(const BmpImage& rhs);
Packit 01d647
        //! Assignment operator
Packit 01d647
        BmpImage& operator=(const BmpImage& rhs);
Packit 01d647
        //@}
Packit 01d647
Packit 01d647
    public:
Packit 01d647
        //! @name Creators
Packit 01d647
        //@{
Packit 01d647
        /*!
Packit 01d647
          @brief Constructor to open a Windows bitmap image. Since the
Packit 01d647
              constructor can not return a result, callers should check the
Packit 01d647
              good() method after object construction to determine success
Packit 01d647
              or failure.
Packit 01d647
          @param io An auto-pointer that owns a BasicIo instance used for
Packit 01d647
              reading and writing image metadata. \b Important: The constructor
Packit 01d647
              takes ownership of the passed in BasicIo instance through the
Packit 01d647
              auto-pointer. Callers should not continue to use the BasicIo
Packit 01d647
              instance after it is passed to this method.  Use the Image::io()
Packit 01d647
              method to get a temporary reference.
Packit 01d647
         */
Packit 01d647
        explicit BmpImage(BasicIo::AutoPtr io);
Packit 01d647
        //@}
Packit 01d647
Packit 01d647
        //! @name Manipulators
Packit 01d647
        //@{
Packit 01d647
        void readMetadata();
Packit 01d647
        /*!
Packit 01d647
          @brief Todo: Write metadata back to the image. This method is not
Packit 01d647
              yet(?) implemented. Calling it will throw an Error(kerWritingImageFormatUnsupported).
Packit 01d647
         */
Packit 01d647
        void writeMetadata();
Packit 01d647
        /*!
Packit 01d647
          @brief Todo: Not supported yet(?). Calling this function will throw
Packit 01d647
              an instance of Error(kerInvalidSettingForImage).
Packit 01d647
         */
Packit 01d647
        void setExifData(const ExifData& exifData);
Packit 01d647
        /*!
Packit 01d647
          @brief Todo: Not supported yet(?). Calling this function will throw
Packit 01d647
              an instance of Error(kerInvalidSettingForImage).
Packit 01d647
         */
Packit 01d647
        void setIptcData(const IptcData& iptcData);
Packit 01d647
        /*!
Packit 01d647
          @brief Not supported. Calling this function will throw an instance
Packit 01d647
              of Error(kerInvalidSettingForImage).
Packit 01d647
         */
Packit 01d647
        void setComment(const std::string& comment);
Packit 01d647
        //@}
Packit 01d647
Packit 01d647
        //! @name Accessors
Packit 01d647
        //@{
Packit 01d647
        std::string mimeType() const;
Packit 01d647
        //@}
Packit 01d647
Packit 01d647
    }; // class BmpImage
Packit 01d647
Packit 01d647
// *****************************************************************************
Packit 01d647
// template, inline and free functions
Packit 01d647
Packit 01d647
    // These could be static private functions on Image subclasses but then
Packit 01d647
    // ImageFactory needs to be made a friend.
Packit 01d647
    /*!
Packit 01d647
      @brief Create a new BmpImage instance and return an auto-pointer to it.
Packit 01d647
             Caller owns the returned object and the auto-pointer ensures that
Packit 01d647
             it will be deleted.
Packit 01d647
     */
Packit 01d647
    EXIV2API Image::AutoPtr newBmpInstance(BasicIo::AutoPtr io, bool create);
Packit 01d647
Packit 01d647
    //! Check if the file iIo is a Windows Bitmap image.
Packit 01d647
    EXIV2API bool isBmpType(BasicIo& iIo, bool advance);
Packit 01d647
Packit 01d647
}                                       // namespace Exiv2
Packit 01d647
Packit 01d647
#endif                                  // #ifndef BMPIMAGE_HPP_