3 #ifndef TIFFCOMPOSITE_INT_HPP_
4 #define TIFFCOMPOSITE_INT_HPP_
8 #include "tifffwd_int.hpp"
47 const uint32_t
none = 0x10000;
48 const uint32_t
root = 0x20000;
49 const uint32_t
next = 0x30000;
50 const uint32_t
all = 0x40000;
51 const uint32_t
pana = 0x80000;
52 const uint32_t
fuji = 0x100000;
53 const uint32_t
cmt2 = 0x110000;
54 const uint32_t
cmt3 = 0x120000;
55 const uint32_t
cmt4 = 0x130000;
73 [[nodiscard]] uint16_t
tag()
const {
75 return static_cast<uint16_t
>(extendedTag_ & 0xffff);
89 uint32_t extendedTag_;
123 size_t write(
const byte* pData,
size_t wcount);
138 const byte* pHeader_;
140 bool wroteHeader_{
false};
211 pStart_ =
const_cast<byte*
>(pStart);
233 [[nodiscard]] uint16_t
tag()
const {
267 [[nodiscard]]
size_t size()
const;
271 [[nodiscard]]
size_t count()
const;
278 [[nodiscard]]
size_t sizeData()
const;
291 [[nodiscard]]
virtual int idx()
const;
308 size_t& imageIdx) = 0;
317 size_t& imageIdx)
const = 0;
321 [[nodiscard]]
virtual size_t doSize()
const = 0;
323 [[nodiscard]]
virtual size_t doCount()
const = 0;
325 [[nodiscard]]
virtual size_t doSizeData()
const = 0;
327 [[nodiscard]]
virtual size_t doSizeImage()
const = 0;
354 [[nodiscard]] uint16_t
tag()
const {
398 TiffEntryBase&
operator=(
const TiffEntryBase&) =
delete;
437 void setData(std::shared_ptr<DataBuf> buf);
468 [[nodiscard]]
int idx()
const override;
507 size_t& imageIdx)
override;
512 [[nodiscard]]
size_t doCount()
const override;
519 size_t& imageIdx)
const override;
526 [[nodiscard]]
size_t doSize()
const override;
528 [[nodiscard]]
size_t doSizeData()
const override;
537 [[nodiscard]] std::shared_ptr<DataBuf>
storage()
const {
562 std::shared_ptr<DataBuf> storage_;
586 [[nodiscard]] TiffEntry*
doClone()
const override;
622 [[nodiscard]] uint16_t
szTag()
const {
677 size_t& imageIdx)
override;
688 size_t& imageIdx)
const override;
692 [[nodiscard]]
size_t doSizeData()
const override;
699 size_t sizeDataArea_{};
735 size_t& imageIdx)
override;
750 size_t& imageIdx)
const override;
757 [[nodiscard]]
size_t doSize()
const override;
759 [[nodiscard]]
size_t doSizeData()
const override;
766 using Strips = std::vector<std::pair<const byte*, size_t>>;
784 TiffEntryBase(tag, group), dtTag_(dtTag), dtGroup_(dtGroup) {
791 [[nodiscard]] uint16_t
dtTag()
const {
810 [[nodiscard]] TiffSizeEntry*
doClone()
const override;
844 [[nodiscard]]
bool hasNext()
const {
870 size_t& imageIdx)
override;
881 size_t& imageIdx)
const override;
893 [[nodiscard]]
size_t doSize()
const override;
898 [[nodiscard]]
size_t doCount()
const override;
903 [[nodiscard]]
size_t doSizeData()
const override;
916 size_t valueIdx,
size_t dataIdx,
size_t& imageIdx);
965 size_t& imageIdx)
override;
976 size_t& imageIdx)
const override;
983 [[nodiscard]]
size_t doSize()
const override;
985 [[nodiscard]]
size_t doSizeData()
const override;
992 using Ifds = std::vector<TiffDirectory*>;
1028 TiffMnEntry&
operator=(
const TiffMnEntry&) =
delete;
1045 size_t& imageIdx)
override;
1050 [[nodiscard]] TiffMnEntry*
doClone()
const override;
1052 [[nodiscard]]
size_t doCount()
const override;
1059 [[nodiscard]]
size_t doSize()
const override;
1135 [[nodiscard]]
size_t mnOffset()
const;
1172 size_t& imageIdx)
override;
1183 size_t& imageIdx)
const override;
1193 [[nodiscard]]
size_t doSize()
const override;
1199 [[nodiscard]]
size_t doCount()
const override;
1204 [[nodiscard]]
size_t doSizeData()
const override;
1209 [[nodiscard]]
size_t doSizeImage()
const override;
1217 ByteOrder imageByteOrder_{invalidByteOrder};
1236 [[nodiscard]]
size_t size(uint16_t tag,
IfdId group)
const;
1369 size_t& imageIdx)
override;
1376 [[nodiscard]]
size_t doCount()
const override;
1382 [[nodiscard]]
size_t doSize()
const override;
1391 const ArrayCfg* arrayCfg_{};
1392 const ArrayDef* arrayDef_{};
1422 elByteOrder_ = byteOrder;
1438 return elByteOrder_;
1451 size_t& imageIdx)
override;
1460 [[nodiscard]]
size_t doCount()
const override;
1467 [[nodiscard]]
size_t doSize()
const override;
1475 ByteOrder elByteOrder_{invalidByteOrder};
1485 bool cmpTagLt(
const TiffComponent* lhs,
const TiffComponent* rhs);
1491 bool cmpGroupLt(
const TiffComponent* lhs,
const TiffComponent* rhs);
1503 template <IfdId newGroup>
1505 return std::make_unique<TiffDirectory>(tag, newGroup);
1509 template <IfdId newGroup>
1511 return std::make_unique<TiffSubIfd>(tag, group, newGroup);
1515 template <const ArrayCfg& arrayCfg,
size_t N, const ArrayDef (&arrayDef)[N]>
1517 return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, arrayDef, N);
1521 template <const ArrayCfg& arrayCfg>
1523 return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg,
nullptr, 0);
1527 template <
size_t N, const ArraySet (&arraySet)[N], CfgSelFct cfgSelFct>
1529 return std::make_unique<TiffBinaryArray>(tag, group, arraySet, N, cfgSelFct);
1533 template <u
int16_t szTag, IfdId szGroup>
1535 return std::make_unique<TiffDataEntry>(tag, group, szTag, szGroup);
1539 template <u
int16_t dtTag, IfdId dtGroup>
1541 return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
1545 template <u
int16_t szTag, IfdId szGroup>
1547 return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
1551 template <u
int16_t dtTag, IfdId dtGroup>
1554 return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
1560 #endif // #ifndef TIFFCOMPOSITE_INT_HPP_
CryptFct cryptFct_
Crypt function, 0 if not used.
Definition: tiffcomposite_int.hpp:1256
uint16_t tag() const
Return the tag corresponding to the extended tag.
Definition: tiffcomposite_int.hpp:74
void doAccept(TiffVisitor &visitor) override
Implements accept().
Definition: tiffcomposite_int.cpp:629
This class is the basis for Makernote support in TIFF. It contains a pointer to a concrete Makernote...
Definition: tiffcomposite_int.hpp:1006
TiffComponent::UniquePtr newTiffBinaryElement(uint16_t tag, IfdId group)
Function to create and initialize a new binary array element.
Definition: tiffcomposite_int.cpp:1504
const TiffType ttTiffDouble
TIFF DOUBLE type.
Definition: tiffcomposite_int.hpp:35
void doAccept(TiffVisitor &visitor) override
Implements accept().
Definition: tiffcomposite_int.cpp:656
ByteOrder elByteOrder() const
Return the byte order of this element.
Definition: tiffcomposite_int.hpp:1437
const uint32_t cmt3
Special tag: root IFD of CR3 images.
Definition: tiffcomposite_int.hpp:54
const uint32_t fuji
Special tag: root IFD of Fujifilm RAF images.
Definition: tiffcomposite_int.hpp:52
size_t count() const
Return the number of components in this component.
Definition: tiffcomposite_int.cpp:736
size_t doSize() const override
Implements size(). Return the size of the TIFF directory, values and additional data, including the next-IFD, if any.
Definition: tiffcomposite_int.cpp:1272
IfdId group() const
Return the group.
Definition: tiffcomposite_int.hpp:82
TIFF composite visitor to read the TIFF structure from a block of memory and build the composite from...
Definition: tiffvisitor_int.hpp:579
void doEncode(TiffEncoder &encoder, const Exifdatum *datum) override
Implements encode().
Definition: tiffcomposite_int.cpp:708
size_t doWriteImage(IoWrapper &ioWrapper, ByteOrder byteOrder) const override
Implements writeImage(). Standard TIFF entries have no image data: write nothing and return 0...
Definition: tiffcomposite_int.cpp:1211
size_t doWrite(IoWrapper &ioWrapper, ByteOrder byteOrder, size_t offset, size_t valueIdx, size_t dataIdx, size_t &imageIdx) override
Implements write(). Write the sub-IFD pointers to the ioWrapper, return the number of bytes written...
Definition: tiffcomposite_int.cpp:1016
bool concat_
If true, concatenate gaps between defined tags to single tags.
Definition: tiffcomposite_int.hpp:1259
Search key for TIFF mapping structures.
Definition: tiffcomposite_int.hpp:368
const uint32_t next
Special tag: next IFD.
Definition: tiffcomposite_int.hpp:49
An interface for simple binary IO.
Definition: basicio.hpp:35
TiffComponent * addPath(uint16_t tag, TiffPath &tiffPath, TiffComponent *pRoot, UniquePtr object=nullptr)
Add a TIFF entry tag to the component. Components on the path to the entry are added if they don't ex...
Definition: tiffcomposite_int.cpp:409
void setStrips(const Value *pSize, const byte *pData, size_t sizeData, size_t baseOffset) override
Set the data areas ("strips").
Definition: tiffcomposite_int.cpp:219
std::vector< TiffComponent * > Components
Container type to hold all metadata.
Definition: tiffcomposite_int.hpp:157
void doAccept(TiffVisitor &visitor) override
Implements accept().
Definition: tiffcomposite_int.cpp:685
bool operator==(const Key &key) const
Compare a TiffMappingInfo with a TiffMappingInfo::Key. The two are equal if TiffMappingInfo::make_ eq...
Definition: tiffcomposite_int.cpp:27
void doAccept(TiffVisitor &visitor) override
Implements accept().
Definition: tiffcomposite_int.cpp:665
uint16_t tag() const
Return the tag corresponding to the extended tag.
Definition: tiffcomposite_int.hpp:354
uint32_t extendedTag_
Tag (32 bit so that it can contain special tags)
Definition: tiffcomposite_int.hpp:360
virtual ~TiffComponent()=default
Virtual destructor.
TiffComponent * doAddChild(TiffComponent::UniquePtr tiffComponent) override
Implements addChild(). The default implementation does nothing.
Definition: tiffcomposite_int.cpp:560
size_t doWriteData(IoWrapper &ioWrapper, ByteOrder byteOrder, size_t offset, size_t dataIdx, size_t &imageIdx) const override
This class does not really implement writeData(), it only has write(). This method must not be called...
Definition: tiffcomposite_int.cpp:1177
const TiffType ttUnsignedByte
Exif BYTE type.
Definition: tiffcomposite_int.hpp:24
TiffComponent * doAddPath(uint16_t tag, TiffPath &tiffPath, TiffComponent *pRoot, TiffComponent::UniquePtr object) override
Implements addPath(). The default implementation does nothing.
Definition: tiffcomposite_int.cpp:467
virtual int idx() const
Return the unique id of the entry in the image.
Definition: tiffcomposite_int.cpp:174
size_t doSizeImage() const override
Implements sizeImage(). Return the size of the image data area.
Definition: tiffcomposite_int.cpp:1426
const TiffType ttSignedLong
Exif SLONG type.
Definition: tiffcomposite_int.hpp:32
TiffComponent * doAddPath(uint16_t tag, TiffPath &tiffPath, TiffComponent *pRoot, TiffComponent::UniquePtr object) override
Implements addPath(). The default implementation does nothing.
Definition: tiffcomposite_int.cpp:494
size_t doSize() const override
Implements size(). Returns count * type-size, both taken from the element definition.
Definition: tiffcomposite_int.cpp:1350
TiffType tiffType_
TIFF type of the element.
Definition: tiffcomposite_int.hpp:1239
TiffDirectory & operator=(const TiffDirectory &)=delete
Assignment operator.
size_t doSizeData() const override
Implements sizeData(). Return 0.
Definition: tiffcomposite_int.cpp:1364
Composite to model an array of different tags. The tag types as well as other aspects of the array ar...
Definition: tiffcomposite_int.hpp:1275
TiffComponent * doAddPath(uint16_t tag, TiffPath &tiffPath, TiffComponent *pRoot, TiffComponent::UniquePtr object) override
Implements addPath(). Todo: Document it!
Definition: tiffcomposite_int.cpp:516
TiffEntry * doClone() const override
Internal virtual copy constructor, implements clone().
Definition: tiffcomposite_int.cpp:134
ByteOrder
Type to express the byte order (little or big endian)
Definition: types.hpp:34
constexpr TiffMnEntry(uint16_t tag, IfdId group, IfdId mnGroup)
Default constructor.
Definition: tiffcomposite_int.hpp:1015
uint16_t szTag() const
Return the group of the entry which has the size.
Definition: tiffcomposite_int.hpp:623
size_t doSizeImage() const override
Implements sizeImage(). Return the sum of the image sizes of all components plus that of the next-IFD...
Definition: tiffcomposite_int.cpp:1399
size_t defSize() const
Return the number of elements in the definition.
Definition: tiffcomposite_int.hpp:1336
bool initialize(IfdId group)
Setup cfg and def for the component, in case of a complex binary array. Else do nothing. Return true if the initialization succeeded, else false.
Definition: tiffcomposite_int.cpp:351
ArrayDef elDefaultDef_
Default element.
Definition: tiffcomposite_int.hpp:1260
std::shared_ptr< DataBuf > storage() const
Used (internally) to create another reference to the DataBuf reference by storage_.
Definition: tiffcomposite_int.hpp:537
void setData(byte *pData, size_t size, std::shared_ptr< DataBuf > storage)
Set pointer and size of the entry's data (not taking ownership of the data).
Definition: tiffcomposite_int.cpp:188
TiffComponent * doAddChild(TiffComponent::UniquePtr tiffComponent) override
Implements addChild(). The default implementation does nothing.
Definition: tiffcomposite_int.cpp:580
const Value * pValue() const
Return a const pointer to the converted value of this component.
Definition: tiffcomposite_int.hpp:477
virtual void setStrips(const Value *pSize, const byte *pData, size_t sizeData, size_t baseOffset)=0
Set the data areas ("strips").
size_t defSize_
Size of the array definition array.
Definition: tiffcomposite_int.hpp:1267
const uint32_t cmt4
Special tag: root IFD of CR3 images.
Definition: tiffcomposite_int.hpp:55
const uint32_t cmt2
Special tag: root IFD of CR3 images.
Definition: tiffcomposite_int.hpp:53
size_t doSize() const override
Implements size(). Todo: Document it!
Definition: tiffcomposite_int.cpp:1321
void setValue(Value::UniquePtr value)
Set tag value. Takes ownership of the pointer passed in.
Definition: tiffcomposite_int.cpp:210
virtual void doAccept(TiffVisitor &visitor)=0
Implements accept().
TiffIfdMakernote & operator=(const TiffIfdMakernote &)=delete
Assignment operator.
void encode(TiffEncoder &encoder, const Exifdatum *datum)
Encode a TIFF component from the metadatum provided and information from the encoder as needed...
Definition: tiffcomposite_int.cpp:700
size_t doSizeData() const override
Implements sizeData(). Return the size of the data area.
Definition: tiffcomposite_int.cpp:1377
size_t size(uint16_t tag, IfdId group) const
Get the size in bytes of a tag.
Definition: tiffcomposite_int.cpp:346
void doAccept(TiffVisitor &visitor) override
Implements accept().
Definition: tiffcomposite_int.cpp:696
void doAccept(TiffVisitor &visitor) override
Implements accept().
Definition: tiffcomposite_int.cpp:641
constexpr TiffSizeEntry(uint16_t tag, IfdId group, uint16_t dtTag, IfdId dtGroup)
Constructor.
Definition: tiffcomposite_int.hpp:783
const ArrayDef * elDef() const
Return the array definition of this element.
Definition: tiffcomposite_int.hpp:1431
TypeId
Exiv2 value type identifiers.
Definition: types.hpp:70
size_t doSize() const override
Implements size(). Return the size of the Makernote header, TIFF directory, values and additional dat...
Definition: tiffcomposite_int.cpp:1317
void updateValue(Value::UniquePtr value, ByteOrder byteOrder)
Update the value. Takes ownership of the pointer passed in.
Definition: tiffcomposite_int.cpp:196
size_t doWrite(IoWrapper &ioWrapper, ByteOrder byteOrder, size_t offset, size_t valueIdx, size_t dataIdx, size_t &imageIdx) override
Implements write(). Write pointers into the data area to the ioWrapper, relative to the offsets in th...
Definition: tiffcomposite_int.cpp:974
void setCount(size_t count)
Set the number of components in this entry.
Definition: tiffcomposite_int.hpp:494
~TiffIfdMakernote() override
Virtual destructor.
Definition: tiffcomposite_int.cpp:108
uint32_t e_
Extended tag.
Definition: tiffcomposite_int.hpp:370
TIFF composite visitor to decode metadata from the TIFF tree and add it to an Image, which is supplied in the constructor (Visitor pattern). Used by TiffParser to decode the metadata from a TIFF composite.
Definition: tiffvisitor_int.hpp:251
IfdId group_
Group for the elements.
Definition: tiffcomposite_int.hpp:1253
size_t doSizeData() const override
Implements sizeData(). Return the sum of the sizes of all sub-IFDs.
Definition: tiffcomposite_int.cpp:1383
TiffSizeEntry * doClone() const override
Internal virtual copy constructor, implements clone().
Definition: tiffcomposite_int.cpp:146
size_t doCount() const override
Implements count(). Return the number of entries in the TIFF directory. Does not count entries which ...
Definition: tiffcomposite_int.cpp:740
IfdId dtGroup() const
Return the group of the related entry which has the data area.
Definition: tiffcomposite_int.hpp:796
TiffMnEntry * doClone() const override
Internal virtual copy constructor, implements clone().
Definition: tiffcomposite_int.cpp:158
virtual size_t doSizeData() const =0
Implements sizeData().
size_t count_
Number of components.
Definition: tiffcomposite_int.hpp:1240
TiffComponent * doAddPath(uint16_t tag, TiffPath &tiffPath, TiffComponent *pRoot, TiffComponent::UniquePtr object) override
Implements addPath(). The default implementation does nothing.
Definition: tiffcomposite_int.cpp:419
TiffIfdMakernote(uint16_t tag, IfdId group, IfdId mnGroup, MnHeader *pHeader, bool hasNext=true)
Default constructor.
Definition: tiffcomposite_int.cpp:69
size_t doWriteImage(IoWrapper &ioWrapper, ByteOrder byteOrder) const override
Implements writeImage(). Write the image data area to the ioWrapper. Return the number of bytes writt...
Definition: tiffcomposite_int.cpp:1231
size_t doSize() const override
Implements size(). Return the size of the sub-Ifd pointers.
Definition: tiffcomposite_int.cpp:1306
void doAccept(TiffVisitor &visitor) override
Implements accept().
Definition: tiffcomposite_int.cpp:637
size_t ifdOffset() const
Return the offset to the start of the Makernote IFD from the start of the Makernote. Returns 0 if there is no header.
Definition: tiffcomposite_int.cpp:300
uint8_t byte
1 byte unsigned integer type.
Definition: types.hpp:26
const char * make_
Camera make for which these mapping functions apply.
Definition: tiffcomposite_int.hpp:359
This abstract base class provides the common functionality of an IFD directory entry and defines an e...
Definition: tiffcomposite_int.hpp:380
size_t doSize() const override
Implements size() by forwarding the call to the actual concrete Makernote, if there is one...
Definition: tiffcomposite_int.cpp:1310
size_t doWrite(IoWrapper &ioWrapper, ByteOrder byteOrder, size_t offset, size_t valueIdx, size_t dataIdx, size_t &imageIdx) override
Implements write() by forwarding the call to the actual concrete Makernote, if there is one...
Definition: tiffcomposite_int.cpp:1030
const uint32_t none
Dummy tag.
Definition: tiffcomposite_int.hpp:47
size_t sizeHeader() const
Return the size of the header in bytes.
Definition: tiffcomposite_int.cpp:334
const uint32_t all
Special tag: all tags in a group.
Definition: tiffcomposite_int.hpp:50
size_t doCount() const override
Implements count(). Return the number of entries in the IFD of the Makernote. Does not count entries ...
Definition: tiffcomposite_int.cpp:764
A TIFF IFD entry containing the size of a data area of a related TiffDataEntry. This component is use...
Definition: tiffcomposite_int.hpp:778
Combination of array configuration and definition for arrays.
Definition: tiffcomposite_int.hpp:1264
void doAccept(TiffVisitor &visitor) override
Implements accept().
Definition: tiffcomposite_int.cpp:625
void setByteOrder(ByteOrder byteOrder)
Set the byte order for the makernote.
Definition: tiffcomposite_int.cpp:329
TiffComponent::UniquePtr newTiffBinaryArray2(uint16_t tag, IfdId group)
Function to create and initialize a new complex binary array entry.
Definition: tiffcomposite_int.hpp:1528
constexpr TiffEntryBase(uint16_t tag, IfdId group, TiffType tiffType=ttUndefined)
Default constructor.
Definition: tiffcomposite_int.hpp:388
Utility class containing a character array. All it does is to take care of memory allocation and dele...
Definition: types.hpp:124
virtual TiffComponent * doClone() const =0
Internal virtual copy constructor, implements clone().
TiffComponent::UniquePtr newTiffThumbSize(uint16_t tag, IfdId group)
Function to create and initialize a new TIFF entry for a thumbnail (size)
Definition: tiffcomposite_int.hpp:1540
bool hasSize_
If true, first tag is the size element.
Definition: tiffcomposite_int.hpp:1257
Simple IO wrapper to ensure that the header is only written if there is any other data at all...
Definition: tiffcomposite_int.hpp:102
TiffComponent * doAddChild(TiffComponent::UniquePtr tiffComponent) override
Implements addChild(). The default implementation does nothing.
Definition: tiffcomposite_int.cpp:566
A standard TIFF IFD entry consisting of a value which is an offset to a data area and the data area...
Definition: tiffcomposite_int.hpp:649
const TiffType ttUnsignedShort
Exif SHORT type.
Definition: tiffcomposite_int.hpp:26
~TiffEntryBase() override
Virtual destructor.
Definition: tiffcomposite_int.cpp:100
DataBuf(*)(uint16_t, const byte *, size_t, TiffComponent *) CryptFct
Function pointer type for a crypt function used for binary arrays.
Definition: tiffcomposite_int.hpp:1227
DecoderFct decoderFct_
Decoder function for matching tags.
Definition: tiffcomposite_int.hpp:362
virtual size_t doSize() const =0
Implements size().
IfdId
Type to specify the IFD to which a metadata belongs.
Definition: tags.hpp:34
const ArrayDef * def() const
Return a pointer to the definition.
Definition: tiffcomposite_int.hpp:1332
TypeId toTypeId(TiffType tiffType, uint16_t tag, IfdId group)
Convert the tiffType of a tag and group to an Exiv2 typeId.
Definition: tiffcomposite_int.cpp:1458
size_t doSizeData() const override
Implements sizeData(). Return the size of the image data area.
Definition: tiffcomposite_int.cpp:1368
TiffComponent * doAddChild(TiffComponent::UniquePtr tiffComponent) override
Implements addChild(). Todo: Document it!
Definition: tiffcomposite_int.cpp:584
virtual size_t doWriteData(IoWrapper &ioWrapper, ByteOrder byteOrder, size_t offset, size_t dataIdx, size_t &imageIdx) const =0
Implements writeData().
This class models a TIFF sub-directory (sub-IFD). A sub-IFD is an entry with one or more values that ...
Definition: tiffcomposite_int.hpp:932
size_t size() const
Return the size in bytes of the IFD value of this component when written to a binary image...
Definition: tiffcomposite_int.cpp:1268
virtual void doEncode(TiffEncoder &encoder, const Exifdatum *datum)=0
Implements encode().
ArrayCfg cfg_
Binary array configuration.
Definition: tiffcomposite_int.hpp:1265
~TiffSubIfd() override
Virtual destructor.
Definition: tiffcomposite_int.cpp:94
const ArrayDef * def_
Binary array definition array.
Definition: tiffcomposite_int.hpp:1266
void doEncode(TiffEncoder &encoder, const Exifdatum *datum) override
Implements encode().
Definition: tiffcomposite_int.cpp:712
size_t doCount() const override
Implements count(). Return number of components in the entry.
Definition: tiffcomposite_int.cpp:748
TiffComponent * doAddChild(TiffComponent::UniquePtr tiffComponent) override
Implements addChild(). The default implementation does nothing.
Definition: tiffcomposite_int.cpp:572
size_t write(const byte *pData, size_t wcount)
Wraps the corresponding BasicIo::write() method.
Definition: tiffcomposite_int.cpp:38
size_t sizeData() const
Return the size in bytes of the IFD data of this component when written to a binary image...
Definition: tiffcomposite_int.cpp:1356
std::stack< TiffPathItem > TiffPath
Stack to hold a path from the TIFF root element to a TIFF entry.
Definition: tifffwd_int.hpp:77
TiffComponent::UniquePtr newTiffImageSize(uint16_t tag, IfdId group)
Function to create and initialize a new TIFF entry for image data (size)
Definition: tiffcomposite_int.hpp:1552
TiffType tiffType() const
Return the TIFF type.
Definition: tiffcomposite_int.hpp:455
TiffType elTiffType_
Type for the array entry and the size element, if any.
Definition: tiffcomposite_int.hpp:1255
TiffSubIfd(uint16_t tag, IfdId group, IfdId newGroup)
Default constructor.
Definition: tiffcomposite_int.cpp:65
Interface class for components of a TIFF directory hierarchy (Composite pattern). Both TIFF directori...
Definition: tiffcomposite_int.hpp:152
~TiffDirectory() override
Virtual destructor.
Definition: tiffcomposite_int.cpp:87
const TiffType ttAsciiString
Exif ASCII type.
Definition: tiffcomposite_int.hpp:25
TiffComponent * doAddNext(TiffComponent::UniquePtr tiffComponent) override
Implements addNext(). The default implementation does nothing.
Definition: tiffcomposite_int.cpp:616
TiffType toTiffType(TypeId typeId)
Convert the Exiv2 typeId to a TIFF value type.
Definition: tiffcomposite_int.cpp:1475
void doEncode(TiffEncoder &encoder, const Exifdatum *datum) override
Implements encode().
Definition: tiffcomposite_int.cpp:716
byte * start() const
Return a pointer to the start of the binary representation of the component.
Definition: tiffcomposite_int.hpp:242
const TiffType ttTiffFloat
TIFF FLOAT type.
Definition: tiffcomposite_int.hpp:34
TiffComponent::UniquePtr newTiffEntry(uint16_t tag, IfdId group)
Function to create and initialize a new TIFF entry.
Definition: tiffcomposite_int.cpp:1496
uint16_t dtTag() const
Return the group of the related entry which has the data area.
Definition: tiffcomposite_int.hpp:792
void accept(TiffVisitor &visitor)
Interface to accept visitors (Visitor pattern). Visitors can perform operations on all components of ...
Definition: tiffcomposite_int.cpp:620
bool hasFillers_
If true, write all defined tags.
Definition: tiffcomposite_int.hpp:1258
int(*)(uint16_t, const byte *, size_t, TiffComponent *) CfgSelFct
Function pointer type for a function to determine which cfg + def of a corresponding array set to use...
Definition: tiffcomposite_int.hpp:1224
size_t doWrite(IoWrapper &ioWrapper, ByteOrder byteOrder, size_t offset, size_t valueIdx, size_t dataIdx, size_t &imageIdx) override
Implements write(). Todo: Document it!
Definition: tiffcomposite_int.cpp:1107
size_t offset() const
Return the offset to the data area relative to the base for the component (usually the start of the T...
Definition: tiffcomposite_int.hpp:462
size_t baseOffset() const
Return the base offset for use with the makernote IFD entries relative to the start of the TIFF heade...
Definition: tiffcomposite_int.cpp:317
void doEncode(TiffEncoder &encoder, const Exifdatum *datum) override
Implements encode().
Definition: tiffcomposite_int.cpp:724
std::unique_ptr< TiffComponent > UniquePtr
TiffComponent auto_ptr type.
Definition: tiffcomposite_int.hpp:155
bool operator==(size_t idx) const
Comparison with idx.
Definition: tiffcomposite_int.hpp:1232
Abstract base class defining the interface for TIFF composite visitors (Visitor pattern) ...
Definition: tiffvisitor_int.hpp:39
size_t doSizeImage() const override
Implements sizeImage(). Return the sum of the image sizes of all sub-IFDs.
Definition: tiffcomposite_int.cpp:1410
size_t doWriteData(IoWrapper &ioWrapper, ByteOrder byteOrder, size_t offset, size_t dataIdx, size_t &imageIdx) const override
Implements writeData(). Write the sub-IFDs to the ioWrapper. Return the number of bytes written...
Definition: tiffcomposite_int.cpp:1163
TiffBinaryArray(uint16_t tag, IfdId group, const ArrayCfg &arrayCfg, const ArrayDef *arrayDef, size_t defSize)
Constructor.
Definition: tiffcomposite_int.cpp:73
TiffComponent::UniquePtr newTiffMnEntry(uint16_t tag, IfdId group)
Function to create and initialize a new TIFF makernote entry.
Definition: tiffcomposite_int.cpp:1500
void setIdx(int idx)
Set the unique id of the entry in the image.
Definition: tiffcomposite_int.hpp:498
void doEncode(TiffEncoder &encoder, const Exifdatum *datum) override
Implements encode().
Definition: tiffcomposite_int.cpp:732
A standard TIFF IFD entry.
Definition: tiffcomposite_int.hpp:568
size_t doWriteImage(IoWrapper &ioWrapper, ByteOrder byteOrder) const override
Implements writeImage(). Write the image data of the IFD of the Makernote. Return the number of bytes...
Definition: tiffcomposite_int.cpp:1223
bool readHeader(const byte *pData, size_t size, ByteOrder byteOrder)
Read the header from a data buffer, return true if successful.
Definition: tiffcomposite_int.cpp:323
uint16_t TiffType
TIFF value type.
Definition: tiffcomposite_int.hpp:22
void setElByteOrder(ByteOrder byteOrder)
Set the byte order of this element.
Definition: tiffcomposite_int.hpp:1421
const uint32_t pana
Special tag: root IFD of Panasonic RAW images.
Definition: tiffcomposite_int.hpp:51
size_t writeData(IoWrapper &ioWrapper, ByteOrder byteOrder, size_t offset, size_t dataIdx, size_t &imageIdx) const
Write the IFD data of this component to a binary image. Return the number of bytes written...
Definition: tiffcomposite_int.cpp:1118
const byte * pData() const
Return a pointer to the binary representation of the value of this component.
Definition: tiffcomposite_int.hpp:473
bool cmpTagLt(const TiffComponent *lhs, const TiffComponent *rhs)
Compare two TIFF component pointers by tag. Return true if the tag of component lhs is less than that...
Definition: tiffcomposite_int.cpp:1486
size_t doWrite(IoWrapper &ioWrapper, ByteOrder byteOrder, size_t offset, size_t valueIdx, size_t dataIdx, size_t &imageIdx) override
Implements write(). Write the TIFF directory, values and additional data, including the next-IFD...
Definition: tiffcomposite_int.cpp:797
int idx() const override
Return the unique id of the entry in the image.
Definition: tiffcomposite_int.cpp:178
virtual size_t doWrite(IoWrapper &ioWrapper, ByteOrder byteOrder, size_t offset, size_t valueIdx, size_t dataIdx, size_t &imageIdx)=0
Implements write().
TiffComponent * doAddNext(TiffComponent::UniquePtr tiffComponent) override
Implements addNext(). The default implementation does nothing.
Definition: tiffcomposite_int.cpp:608
void doEncode(TiffEncoder &encoder, const Exifdatum *datum) override
Implements encode().
Definition: tiffcomposite_int.cpp:720
TiffBinaryArray * doClone() const override
Internal virtual copy constructor, implements clone().
Definition: tiffcomposite_int.cpp:166
virtual TiffComponent * doAddNext(UniquePtr tiffComponent)
Implements addNext(). The default implementation does nothing.
Definition: tiffcomposite_int.cpp:595
void setTarget(int id, size_t target)
Wrapper for OffsetWriter::setTarget(), using an int instead of the enum to reduce include deps...
Definition: tiffcomposite_int.cpp:54
TiffDirectory(uint16_t tag, IfdId group, bool hasNext=true)
Default constructor.
Definition: tiffcomposite_int.cpp:62
~TiffBinaryArray() override
Virtual destructor.
Definition: tiffcomposite_int.cpp:112
int putb(byte data)
Wraps the corresponding BasicIo::putb() method.
Definition: tiffcomposite_int.cpp:46
Additional configuration for a binary array.
Definition: tiffcomposite_int.hpp:1244
size_t doSizeImage() const override
Implements sizeImage(). Return the total image data size of the makernote IFD.
Definition: tiffcomposite_int.cpp:1418
TiffSubIfd * doClone() const override
Internal virtual copy constructor, implements clone().
Definition: tiffcomposite_int.cpp:154
void doEncode(TiffEncoder &encoder, const Exifdatum *datum) override
Implements encode().
Definition: tiffcomposite_int.cpp:728
bool decoded() const
Return the flag which indicates if the array was decoded.
Definition: tiffcomposite_int.hpp:1340
uint32_t extendedTag() const
Return the extended tag (32 bit so that it can contain special tags)
Definition: tiffcomposite_int.hpp:78
TiffComponent * addChild(UniquePtr tiffComponent)
Add a child to the component. Default is to do nothing.
Definition: tiffcomposite_int.cpp:552
size_t write(IoWrapper &ioWrapper, ByteOrder byteOrder, size_t offset, size_t valueIdx, size_t dataIdx, size_t &imageIdx)
Write a TiffComponent to a binary image.
Definition: tiffcomposite_int.cpp:792
size_t doCount() const override
Implements count(). Returns the count from the element definition.
Definition: tiffcomposite_int.cpp:788
TiffMnEntry & operator=(const TiffMnEntry &)=delete
Assignment operator.
TiffBinaryElement * doClone() const override
Internal virtual copy constructor, implements clone().
Definition: tiffcomposite_int.cpp:170
TiffComponent::UniquePtr newTiffDirectory(uint16_t tag, IfdId)
Function to create and initialize a new TIFF directory.
Definition: tiffcomposite_int.hpp:1504
Interface for a standard TIFF IFD entry consisting of a value which is a set of offsets to a data are...
Definition: tiffcomposite_int.hpp:598
void setDecoded(bool decoded)
Set a flag to indicate if the array was decoded.
Definition: tiffcomposite_int.hpp:1320
void setStart(const byte *pStart)
Set a pointer to the start of the binary representation of the component in a memory buffer...
Definition: tiffcomposite_int.hpp:210
TiffEntryBase & operator=(const TiffEntryBase &)=delete
Assignment operator.
constexpr TiffEntry(uint16_t tag, IfdId group)
Constructor.
Definition: tiffcomposite_int.hpp:573
Class to insert pointers or offsets to computed addresses at specific locations in an image...
Definition: tiffimage_int.hpp:295
const TiffType ttSignedByte
Exif SBYTE type.
Definition: tiffcomposite_int.hpp:29
Tiff IFD Makernote. This is a concrete class suitable for all IFD makernotes.
Definition: tiffcomposite_int.hpp:1079
Common interface for all types of values used with metadata.
Definition: value.hpp:33
void setOffset(size_t offset)
Set the offset.
Definition: tiffcomposite_int.hpp:413
const TiffType ttUnsignedLong
Exif LONG type.
Definition: tiffcomposite_int.hpp:27
virtual size_t doWriteImage(IoWrapper &ioWrapper, ByteOrder byteOrder) const =0
Implements writeImage().
size_t doSize() const override
Implements size(). Return the size of a standard TIFF entry.
Definition: tiffcomposite_int.cpp:1298
void setStrips(const Value *pSize, const byte *pData, size_t sizeData, size_t baseOffset) override
Set the data areas ("strips").
Definition: tiffcomposite_int.cpp:268
TiffDataEntryBase(uint16_t tag, IfdId group, uint16_t szTag, IfdId szGroup)
Constructor.
Definition: tiffvisitor_int.cpp:343
size_t doSizeData() const override
This class does not really implement sizeData(), it only has size(). This method must not be called; ...
Definition: tiffcomposite_int.cpp:1391
TiffComponent::UniquePtr newTiffBinaryArray0(uint16_t tag, IfdId group)
Function to create and initialize a new binary array entry.
Definition: tiffcomposite_int.hpp:1516
void doEncode(TiffEncoder &encoder, const Exifdatum *datum) override
Implements encode().
Definition: tiffcomposite_int.cpp:704
std::string m_
Camera make.
Definition: tiffcomposite_int.hpp:369
TiffComponent::UniquePtr newTiffImageData(uint16_t tag, IfdId group)
Function to create and initialize a new TIFF entry for image data.
Definition: tiffcomposite_int.hpp:1546
A standard TIFF IFD entry consisting of a value which is an array of offsets to image data areas...
Definition: tiffcomposite_int.hpp:714
const ArrayCfg * cfg() const
Return a pointer to the configuration.
Definition: tiffcomposite_int.hpp:1328
const TiffType ttUndefined
Exif UNDEFINED type.
Definition: tiffcomposite_int.hpp:30
size_t doWrite(IoWrapper &ioWrapper, ByteOrder byteOrder, size_t offset, size_t valueIdx, size_t dataIdx, size_t &imageIdx) override
Implements write(). Write the value of a standard TIFF entry to the ioWrapper, return the number of b...
Definition: tiffcomposite_int.cpp:944
IfdId g_
Group
Definition: tiffcomposite_int.hpp:371
void setElDef(const ArrayDef &def)
Set the array definition for this element.
Definition: tiffcomposite_int.hpp:1415
size_t doWrite(IoWrapper &ioWrapper, ByteOrder byteOrder, size_t offset, size_t valueIdx, size_t dataIdx, size_t &imageIdx) override
Implements write(). Write pointers into the image data area to the ioWrapper. Return the number of by...
Definition: tiffcomposite_int.cpp:992
~TiffMnEntry() override
Virtual destructor.
Definition: tiffcomposite_int.cpp:104
size_t addElement(size_t idx, const ArrayDef &def)
Add an element to the binary array, return the size of the element.
Definition: tiffcomposite_int.cpp:393
EncoderFct encoderFct_
Encoder function for matching tags.
Definition: tiffcomposite_int.hpp:363
TiffComponent::UniquePtr newTiffSubIfd(uint16_t tag, IfdId group)
Function to create and initialize a new TIFF sub-directory.
Definition: tiffcomposite_int.hpp:1510
IfdId group_
Group that contains the tag.
Definition: tiffcomposite_int.hpp:361
uint16_t tag() const
Return the tag of this entry.
Definition: tiffcomposite_int.hpp:234
virtual size_t doSizeImage() const =0
Implements sizeImage().
const TiffType ttTiffIfd
TIFF IFD type.
Definition: tiffcomposite_int.hpp:36
IfdId group() const
Return the group id of this component.
Definition: tiffcomposite_int.hpp:238
Class CrwImage to access Canon CRW images. References: The Canon RAW (CRW) File Format by Phil Harv...
Definition: asfvideo.hpp:15
void setImageByteOrder(ByteOrder byteOrder)
Set the byte order used for the image.
Definition: tiffcomposite_int.hpp:1120
This class models a TIFF directory (Ifd). It is a composite component of the TIFF tree...
Definition: tiffcomposite_int.hpp:823
virtual TiffComponent * doAddPath(uint16_t tag, TiffPath &tiffPath, TiffComponent *pRoot, TiffComponent::UniquePtr object)
Implements addPath(). The default implementation does nothing.
Definition: tiffcomposite_int.cpp:414
size_t mnOffset() const
Return the offset to the makernote from the start of the TIFF header.
Definition: tiffcomposite_int.cpp:313
const uint32_t root
Special tag: root IFD.
Definition: tiffcomposite_int.hpp:48
size_t doSize() const override
Implements size(). Return the size of the strip pointers.
Definition: tiffcomposite_int.cpp:1302
static size_t writeOffset(byte *buf, size_t offset, TiffType tiffType, ByteOrder byteOrder)
Helper function to write an offset to a preallocated binary buffer.
Definition: tiffcomposite_int.cpp:955
TIFF composite visitor to encode metadata from an image to the TIFF tree. The metadata containers and...
Definition: tiffvisitor_int.hpp:343
IfdId szGroup() const
Return the group of the entry which has the size.
Definition: tiffcomposite_int.hpp:627
size_t doWrite(IoWrapper &ioWrapper, ByteOrder byteOrder, size_t offset, size_t valueIdx, size_t dataIdx, size_t &imageIdx) override
Implements write(). Write the Makernote header, TIFF directory, values and additional data to the ioW...
Definition: tiffcomposite_int.cpp:1038
bool cmpGroupLt(const TiffComponent *lhs, const TiffComponent *rhs)
Compare two TIFF component pointers by group. Return true if the group of component lhs is less than ...
Definition: tiffcomposite_int.cpp:1492
size_t doWriteImage(IoWrapper &ioWrapper, ByteOrder byteOrder) const override
Implements writeImage(). Write the image data of each sub-IFD to the ioWrapper. Return the number of ...
Definition: tiffcomposite_int.cpp:1215
TiffComponent * doAddNext(TiffComponent::UniquePtr tiffComponent) override
Implements addNext(). The default implementation does nothing.
Definition: tiffcomposite_int.cpp:599
TiffImageEntry * doClone() const override
Internal virtual copy constructor, implements clone().
Definition: tiffcomposite_int.cpp:142
UniquePtr clone() const
Return an auto-pointer to a copy of itself (deep copy, but without any children). The caller owns thi...
Definition: tiffcomposite_int.cpp:130
void doAccept(TiffVisitor &visitor) override
Implements accept().
Definition: tiffcomposite_int.cpp:633
An Exif metadatum, consisting of an ExifKey and a Value and methods to manipulate these...
Definition: exif.hpp:41
size_t doSizeData() const override
This class does not really implement sizeData(), it only has size(). This method must not be called; ...
Definition: tiffcomposite_int.cpp:1360
Element of a TiffBinaryArray.
Definition: tiffcomposite_int.hpp:1406
TiffComponent::UniquePtr newTiffThumbData(uint16_t tag, IfdId group)
Function to create and initialize a new TIFF entry for a thumbnail (data)
Definition: tiffcomposite_int.hpp:1534
size_t doWriteData(IoWrapper &ioWrapper, ByteOrder byteOrder, size_t offset, size_t dataIdx, size_t &imageIdx) const override
Implements writeData(). Write the data area to the ioWrapper. Return the number of bytes written...
Definition: tiffcomposite_int.cpp:1147
size_t doWriteData(IoWrapper &ioWrapper, ByteOrder byteOrder, size_t offset, size_t dataIdx, size_t &imageIdx) const override
Implements writeData(). Standard TIFF entries have no data: write nothing and return 0...
Definition: tiffcomposite_int.cpp:1132
TiffIfdMakernote * doClone() const override
Internal virtual copy constructor, implements clone().
Definition: tiffcomposite_int.cpp:162
size_t doWriteImage(IoWrapper &ioWrapper, ByteOrder byteOrder) const override
Implements writeImage(). Write the image data of the TIFF directory to the ioWrapper by forwarding th...
Definition: tiffcomposite_int.cpp:1186
void(TiffEncoder::*)(TiffEntryBase *, const Exifdatum *) EncoderFct
Function pointer type for a TiffDecoder member function to decode a TIFF component.
Definition: tifffwd_int.hpp:60
void(TiffDecoder::*)(const TiffEntryBase *) DecoderFct
Function pointer type for a TiffDecoder member function to decode a TIFF component.
Definition: tifffwd_int.hpp:55
size_t doWriteData(IoWrapper &ioWrapper, ByteOrder byteOrder, size_t offset, size_t dataIdx, size_t &imageIdx) const override
This class does not really implement writeData(), it only has write(). This method must not be called...
Definition: tiffcomposite_int.cpp:1123
TiffDirectory * doClone() const override
Internal virtual copy constructor, implements clone().
Definition: tiffcomposite_int.cpp:150
TiffComponent::UniquePtr newTiffBinaryArray1(uint16_t tag, IfdId group)
Function to create and initialize a new simple binary array entry.
Definition: tiffcomposite_int.hpp:1522
size_t idx_
Index in bytes from the start.
Definition: tiffcomposite_int.hpp:1238
ByteOrder byteOrder() const
Return the byte order for the makernote. Requires the image byte order to be set (setImageByteOrder()...
Definition: tiffcomposite_int.cpp:306
const TiffType ttUnsignedRational
Exif RATIONAL type.
Definition: tiffcomposite_int.hpp:28
size_t doCount() const override
Implements count().
Definition: tiffcomposite_int.cpp:744
bool updOrigDataBuf(const byte *pData, size_t size)
Update the original data buffer and its size, return true if successful.
Definition: tiffcomposite_int.cpp:384
bool hasNext() const
Return true if the directory has a next pointer.
Definition: tiffcomposite_int.hpp:845
size_t doCount() const override
Implements count(). Todo: Document it!
Definition: tiffcomposite_int.cpp:768
Defines one tag in a binary array.
Definition: tiffcomposite_int.hpp:1230
A tuple consisting of extended Tag and group used as an item in TIFF paths.
Definition: tiffcomposite_int.hpp:62
constexpr TiffComponent(uint16_t tag, IfdId group)
Constructor.
Definition: tiffcomposite_int.hpp:162
virtual TiffComponent * doAddChild(UniquePtr tiffComponent)
Implements addChild(). The default implementation does nothing.
Definition: tiffcomposite_int.cpp:556
virtual size_t doCount() const =0
Implements count().
constexpr TiffPathItem(uint32_t extendedTag, IfdId group)
Constructor.
Definition: tiffcomposite_int.hpp:67
size_t doWrite(IoWrapper &ioWrapper, ByteOrder byteOrder, size_t offset, size_t valueIdx, size_t dataIdx, size_t &imageIdx) override
Implements write(). Todo: Document it!
Definition: tiffcomposite_int.cpp:1048
ByteOrder byteOrder_
Byte order, invalidByteOrder to inherit.
Definition: tiffcomposite_int.hpp:1254
TiffComponent * addNext(UniquePtr tiffComponent)
Add a "next" component to the component. Default is to do nothing.
Definition: tiffcomposite_int.cpp:591
const TiffType ttSignedRational
Exif SRATIONAL type.
Definition: tiffcomposite_int.hpp:33
TIFF mapping table for functions to decode special cases.
Definition: tiffcomposite_int.hpp:342
size_t doSizeImage() const override
Implements sizeImage(). Return 0.
Definition: tiffcomposite_int.cpp:1422
void iniOrigDataBuf()
Initialize the original data buffer and its size from the base entry.
Definition: tiffcomposite_int.cpp:379
void doAccept(TiffVisitor &visitor) override
Implements accept().
Definition: tiffcomposite_int.cpp:676
const TiffType ttSignedShort
Exif SSHORT type.
Definition: tiffcomposite_int.hpp:31
IoWrapper(BasicIo &io, const byte *pHeader, size_t size, OffsetWriter *pow)
Definition: tiffcomposite_int.cpp:32
size_t sizeImage() const
Return the size in bytes of the image data of this component when written to a binary image...
Definition: tiffcomposite_int.cpp:1395
std::unique_ptr< Value > UniquePtr
Shortcut for a Value auto pointer.
Definition: value.hpp:36
TiffComponent * doAddPath(uint16_t tag, TiffPath &tiffPath, TiffComponent *pRoot, TiffComponent::UniquePtr object) override
Implements addPath(). The default implementation does nothing.
Definition: tiffcomposite_int.cpp:511
size_t doWriteData(IoWrapper &ioWrapper, ByteOrder byteOrder, size_t offset, size_t dataIdx, size_t &imageIdx) const override
Implements writeData(). Write the image data area to the ioWrapper. Return the number of bytes writte...
Definition: tiffcomposite_int.cpp:1137
size_t tagStep() const
Return the size of the default tag, which is used to calculate tag numbers as idx/tagStep.
Definition: tiffcomposite_int.hpp:1249
size_t writeImage(IoWrapper &ioWrapper, ByteOrder byteOrder) const
Write the image data of this component to a binary image. Return the number of bytes written...
Definition: tiffcomposite_int.cpp:1182
size_t writeHeader(IoWrapper &ioWrapper, ByteOrder byteOrder) const
Write the header to a data buffer, return the number of bytes written.
Definition: tiffcomposite_int.cpp:340
TiffDataEntry * doClone() const override
Internal virtual copy constructor, implements clone().
Definition: tiffcomposite_int.cpp:138