Blame include/exiv2/rafimage.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    rafimage.hpp
Packit 01d647
  @brief   Fujifilm RAW image
Packit 01d647
  @author  Andreas Huggel (ahu)
Packit 01d647
           ahuggel@gmx.net
Packit 01d647
  @date    05-Feb-07, ahu: created
Packit 01d647
 */
Packit 01d647
#ifndef RAFIMAGE_HPP_
Packit 01d647
#define RAFIMAGE_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
#include "basicio.hpp"
Packit 01d647
#include "types.hpp"
Packit 01d647
Packit 01d647
// + standard includes
Packit 01d647
#include <string>
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 RAF to the supported image formats
Packit 01d647
    namespace ImageType {
Packit 01d647
        const int raf = 8;          //!< RAF image type (see class RafImage)
Packit 01d647
    }
Packit 01d647
Packit 01d647
    /*!
Packit 01d647
      @brief Class to access raw Fujifilm RAF images. Exif metadata is
Packit 01d647
          supported directly, IPTC is read from the Exif data, if present.
Packit 01d647
     */
Packit 01d647
    class EXIV2API RafImage : public Image {
Packit 01d647
    public:
Packit 01d647
        //! @name Creators
Packit 01d647
        //@{
Packit 01d647
        /*!
Packit 01d647
          @brief Constructor that can either open an existing RAF image or create
Packit 01d647
              a new image from scratch. If a new image is to be created, any
Packit 01d647
              existing data is overwritten. Since the constructor can not return
Packit 01d647
              a result, callers should check the good() method after object
Packit 01d647
              construction to determine success 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
          @param create Specifies if an existing image should be read (false)
Packit 01d647
              or if a new file should be created (true).
Packit 01d647
         */
Packit 01d647
        RafImage(BasicIo::AutoPtr io, bool create);
Packit 01d647
        //@}
Packit 01d647
Packit 01d647
        //! @name Manipulators
Packit 01d647
        //@{
Packit 01d647
        void printStructure(std::ostream& out, PrintStructureOption option,int depth);
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, requires writeMetadata(). Calling
Packit 01d647
              this function will throw an Error(kerInvalidSettingForImage).
Packit 01d647
         */
Packit 01d647
        void setExifData(const ExifData& exifData);
Packit 01d647
        /*!
Packit 01d647
          @brief Todo: Not supported yet, requires writeMetadata(). Calling
Packit 01d647
              this function will throw an Error(kerInvalidSettingForImage).
Packit 01d647
         */
Packit 01d647
        void setIptcData(const IptcData& iptcData);
Packit 01d647
        /*!
Packit 01d647
          @brief Not supported. RAF format does not contain a comment.
Packit 01d647
              Calling this function will throw an 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
        int pixelWidth() const;
Packit 01d647
        int pixelHeight() const;
Packit 01d647
        //@}
Packit 01d647
Packit 01d647
    private:
Packit 01d647
        //! @name NOT implemented
Packit 01d647
        //@{
Packit 01d647
        //! Copy constructor
Packit 01d647
        RafImage(const RafImage& rhs);
Packit 01d647
        //! Assignment operator
Packit 01d647
        RafImage& operator=(const RafImage& rhs);
Packit 01d647
        //@}
Packit 01d647
Packit 01d647
    }; // class RafImage
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 RafImage 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 newRafInstance(BasicIo::AutoPtr io, bool create);
Packit 01d647
Packit 01d647
    //! Check if the file iIo is a RAF image.
Packit 01d647
    EXIV2API bool isRafType(BasicIo& iIo, bool advance);
Packit 01d647
Packit 01d647
}                                       // namespace Exiv2
Packit 01d647
Packit 01d647
#endif                                  // #ifndef RAFIMAGE_HPP_