Exiv2
crwimage.hpp
Go to the documentation of this file.
1 // ***************************************************************** -*- C++ -*-
2 /*
3  * Copyright (C) 2004-2018 Exiv2 authors
4  * This program is part of the Exiv2 distribution.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
19  */
29 #ifndef CRWIMAGE_HPP_
30 #define CRWIMAGE_HPP_
31 
32 // *****************************************************************************
33 #include "exiv2lib_export.h"
34 
35 // included header files
36 #include "image.hpp"
37 
38 // *****************************************************************************
39 // namespace extensions
40 namespace Exiv2 {
41 
42 // *****************************************************************************
43 // class declarations
44  class ExifData;
45  class IptcData;
46 
47 // *****************************************************************************
48 // class definitions
49 
50  // Add CRW to the supported image formats
51  namespace ImageType {
52  const int crw = 3;
53  }
54 
59  class EXIV2API CrwImage : public Image {
60  public:
62 
63 
78  CrwImage(BasicIo::AutoPtr io, bool create);
80 
82 
83  void readMetadata();
84  void writeMetadata();
89  void setIptcData(const IptcData& iptcData);
91 
93 
94  std::string mimeType() const;
95  int pixelWidth() const;
96  int pixelHeight() const;
98 
99  private:
101 
102  CrwImage(const CrwImage& rhs);
105  CrwImage& operator=(const CrwImage& rhs);
107 
108  }; // class CrwImage
109 
113  class EXIV2API CrwParser {
114  public:
130  static void decode(CrwImage* pCrwImage, const byte* pData, uint32_t size);
145  static void encode(
146  Blob& blob,
147  const byte* pData,
148  uint32_t size,
149  const CrwImage* pCrwImage
150  );
151 
152  }; // class CrwParser
153 
154 // *****************************************************************************
155 // template, inline and free functions
156 
157  // These could be static private functions on Image subclasses but then
158  // ImageFactory needs to be made a friend.
164  EXIV2API Image::AutoPtr newCrwInstance(BasicIo::AutoPtr io, bool create);
165 
167  EXIV2API bool isCrwType(BasicIo& iIo, bool advance);
168 
169 } // namespace Exiv2
170 
171 #endif // #ifndef CRWIMAGE_HPP_
Exiv2::DataBuf::reset
void reset(std::pair< byte *, long >=std::make_pair((byte *)(0), long(0)))
Reset value.
Definition: types.cpp:187
Exiv2::MemIo
Provides binary IO on blocks of memory by implementing the BasicIo interface. A copy-on-write impleme...
Definition: basicio.hpp:540
Exiv2::ImageType::crw
const int crw
CRW image type (see class CrwImage)
Definition: crwimage.hpp:52
Exiv2::CrwParser::encode
static void encode(Blob &blob, const byte *pData, uint32_t size, const CrwImage *pCrwImage)
Encode metadata from the CRW image into a data buffer (the binary CRW image).
Definition: crwimage.cpp:164
Exiv2::BasicIo::error
virtual int error() const =0
Returns 0 if the IO source is in a valid state, otherwise nonzero.
Exiv2::DataBuf::pData_
byte * pData_
Pointer to the buffer, 0 if none has been allocated.
Definition: types.hpp:269
Exiv2::IoCloser
Utility class that closes a BasicIo instance upon destruction. Meant to be used as a stack variable i...
Definition: basicio.hpp:264
crwimage.hpp
Class CrwImage to access Canon CRW images. References: The Canon RAW (CRW) File Format by Phil Harv...
Exiv2::CrwImage
Class to access raw Canon CRW images. Only Exif metadata and a comment are supported....
Definition: crwimage.hpp:59
Exiv2::ExifData::findKey
iterator findKey(const ExifKey &key)
Find the first Exifdatum with the given key, return an iterator to it.
Definition: exif.cpp:590
Exiv2::CrwImage::readMetadata
void readMetadata()
Read all metadata supported by a specific image format from the image. Before this method is called,...
Definition: crwimage.cpp:89
Exiv2::ExifData::const_iterator
ExifMetadata::const_iterator const_iterator
ExifMetadata const iterator type.
Definition: exif.hpp:439
Exiv2::Internal::CiffComponent::findComponent
CiffComponent * findComponent(uint16_t crwTagId, uint16_t crwDir) const
Finds crwTagId in directory crwDir, returning a pointer to the component or 0 if not found.
Definition: crwimage_int.cpp:611
Exiv2::Internal::CiffComponent::size
uint32_t size() const
Return the data size of this component.
Definition: crwimage_int.hpp:232
Exiv2::CrwParser::decode
static void decode(CrwImage *pCrwImage, const byte *pData, uint32_t size)
Decode metadata from a Canon CRW image in data buffer pData of length size into crwImage.
Definition: crwimage.cpp:143
Exiv2::CrwImage::mimeType
std::string mimeType() const
Return the MIME type of the image.
Definition: crwimage.cpp:60
Exiv2::strError
EXIV2API std::string strError()
Return a system error message and the error code (errno). See strerror(3).
Definition: futils.cpp:356
Exiv2::Internal::CiffHeader::AutoPtr
std::auto_ptr< CiffHeader > AutoPtr
CiffHeader auto_ptr type.
Definition: crwimage_int.hpp:438
Exiv2::Image::exifData_
ExifData exifData_
Exif data container.
Definition: image.hpp:488
Exiv2::ExifData::end
iterator end()
End of the metadata.
Definition: exif.hpp:492
Exiv2::CrwParser
Definition: crwimage.hpp:113
Exiv2::CrwImage::CrwImage
CrwImage(BasicIo::AutoPtr io, bool create)
Constructor that can either open an existing CRW image or create a new image from scratch....
Definition: crwimage.cpp:55
Exiv2::Image::clearMetadata
virtual void clearMetadata()
Erase all buffered metadata. Metadata is not removed from the actual image until the writeMetadata() ...
Definition: image.cpp:549
Exiv2::Internal::CiffComponent::pData
const byte * pData() const
Return a pointer to the data area of this component.
Definition: crwimage_int.hpp:238
Exiv2::Internal::CiffHeader::signature
static const char * signature()
Return a pointer to the Canon CRW signature.
Definition: crwimage_int.hpp:488
Exiv2::DataBuf
Utility class containing a character array. All it does is to take care of memory allocation and dele...
Definition: types.hpp:204
Exiv2::DataBuf::alloc
void alloc(long size)
Allocate a data buffer of at least the given size. Note that if the requested size is less than the c...
Definition: types.cpp:161
Exiv2::ExifKey
Concrete keys for Exif metadata and access to Exif tag reference data.
Definition: tags.hpp:148
Exiv2::CrwImage::pixelHeight
int pixelHeight() const
Return the pixel height of the image.
Definition: crwimage.cpp:74
Exiv2::DataBuf::size_
long size_
The current size of the buffer.
Definition: types.hpp:271
Exiv2::BasicIo::eof
virtual bool eof() const =0
Returns true if the IO position has reached the end, otherwise false.
Exiv2::Internal::CiffHeader
This class models the header of a CRW (Canon Raw data) image. It is the head of a CIFF parse tree,...
Definition: crwimage_int.hpp:435
Exiv2::BasicIo::read
virtual DataBuf read(long rcount)=0
Read data from the IO source. Reading starts at the current IO position and the position is advanced ...
Exiv2::Internal::CrwMap::encode
static void encode(CiffHeader *pHead, const Image &image)
Encode image metadata from image into the CRW parse tree. This function converts all Exif metadata th...
Definition: crwimage_int.cpp:1005
Exiv2
Provides classes and functions to encode and decode Exif and Iptc data. The libexiv2 API consists of ...
Definition: asfvideo.hpp:36
value.hpp
Value interface and concrete subclasses.
Exiv2::Image::io
virtual BasicIo & io() const
Return a reference to the BasicIo instance being used for Io.
Definition: image.cpp:731
image.hpp
Exiv2::CrwImage::pixelWidth
int pixelWidth() const
Return the pixel width of the image.
Definition: crwimage.cpp:65
Exiv2::Image::io_
BasicIo::AutoPtr io_
Image data IO pointer.
Definition: image.hpp:487
Exiv2::Image::AutoPtr
std::auto_ptr< Image > AutoPtr
Image auto_ptr type.
Definition: image.hpp:84
Exiv2::isCrwType
EXIV2API bool isCrwType(BasicIo &iIo, bool advance)
Check if the file iIo is a CRW image.
Definition: crwimage.cpp:195
tags_int.hpp
Internal Exif tag and type information.
Exiv2::BasicIo::AutoPtr
std::auto_ptr< BasicIo > AutoPtr
BasicIo auto_ptr type.
Definition: basicio.hpp:58
Exiv2::Error
BasicError< char > Error
Error class used for exceptions (std::string based)
Definition: error.hpp:323
Exiv2::Internal::CiffComponent
Interface class for components of the CIFF directory hierarchy of a CRW (Canon Raw data) image....
Definition: crwimage_int.hpp:91
Exiv2::IptcData
A container for IPTC data. This is a top-level class of the Exiv2 library.
Definition: iptc.hpp:173
tags.hpp
Exif tag and type information.
Exiv2::string
@ string
IPTC string type.
Definition: types.hpp:147
Exiv2::CrwImage::writeMetadata
void writeMetadata()
Write metadata back to the image.
Definition: crwimage.cpp:111
Exiv2::BasicIo::seek
virtual int seek(long offset, Position pos)=0
Move the current IO position.
Exiv2::BasicIo
An interface for simple binary IO.
Definition: basicio.hpp:55
Exiv2::Image
Abstract base class defining the interface for an image. This is the top-level interface to the Exiv2...
Definition: image.hpp:81
Exiv2::CrwImage::setIptcData
void setIptcData(const IptcData &iptcData)
Not supported. CRW format does not contain IPTC metadata. Calling this function will throw an Error(k...
Definition: crwimage.cpp:83
Exiv2::newCrwInstance
EXIV2API Image::AutoPtr newCrwInstance(BasicIo::AutoPtr io, bool create)
Create a new CrwImage instance and return an auto-pointer to it. Caller owns the returned object and ...
Definition: crwimage.cpp:186
crwimage_int.hpp
Internal classes to support CRW/CIFF format.
futils.hpp
Basic file utility functions required by Exiv2.
Exiv2::Image::exifData
virtual ExifData & exifData()
Returns an ExifData instance containing currently buffered Exif data.
Definition: image.cpp:559
error.hpp
Error class for exceptions, log message class.
Exiv2::Blob
std::vector< byte > Blob
Container for binary data.
Definition: types.hpp:162