Exiv2
Loading...
Searching...
No Matches
tiffcomposite_int.hpp
1// SPDX-License-Identifier: GPL-2.0-or-later
2
3#ifndef TIFFCOMPOSITE_INT_HPP_
4#define TIFFCOMPOSITE_INT_HPP_
5
6// *****************************************************************************
7// included header files
8#include "tifffwd_int.hpp"
9
10#include <memory>
11
12// *****************************************************************************
13// namespace extensions
14namespace Exiv2 {
15class BasicIo;
16
17namespace Internal {
18// *****************************************************************************
19// class definitions
20
22using TiffType = uint16_t;
23
36const TiffType ttTiffIfd = 13;
37
39TypeId toTypeId(TiffType tiffType, uint16_t tag, IfdId group);
42
46namespace Tag {
47const uint32_t none = 0x10000;
48const uint32_t root = 0x20000;
49const uint32_t next = 0x30000;
50const uint32_t all = 0x40000;
51const uint32_t pana = 0x80000;
52const uint32_t fuji = 0x100000;
53const uint32_t cmt2 = 0x110000;
54const uint32_t cmt3 = 0x120000;
55const uint32_t cmt4 = 0x130000;
56} // namespace Tag
57
63 public:
65
66
67 constexpr TiffPathItem(uint32_t extendedTag, IfdId group) : extendedTag_(extendedTag), group_(group) {
68 }
69
70
72
73
74 [[nodiscard]] uint16_t tag() const {
75 return static_cast<uint16_t>(extendedTag_ & 0xffff);
76 }
77
78 [[nodiscard]] uint32_t extendedTag() const {
79 return extendedTag_;
80 }
81
82 [[nodiscard]] IfdId group() const {
83 return group_;
84 }
85
86
87 private:
88 // DATA
89 uint32_t extendedTag_;
90 IfdId group_;
91};
92
103 public:
105
106
112 IoWrapper(BasicIo& io, const byte* pHeader, size_t size, OffsetWriter* pow);
114
116
117
123 size_t write(const byte* pData, size_t wcount);
130 int putb(byte data);
132 void setTarget(int id, size_t target);
134
135 private:
136 // DATA
137 BasicIo& io_;
138 const byte* pHeader_;
139 size_t size_;
140 bool wroteHeader_{false};
141 OffsetWriter* pow_;
142};
143
153 public:
155 using UniquePtr = std::unique_ptr<TiffComponent>;
157 using Components = std::vector<TiffComponent*>;
158
160
161
162 constexpr TiffComponent(uint16_t tag, IfdId group) : tag_(tag), group_(group) {
163 }
164
165 virtual ~TiffComponent() = default;
166 TiffComponent(const TiffComponent&) = default;
167 TiffComponent& operator=(const TiffComponent&) = default;
169
171
172
184 TiffComponent* addPath(uint16_t tag, TiffPath& tiffPath, TiffComponent* pRoot, UniquePtr object = nullptr);
190 TiffComponent* addChild(UniquePtr tiffComponent);
197 TiffComponent* addNext(UniquePtr tiffComponent);
204 void accept(TiffVisitor& visitor);
210 void setStart(const byte* pStart) {
211 pStart_ = const_cast<byte*>(pStart);
212 }
213
227 size_t write(IoWrapper& ioWrapper, ByteOrder byteOrder, size_t offset, size_t valueIdx, size_t dataIdx,
228 size_t& imageIdx);
230
232
233
234 [[nodiscard]] uint16_t tag() const {
235 return tag_;
236 }
237
238 [[nodiscard]] IfdId group() const {
239 return group_;
240 }
241
242 [[nodiscard]] byte* start() const {
243 return pStart_;
244 }
245
250 [[nodiscard]] UniquePtr clone() const;
256 size_t writeData(IoWrapper& ioWrapper, ByteOrder byteOrder, size_t offset, size_t dataIdx, size_t& imageIdx) const;
262 size_t writeImage(IoWrapper& ioWrapper, ByteOrder byteOrder) const;
267 [[nodiscard]] size_t size() const;
271 [[nodiscard]] size_t count() const;
278 [[nodiscard]] size_t sizeData() const;
285 [[nodiscard]] size_t sizeImage() const;
289 // Todo: This is only implemented in TiffEntryBase. It is needed here so that
290 // we can sort components by tag and idx. Something is not quite right.
291 [[nodiscard]] virtual int idx() const;
293
294 protected:
296
297
298 virtual TiffComponent* doAddPath(uint16_t tag, TiffPath& tiffPath, TiffComponent* pRoot,
301 virtual TiffComponent* doAddChild(UniquePtr tiffComponent);
303 virtual TiffComponent* doAddNext(UniquePtr tiffComponent);
305 virtual void doAccept(TiffVisitor& visitor) = 0;
307 virtual size_t doWrite(IoWrapper& ioWrapper, ByteOrder byteOrder, size_t offset, size_t valueIdx, size_t dataIdx,
308 size_t& imageIdx) = 0;
310
312
313
314 [[nodiscard]] virtual TiffComponent* doClone() const = 0;
316 virtual size_t doWriteData(IoWrapper& ioWrapper, ByteOrder byteOrder, size_t offset, size_t dataIdx,
317 size_t& imageIdx) const = 0;
319 virtual size_t doWriteImage(IoWrapper& ioWrapper, ByteOrder byteOrder) 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;
329
330 private:
331 // DATA
332 uint16_t tag_;
333 IfdId group_;
338 byte* pStart_{};
339};
340
343 struct Key;
352 bool operator==(const Key& key) const;
354 [[nodiscard]] uint16_t tag() const {
355 return static_cast<uint16_t>(extendedTag_ & 0xffff);
356 }
357
358 // DATA
359 const char* make_;
360 uint32_t extendedTag_;
364
365}; // struct TiffMappingInfo
366
369 std::string m_;
370 uint32_t e_;
372};
373
381 friend class TiffReader;
382 friend class TiffEncoder;
383
384 public:
386
387
389 TiffComponent(tag, group), tiffType_(tiffType) {
390 }
391
393 ~TiffEntryBase() override;
395
397
398
401
403
404
411 void encode(TiffEncoder& encoder, const Exifdatum* datum);
413 void setOffset(size_t offset) {
414 offset_ = offset;
415 }
416
431 void setData(byte* pData, size_t size, std::shared_ptr<DataBuf> storage);
437 void setData(std::shared_ptr<DataBuf> buf);
443 void updateValue(Value::UniquePtr value, ByteOrder byteOrder);
449 void setValue(Value::UniquePtr value);
451
453
454
455 [[nodiscard]] TiffType tiffType() const {
456 return tiffType_;
457 }
458
462 [[nodiscard]] size_t offset() const {
463 return offset_;
464 }
465
468 [[nodiscard]] int idx() const override;
473 [[nodiscard]] const byte* pData() const {
474 return pData_;
475 }
476
477 [[nodiscard]] const Value* pValue() const {
478 return pValue_;
479 }
480
481
482 protected:
484
485
486 TiffEntryBase(const TiffEntryBase& rhs);
488
490
491
492 virtual void doEncode(TiffEncoder& encoder, const Exifdatum* datum) = 0;
494 void setCount(size_t count) {
495 count_ = count;
496 }
497
498 void setIdx(int idx) {
499 idx_ = idx;
500 }
501
506 size_t doWrite(IoWrapper& ioWrapper, ByteOrder byteOrder, size_t offset, size_t valueIdx, size_t dataIdx,
507 size_t& imageIdx) override;
509
511
512
513 [[nodiscard]] size_t doCount() const override;
518 size_t doWriteData(IoWrapper& ioWrapper, ByteOrder byteOrder, size_t offset, size_t dataIdx,
519 size_t& imageIdx) const override;
524 size_t doWriteImage(IoWrapper& ioWrapper, ByteOrder byteOrder) const override;
526 [[nodiscard]] size_t doSize() const override;
528 [[nodiscard]] size_t doSizeData() const override;
530 [[nodiscard]] size_t doSizeImage() const override;
532
534 static size_t writeOffset(byte* buf, size_t offset, TiffType tiffType, ByteOrder byteOrder);
535
537 [[nodiscard]] std::shared_ptr<DataBuf> storage() const {
538 return storage_;
539 }
540
541 private:
542 // DATA
543 TiffType tiffType_;
544 size_t count_{};
545 size_t offset_{};
546 size_t size_{};
547
548 // Notes on the ownership model of pData_: pData_ is a always a
549 // pointer to a buffer owned by somebody else. Usually it is a
550 // pointer into a copy of the image file, but if
551 // TiffEntryBase::setData is used then it is a pointer into the
552 // storage_ DataBuf below.
553 byte* pData_{};
554
555 int idx_{};
556 Value* pValue_{};
557
558 // This DataBuf is only used when TiffEntryBase::setData is called.
559 // Otherwise, it remains empty. It is wrapped in a shared_ptr because
560 // TiffEntryBase has a clone method, which could lead to the DataBuf
561 // having multiple owners.
562 std::shared_ptr<DataBuf> storage_;
563};
564
568class TiffEntry : public TiffEntryBase {
569 public:
571
572
573 constexpr TiffEntry(uint16_t tag, IfdId group) : TiffEntryBase(tag, group) {
574 }
575
576
577 protected:
579
580 void doAccept(TiffVisitor& visitor) override;
581 void doEncode(TiffEncoder& encoder, const Exifdatum* datum) override;
583
585
586 [[nodiscard]] TiffEntry* doClone() const override;
588};
589
599 public:
601
602
603 TiffDataEntryBase(uint16_t tag, IfdId group, uint16_t szTag, IfdId szGroup);
605
607
608
617 virtual void setStrips(const Value* pSize, const byte* pData, size_t sizeData, size_t baseOffset) = 0;
619
621
622
623 [[nodiscard]] uint16_t szTag() const {
624 return szTag_;
625 }
626
627 [[nodiscard]] IfdId szGroup() const {
628 return szGroup_;
629 }
630
631
632 private:
633 // DATA
634 uint16_t szTag_;
635 IfdId szGroup_;
636};
637
650 friend class TiffEncoder;
651
652 public:
654
656
657 void setStrips(const Value* pSize, const byte* pData, size_t sizeData, size_t baseOffset) override;
659
660 protected:
662
663 void doAccept(TiffVisitor& visitor) override;
664 void doEncode(TiffEncoder& encoder, const Exifdatum* datum) override;
676 size_t doWrite(IoWrapper& ioWrapper, ByteOrder byteOrder, size_t offset, size_t valueIdx, size_t dataIdx,
677 size_t& imageIdx) override;
679
681
682 [[nodiscard]] TiffDataEntry* doClone() const override;
687 size_t doWriteData(IoWrapper& ioWrapper, ByteOrder byteOrder, size_t offset, size_t dataIdx,
688 size_t& imageIdx) const override;
689 // Using doWriteImage from base class
690 // Using doSize() from base class
692 [[nodiscard]] size_t doSizeData() const override;
693 // Using doSizeImage from base class
695
696 private:
697 // DATA
698 byte* pDataArea_{};
699 size_t sizeDataArea_{};
700};
701
714class TiffImageEntry : public TiffDataEntryBase {
715 friend class TiffEncoder;
717
718 public:
720
721 void setStrips(const Value* pSize, const byte* pData, size_t sizeData, size_t baseOffset) override;
723
724 protected:
726
727 void doAccept(TiffVisitor& visitor) override;
728 void doEncode(TiffEncoder& encoder, const Exifdatum* datum) override;
734 size_t doWrite(IoWrapper& ioWrapper, ByteOrder byteOrder, size_t offset, size_t valueIdx, size_t dataIdx,
735 size_t& imageIdx) override;
737
739
740 [[nodiscard]] TiffImageEntry* doClone() const override;
749 size_t doWriteData(IoWrapper& ioWrapper, ByteOrder byteOrder, size_t offset, size_t dataIdx,
750 size_t& imageIdx) const override;
755 size_t doWriteImage(IoWrapper& ioWrapper, ByteOrder byteOrder) const override;
757 [[nodiscard]] size_t doSize() const override;
759 [[nodiscard]] size_t doSizeData() const override;
761 [[nodiscard]] size_t doSizeImage() const override;
763
764 private:
766 using Strips = std::vector<std::pair<const byte*, size_t>>;
767
768 // DATA
769 Strips strips_;
770};
771
779 public:
781
782
783 constexpr TiffSizeEntry(uint16_t tag, IfdId group, uint16_t dtTag, IfdId dtGroup) :
784 TiffEntryBase(tag, group), dtTag_(dtTag), dtGroup_(dtGroup) {
785 }
786
788
790
791
792 [[nodiscard]] uint16_t dtTag() const {
793 return dtTag_;
794 }
795
796 [[nodiscard]] IfdId dtGroup() const {
797 return dtGroup_;
798 }
799
800
801 protected:
803
804 void doAccept(TiffVisitor& visitor) override;
805 void doEncode(TiffEncoder& encoder, const Exifdatum* datum) override;
807
809
810 [[nodiscard]] TiffSizeEntry* doClone() const override;
812
813 private:
814 // DATA
815 uint16_t dtTag_;
816 IfdId dtGroup_;
817};
818
824 friend class TiffEncoder;
825 friend class TiffDecoder;
826
827 public:
829
830
831 TiffDirectory(uint16_t tag, IfdId group, bool hasNext = true);
833 ~TiffDirectory() override;
835
837
838
841
843
844
845 [[nodiscard]] bool hasNext() const {
846 return hasNext_;
847 }
848
849
850 protected:
852
853
854 TiffDirectory(const TiffDirectory& rhs);
856
858
859 TiffComponent* doAddPath(uint16_t tag, TiffPath& tiffPath, TiffComponent* pRoot,
860 TiffComponent::UniquePtr object) override;
861 TiffComponent* doAddChild(TiffComponent::UniquePtr tiffComponent) override;
862 TiffComponent* doAddNext(TiffComponent::UniquePtr tiffComponent) override;
863 void doAccept(TiffVisitor& visitor) override;
869 size_t doWrite(IoWrapper& ioWrapper, ByteOrder byteOrder, size_t offset, size_t valueIdx, size_t dataIdx,
870 size_t& imageIdx) override;
872
874
875 [[nodiscard]] TiffDirectory* doClone() const override;
880 size_t doWriteData(IoWrapper& ioWrapper, ByteOrder byteOrder, size_t offset, size_t dataIdx,
881 size_t& imageIdx) const override;
888 size_t doWriteImage(IoWrapper& ioWrapper, ByteOrder byteOrder) const override;
893 [[nodiscard]] size_t doSize() const override;
898 [[nodiscard]] size_t doCount() const override;
903 [[nodiscard]] size_t doSizeData() const override;
908 [[nodiscard]] size_t doSizeImage() const override;
910
911 private:
913
914
915 static size_t writeDirEntry(IoWrapper& ioWrapper, ByteOrder byteOrder, size_t offset, TiffComponent* pTiffComponent,
916 size_t valueIdx, size_t dataIdx, size_t& imageIdx);
918
919 // DATA
920 Components components_;
921 bool hasNext_;
922 TiffComponent* pNext_{};
923};
924
932class TiffSubIfd : public TiffEntryBase {
933 friend class TiffReader;
934
935 public:
937
938
939 TiffSubIfd(uint16_t tag, IfdId group, IfdId newGroup);
941 ~TiffSubIfd() override;
943
945
946
947 TiffSubIfd(const TiffSubIfd& rhs);
948 TiffSubIfd& operator=(const TiffSubIfd&) = delete;
950
951 protected:
953
954 TiffComponent* doAddPath(uint16_t tag, TiffPath& tiffPath, TiffComponent* pRoot,
955 TiffComponent::UniquePtr object) override;
956 TiffComponent* doAddChild(TiffComponent::UniquePtr tiffComponent) override;
957 void doAccept(TiffVisitor& visitor) override;
958 void doEncode(TiffEncoder& encoder, const Exifdatum* datum) override;
964 size_t doWrite(IoWrapper& ioWrapper, ByteOrder byteOrder, size_t offset, size_t valueIdx, size_t dataIdx,
965 size_t& imageIdx) override;
967
969
970 [[nodiscard]] TiffSubIfd* doClone() const override;
975 size_t doWriteData(IoWrapper& ioWrapper, ByteOrder byteOrder, size_t offset, size_t dataIdx,
976 size_t& imageIdx) const override;
981 size_t doWriteImage(IoWrapper& ioWrapper, ByteOrder byteOrder) const override;
983 [[nodiscard]] size_t doSize() const override;
985 [[nodiscard]] size_t doSizeData() const override;
987 [[nodiscard]] size_t doSizeImage() const override;
989
990 private:
992 using Ifds = std::vector<TiffDirectory*>;
993
994 // DATA
995 IfdId newGroup_;
996 Ifds ifds_;
997};
998
1007 friend class TiffReader;
1008 friend class TiffDecoder;
1009 friend class TiffEncoder;
1010
1011 public:
1013
1014
1015 constexpr TiffMnEntry(uint16_t tag, IfdId group, IfdId mnGroup) :
1016 TiffEntryBase(tag, group, ttUndefined), mnGroup_(mnGroup) {
1017 }
1018
1020 ~TiffMnEntry() override;
1022
1024
1025
1026 TiffMnEntry(const TiffMnEntry&) = delete;
1030
1031 protected:
1033
1034 TiffComponent* doAddPath(uint16_t tag, TiffPath& tiffPath, TiffComponent* pRoot,
1035 TiffComponent::UniquePtr object) override;
1036 TiffComponent* doAddChild(TiffComponent::UniquePtr tiffComponent) override;
1037 TiffComponent* doAddNext(TiffComponent::UniquePtr tiffComponent) override;
1038 void doAccept(TiffVisitor& visitor) override;
1039 void doEncode(TiffEncoder& encoder, const Exifdatum* datum) override;
1044 size_t doWrite(IoWrapper& ioWrapper, ByteOrder byteOrder, size_t offset, size_t valueIdx, size_t dataIdx,
1045 size_t& imageIdx) override;
1047
1049
1050 [[nodiscard]] TiffMnEntry* doClone() const override;
1052 [[nodiscard]] size_t doCount() const override;
1053 // Using doWriteData from base class
1054 // Using doWriteImage from base class
1059 [[nodiscard]] size_t doSize() const override;
1060 // Using doSizeData from base class
1061 // Using doSizeImage from base class
1063
1064 private:
1065 // DATA
1066 IfdId mnGroup_;
1067 TiffComponent* mn_{};
1068};
1069
1080 friend class TiffReader;
1081
1082 public:
1084
1085
1086 TiffIfdMakernote(uint16_t tag, IfdId group, IfdId mnGroup, MnHeader* pHeader, bool hasNext = true);
1088 ~TiffIfdMakernote() override;
1090
1099
1104
1106
1107
1112 bool readHeader(const byte* pData, size_t size, ByteOrder byteOrder);
1121 imageByteOrder_ = byteOrder;
1122 }
1123
1124
1126
1127
1128 [[nodiscard]] size_t sizeHeader() const;
1130 size_t writeHeader(IoWrapper& ioWrapper, ByteOrder byteOrder) const;
1135 [[nodiscard]] size_t mnOffset() const;
1141 [[nodiscard]] size_t ifdOffset() const;
1148 [[nodiscard]] ByteOrder byteOrder() const;
1149
1155 [[nodiscard]] size_t baseOffset() const;
1157
1158 protected:
1160
1161 TiffComponent* doAddPath(uint16_t tag, TiffPath& tiffPath, TiffComponent* pRoot,
1162 TiffComponent::UniquePtr object) override;
1163 TiffComponent* doAddChild(TiffComponent::UniquePtr tiffComponent) override;
1164 TiffComponent* doAddNext(TiffComponent::UniquePtr tiffComponent) override;
1165 void doAccept(TiffVisitor& visitor) override;
1171 size_t doWrite(IoWrapper& ioWrapper, ByteOrder byteOrder, size_t offset, size_t valueIdx, size_t dataIdx,
1172 size_t& imageIdx) override;
1174
1176
1177 [[nodiscard]] TiffIfdMakernote* doClone() const override;
1182 size_t doWriteData(IoWrapper& ioWrapper, ByteOrder byteOrder, size_t offset, size_t dataIdx,
1183 size_t& imageIdx) const override;
1188 size_t doWriteImage(IoWrapper& ioWrapper, ByteOrder byteOrder) 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;
1211
1212 private:
1213 // DATA
1214 MnHeader* pHeader_;
1215 TiffDirectory ifd_;
1216 size_t mnOffset_{};
1217 ByteOrder imageByteOrder_{invalidByteOrder};
1218};
1219
1224using CfgSelFct = int (*)(uint16_t, const byte*, size_t, TiffComponent*);
1225
1227using CryptFct = DataBuf (*)(uint16_t, const byte*, size_t, TiffComponent*);
1228
1230struct ArrayDef {
1232 bool operator==(size_t idx) const {
1233 return idx_ == idx;
1234 }
1235
1236 [[nodiscard]] size_t size(uint16_t tag, IfdId group) const;
1237 // DATA
1238 size_t idx_;
1240 size_t count_;
1241};
1242
1262
1269
1276 public:
1278
1279
1280 TiffBinaryArray(uint16_t tag, IfdId group, const ArrayCfg& arrayCfg, const ArrayDef* arrayDef, size_t defSize);
1282 TiffBinaryArray(uint16_t tag, IfdId group, const ArraySet* arraySet, size_t setSize, CfgSelFct cfgSelFct);
1284 ~TiffBinaryArray() override;
1285 TiffBinaryArray& operator=(const TiffBinaryArray&) = delete;
1287
1289
1290
1291 size_t addElement(size_t idx, const ArrayDef& def);
1303 bool initialize(IfdId group);
1314 bool initialize(TiffComponent* pRoot);
1316 void iniOrigDataBuf();
1318 bool updOrigDataBuf(const byte* pData, size_t size);
1320 void setDecoded(bool decoded) {
1321 decoded_ = decoded;
1322 }
1323
1324
1326
1327
1328 [[nodiscard]] const ArrayCfg* cfg() const {
1329 return arrayCfg_;
1330 }
1331
1332 [[nodiscard]] const ArrayDef* def() const {
1333 return arrayDef_;
1334 }
1335
1336 [[nodiscard]] size_t defSize() const {
1337 return defSize_;
1338 }
1339
1340 [[nodiscard]] bool decoded() const {
1341 return decoded_;
1342 }
1343
1344
1345 protected:
1347
1348
1349 TiffBinaryArray(const TiffBinaryArray& rhs);
1351
1353
1354
1357 TiffComponent* doAddPath(uint16_t tag, TiffPath& tiffPath, TiffComponent* pRoot,
1358 TiffComponent::UniquePtr object) override;
1362 TiffComponent* doAddChild(TiffComponent::UniquePtr tiffComponent) override;
1363 void doAccept(TiffVisitor& visitor) override;
1364 void doEncode(TiffEncoder& encoder, const Exifdatum* datum) override;
1368 size_t doWrite(IoWrapper& ioWrapper, ByteOrder byteOrder, size_t offset, size_t valueIdx, size_t dataIdx,
1369 size_t& imageIdx) override;
1371
1373
1374 [[nodiscard]] TiffBinaryArray* doClone() const override;
1376 [[nodiscard]] size_t doCount() const override;
1377 // Using doWriteData from base class
1378 // Using doWriteImage from base class
1382 [[nodiscard]] size_t doSize() const override;
1383 // Using doSizeData from base class
1384 // Using doSizeImage from base class
1386
1387 private:
1388 // DATA
1389 CfgSelFct cfgSelFct_{};
1390 const ArraySet* arraySet_{};
1391 const ArrayCfg* arrayCfg_{};
1393 const ArrayDef* arrayDef_{};
1394 size_t defSize_{};
1395 size_t setSize_{};
1396 Components elements_;
1397 byte* origData_{};
1398 size_t origSize_{};
1399 TiffComponent* pRoot_{};
1400 bool decoded_{};
1401};
1402
1406class TiffBinaryElement : public TiffEntryBase {
1408
1409 public:
1411
1412
1415 void setElDef(const ArrayDef& def) {
1416 elDef_ = def;
1417 }
1418
1421 void setElByteOrder(ByteOrder byteOrder) {
1422 elByteOrder_ = byteOrder;
1423 }
1424
1425
1427
1428
1431 [[nodiscard]] const ArrayDef* elDef() const {
1432 return &elDef_;
1433 }
1434
1437 [[nodiscard]] ByteOrder elByteOrder() const {
1438 return elByteOrder_;
1439 }
1440
1441
1442 protected:
1444
1445 void doAccept(TiffVisitor& visitor) override;
1446 void doEncode(TiffEncoder& encoder, const Exifdatum* datum) override;
1450 size_t doWrite(IoWrapper& ioWrapper, ByteOrder byteOrder, size_t offset, size_t valueIdx, size_t dataIdx,
1451 size_t& imageIdx) override;
1453
1455
1456 [[nodiscard]] TiffBinaryElement* doClone() const override;
1460 [[nodiscard]] size_t doCount() const override;
1461 // Using doWriteData from base class
1462 // Using doWriteImage from base class
1467 [[nodiscard]] size_t doSize() const override;
1468 // Using doSizeData from base class
1469 // Using doSizeImage from base class
1471
1472 private:
1473 // DATA
1474 ArrayDef elDef_{0, ttUndefined, 0};
1475 ByteOrder elByteOrder_{invalidByteOrder};
1476};
1477
1478// *****************************************************************************
1479// template, inline and free functions
1480
1485bool cmpTagLt(const TiffComponent* lhs, const TiffComponent* rhs);
1486
1491bool cmpGroupLt(const TiffComponent* lhs, const TiffComponent* rhs);
1492
1494TiffComponent::UniquePtr newTiffEntry(uint16_t tag, IfdId group);
1495
1497TiffComponent::UniquePtr newTiffMnEntry(uint16_t tag, IfdId group);
1498
1501
1503template <IfdId newGroup>
1505 return std::make_unique<TiffDirectory>(tag, newGroup);
1506}
1507
1509template <IfdId newGroup>
1511 return std::make_unique<TiffSubIfd>(tag, group, newGroup);
1512}
1513
1515template <const ArrayCfg& arrayCfg, size_t N, const ArrayDef (&arrayDef)[N]>
1517 return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, arrayDef, N);
1518}
1519
1521template <const ArrayCfg& arrayCfg>
1523 return std::make_unique<TiffBinaryArray>(tag, group, arrayCfg, nullptr, 0);
1524}
1525
1527template <size_t N, const ArraySet (&arraySet)[N], CfgSelFct cfgSelFct>
1529 return std::make_unique<TiffBinaryArray>(tag, group, arraySet, N, cfgSelFct);
1530}
1531
1533template <uint16_t szTag, IfdId szGroup>
1535 return std::make_unique<TiffDataEntry>(tag, group, szTag, szGroup);
1536}
1537
1539template <uint16_t dtTag, IfdId dtGroup>
1541 return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
1542}
1543
1545template <uint16_t szTag, IfdId szGroup>
1547 return std::make_unique<TiffImageEntry>(tag, group, szTag, szGroup);
1548}
1549
1551template <uint16_t dtTag, IfdId dtGroup>
1553 // Todo: Same as newTiffThumbSize - consolidate (rename)?
1554 return std::make_unique<TiffSizeEntry>(tag, group, dtTag, dtGroup);
1555}
1556
1557} // namespace Internal
1558} // namespace Exiv2
1559
1560#endif // #ifndef TIFFCOMPOSITE_INT_HPP_
An interface for simple binary IO.
Definition basicio.hpp:35
An Exif metadatum, consisting of an ExifKey and a Value and methods to manipulate these.
Definition exif.hpp:41
Simple IO wrapper to ensure that the header is only written if there is any other data at all.
Definition tiffcomposite_int.hpp:102
int putb(byte data)
Wraps the corresponding BasicIo::putb() method.
Definition tiffcomposite_int.cpp:46
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
size_t write(const byte *pData, size_t wcount)
Wraps the corresponding BasicIo::write() method.
Definition tiffcomposite_int.cpp:38
IoWrapper(BasicIo &io, const byte *pHeader, size_t size, OffsetWriter *pow)
Definition tiffcomposite_int.cpp:32
Makernote header interface. This class is used with TIFF makernotes.
Definition makernote_int.hpp:92
Class to insert pointers or offsets to computed addresses at specific locations in an image....
Definition tiffimage_int.hpp:295
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
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:412
const ArrayCfg * cfg() const
Return a pointer to the configuration.
Definition tiffcomposite_int.hpp:1328
TiffBinaryArray * doClone() const override
Internal virtual copy constructor, implements clone().
Definition tiffcomposite_int.cpp:185
bool initialize(IfdId group)
Setup cfg and def for the component, in case of a complex binary array. Else do nothing....
Definition tiffcomposite_int.cpp:370
void setDecoded(bool decoded)
Set a flag to indicate if the array was decoded.
Definition tiffcomposite_int.hpp:1320
void doEncode(TiffEncoder &encoder, const Exifdatum *datum) override
Implements encode().
Definition tiffcomposite_int.cpp:727
bool decoded() const
Return the flag which indicates if the array was decoded.
Definition tiffcomposite_int.hpp:1340
void doAccept(TiffVisitor &visitor) override
Implements accept().
Definition tiffcomposite_int.cpp:704
~TiffBinaryArray() override
Virtual destructor.
Definition tiffcomposite_int.cpp:112
size_t doSize() const override
Implements size(). Todo: Document it!
Definition tiffcomposite_int.cpp:1340
void iniOrigDataBuf()
Initialize the original data buffer and its size from the base entry.
Definition tiffcomposite_int.cpp:398
const ArrayDef * def() const
Return a pointer to the definition.
Definition tiffcomposite_int.hpp:1332
TiffComponent * doAddChild(TiffComponent::UniquePtr tiffComponent) override
Implements addChild(). Todo: Document it!
Definition tiffcomposite_int.cpp:603
bool updOrigDataBuf(const byte *pData, size_t size)
Update the original data buffer and its size, return true if successful.
Definition tiffcomposite_int.cpp:403
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:1067
TiffComponent * doAddPath(uint16_t tag, TiffPath &tiffPath, TiffComponent *pRoot, TiffComponent::UniquePtr object) override
Implements addPath(). Todo: Document it!
Definition tiffcomposite_int.cpp:535
size_t doCount() const override
Implements count(). Todo: Document it!
Definition tiffcomposite_int.cpp:787
TiffBinaryArray(uint16_t tag, IfdId group, const ArrayCfg &arrayCfg, const ArrayDef *arrayDef, size_t defSize)
Constructor.
Definition tiffcomposite_int.cpp:73
size_t defSize() const
Return the number of elements in the definition.
Definition tiffcomposite_int.hpp:1336
Element of a TiffBinaryArray.
Definition tiffcomposite_int.hpp:1406
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:1126
void setElDef(const ArrayDef &def)
Set the array definition for this element.
Definition tiffcomposite_int.hpp:1415
void doEncode(TiffEncoder &encoder, const Exifdatum *datum) override
Implements encode().
Definition tiffcomposite_int.cpp:723
size_t doCount() const override
Implements count(). Returns the count from the element definition.
Definition tiffcomposite_int.cpp:807
void doAccept(TiffVisitor &visitor) override
Implements accept().
Definition tiffcomposite_int.cpp:715
const ArrayDef * elDef() const
Return the array definition of this element.
Definition tiffcomposite_int.hpp:1431
void setElByteOrder(ByteOrder byteOrder)
Set the byte order of this element.
Definition tiffcomposite_int.hpp:1421
size_t doSize() const override
Implements size(). Returns count * type-size, both taken from the element definition.
Definition tiffcomposite_int.cpp:1369
ByteOrder elByteOrder() const
Return the byte order of this element.
Definition tiffcomposite_int.hpp:1437
TiffBinaryElement * doClone() const override
Internal virtual copy constructor, implements clone().
Definition tiffcomposite_int.cpp:189
Interface class for components of a TIFF directory hierarchy (Composite pattern). Both TIFF directori...
Definition tiffcomposite_int.hpp:152
constexpr TiffComponent(uint16_t tag, IfdId group)
Constructor.
Definition tiffcomposite_int.hpp:162
virtual TiffComponent * doClone() const =0
Internal virtual copy constructor, implements clone().
byte * start() const
Return a pointer to the start of the binary representation of the component.
Definition tiffcomposite_int.hpp:242
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:149
virtual size_t doWriteImage(IoWrapper &ioWrapper, ByteOrder byteOrder) const =0
Implements writeImage().
virtual size_t doSize() const =0
Implements size().
virtual size_t doCount() const =0
Implements count().
uint16_t tag() const
Return the tag of this entry.
Definition tiffcomposite_int.hpp:234
std::vector< TiffComponent * > Components
Container type to hold all metadata.
Definition tiffcomposite_int.hpp:157
virtual size_t doSizeImage() const =0
Implements sizeImage().
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
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:811
TiffComponent * addChild(UniquePtr tiffComponent)
Add a child to the component. Default is to do nothing.
Definition tiffcomposite_int.cpp:571
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:1414
virtual size_t doWriteData(IoWrapper &ioWrapper, ByteOrder byteOrder, size_t offset, size_t dataIdx, size_t &imageIdx) const =0
Implements writeData().
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:1375
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:428
virtual TiffComponent * doAddChild(UniquePtr tiffComponent)
Implements addChild(). The default implementation does nothing.
Definition tiffcomposite_int.cpp:575
virtual ~TiffComponent()=default
Virtual destructor.
virtual void doAccept(TiffVisitor &visitor)=0
Implements accept().
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:1201
virtual size_t doSizeData() const =0
Implements sizeData().
virtual int idx() const
Return the unique id of the entry in the image.
Definition tiffcomposite_int.cpp:193
virtual TiffComponent * doAddPath(uint16_t tag, TiffPath &tiffPath, TiffComponent *pRoot, TiffComponent::UniquePtr object)
Implements addPath(). The default implementation does nothing.
Definition tiffcomposite_int.cpp:433
std::unique_ptr< TiffComponent > UniquePtr
TiffComponent auto_ptr type.
Definition tiffcomposite_int.hpp:155
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:1137
IfdId group() const
Return the group id of this component.
Definition tiffcomposite_int.hpp:238
TiffComponent * addNext(UniquePtr tiffComponent)
Add a "next" component to the component. Default is to do nothing.
Definition tiffcomposite_int.cpp:610
virtual TiffComponent * doAddNext(UniquePtr tiffComponent)
Implements addNext(). The default implementation does nothing.
Definition tiffcomposite_int.cpp:614
virtual size_t doWrite(IoWrapper &ioWrapper, ByteOrder byteOrder, size_t offset, size_t valueIdx, size_t dataIdx, size_t &imageIdx)=0
Implements write().
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:1287
void accept(TiffVisitor &visitor)
Interface to accept visitors (Visitor pattern). Visitors can perform operations on all components of ...
Definition tiffcomposite_int.cpp:639
size_t count() const
Return the number of components in this component.
Definition tiffcomposite_int.cpp:755
IfdId szGroup() const
Return the group of the entry which has the size.
Definition tiffcomposite_int.hpp:627
TiffDataEntryBase(uint16_t tag, IfdId group, uint16_t szTag, IfdId szGroup)
Constructor.
Definition tiffvisitor_int.cpp:343
virtual void setStrips(const Value *pSize, const byte *pData, size_t sizeData, size_t baseOffset)=0
Set the data areas ("strips").
uint16_t szTag() const
Return the group of the entry which has the size.
Definition tiffcomposite_int.hpp:623
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
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:993
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:1166
void doAccept(TiffVisitor &visitor) override
Implements accept().
Definition tiffcomposite_int.cpp:648
TiffDataEntryBase(uint16_t tag, IfdId group, uint16_t szTag, IfdId szGroup)
Constructor.
Definition tiffvisitor_int.cpp:343
size_t doSizeData() const override
Implements sizeData(). Return the size of the data area.
Definition tiffcomposite_int.cpp:1396
void setStrips(const Value *pSize, const byte *pData, size_t sizeData, size_t baseOffset) override
Set the data areas ("strips").
Definition tiffcomposite_int.cpp:238
void doEncode(TiffEncoder &encoder, const Exifdatum *datum) override
Implements encode().
Definition tiffcomposite_int.cpp:731
TiffDataEntry * doClone() const override
Internal virtual copy constructor, implements clone().
Definition tiffcomposite_int.cpp:157
This class models a TIFF directory (Ifd). It is a composite component of the TIFF tree.
Definition tiffcomposite_int.hpp:823
TiffDirectory(uint16_t tag, IfdId group, bool hasNext=true)
Default constructor.
Definition tiffcomposite_int.cpp:62
TiffComponent * doAddChild(TiffComponent::UniquePtr tiffComponent) override
Implements addChild(). The default implementation does nothing.
Definition tiffcomposite_int.cpp:579
void doAccept(TiffVisitor &visitor) override
Implements accept().
Definition tiffcomposite_int.cpp:660
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:1142
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:1418
TiffComponent * doAddPath(uint16_t tag, TiffPath &tiffPath, TiffComponent *pRoot, TiffComponent::UniquePtr object) override
Implements addPath(). The default implementation does nothing.
Definition tiffcomposite_int.cpp:438
size_t doSize() const override
Implements size(). Return the size of the TIFF directory, values and additional data,...
Definition tiffcomposite_int.cpp:1291
bool hasNext() const
Return true if the directory has a next pointer.
Definition tiffcomposite_int.hpp:845
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:816
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:1379
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:759
TiffDirectory & operator=(const TiffDirectory &)=delete
Assignment operator.
~TiffDirectory() override
Virtual destructor.
Definition tiffcomposite_int.cpp:87
TiffDirectory * doClone() const override
Internal virtual copy constructor, implements clone().
Definition tiffcomposite_int.cpp:169
TiffComponent * doAddNext(TiffComponent::UniquePtr tiffComponent) override
Implements addNext(). The default implementation does nothing.
Definition tiffcomposite_int.cpp:618
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:1205
TIFF composite visitor to encode metadata from an image to the TIFF tree. The metadata containers and...
Definition tiffvisitor_int.hpp:343
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(). Return the size of a standard TIFF entry.
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:215
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:719
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 doSizeData() const override
Implements sizeData(). Return 0.
Definition tiffcomposite_int.cpp:1383
void setIdx(int idx)
Set the unique id of the entry in the image.
Definition tiffcomposite_int.hpp:498
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:207
const byte * pData() const
Return a pointer to the binary representation of the value of this component.
Definition tiffcomposite_int.hpp:473
TiffType tiffType() const
Return the TIFF type.
Definition tiffcomposite_int.hpp:455
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:963
TiffEntryBase & operator=(const TiffEntryBase &)=delete
Assignment operator.
~TiffEntryBase() override
Virtual destructor.
Definition tiffcomposite_int.cpp:100
constexpr TiffEntryBase(uint16_t tag, IfdId group, TiffType tiffType=ttUndefined)
Default constructor.
Definition tiffcomposite_int.hpp:388
size_t doCount() const override
Implements count().
Definition tiffcomposite_int.cpp:763
const Value * pValue() const
Return a const pointer to the converted value of this component.
Definition tiffcomposite_int.hpp:477
void setOffset(size_t offset)
Set the offset.
Definition tiffcomposite_int.hpp:413
virtual void doEncode(TiffEncoder &encoder, const Exifdatum *datum)=0
Implements encode().
int idx() const override
Return the unique id of the entry in the image.
Definition tiffcomposite_int.cpp:197
void setCount(size_t count)
Set the number of components in this entry.
Definition tiffcomposite_int.hpp:494
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:1151
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:1230
size_t doSizeImage() const override
Implements sizeImage(). Return 0.
Definition tiffcomposite_int.cpp:1441
std::shared_ptr< DataBuf > storage() const
Used (internally) to create another reference to the DataBuf reference by storage_.
Definition tiffcomposite_int.hpp:537
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:974
void setValue(Value::UniquePtr value)
Set tag value. Takes ownership of the pointer passed in.
Definition tiffcomposite_int.cpp:229
A standard TIFF IFD entry.
Definition tiffcomposite_int.hpp:568
void doAccept(TiffVisitor &visitor) override
Implements accept().
Definition tiffcomposite_int.cpp:644
TiffEntry * doClone() const override
Internal virtual copy constructor, implements clone().
Definition tiffcomposite_int.cpp:153
constexpr TiffEntry(uint16_t tag, IfdId group)
Constructor.
Definition tiffcomposite_int.hpp:573
void doEncode(TiffEncoder &encoder, const Exifdatum *datum) override
Implements encode().
Definition tiffcomposite_int.cpp:735
Tiff IFD Makernote. This is a concrete class suitable for all IFD makernotes.
Definition tiffcomposite_int.hpp:1079
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:783
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:336
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:342
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:359
TiffComponent * doAddNext(TiffComponent::UniquePtr tiffComponent) override
Implements addNext(). The default implementation does nothing.
Definition tiffcomposite_int.cpp:635
void setByteOrder(ByteOrder byteOrder)
Set the byte order for the makernote.
Definition tiffcomposite_int.cpp:348
size_t doSizeImage() const override
Implements sizeImage(). Return the total image data size of the makernote IFD.
Definition tiffcomposite_int.cpp:1437
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:1242
size_t sizeHeader() const
Return the size of the header in bytes.
Definition tiffcomposite_int.cpp:353
size_t mnOffset() const
Return the offset to the makernote from the start of the TIFF header.
Definition tiffcomposite_int.cpp:332
TiffComponent * doAddPath(uint16_t tag, TiffPath &tiffPath, TiffComponent *pRoot, TiffComponent::UniquePtr object) override
Implements addPath(). The default implementation does nothing.
Definition tiffcomposite_int.cpp:530
void doAccept(TiffVisitor &visitor) override
Implements accept().
Definition tiffcomposite_int.cpp:695
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:1196
~TiffIfdMakernote() override
Virtual destructor.
Definition tiffcomposite_int.cpp:108
TiffIfdMakernote * doClone() const override
Internal virtual copy constructor, implements clone().
Definition tiffcomposite_int.cpp:181
void setImageByteOrder(ByteOrder byteOrder)
Set the byte order used for the image.
Definition tiffcomposite_int.hpp:1120
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:1410
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:1057
ByteOrder byteOrder() const
Return the byte order for the makernote. Requires the image byte order to be set (setImageByteOrder()...
Definition tiffcomposite_int.cpp:325
size_t ifdOffset() const
Return the offset to the start of the Makernote IFD from the start of the Makernote....
Definition tiffcomposite_int.cpp:319
TiffIfdMakernote(uint16_t tag, IfdId group, IfdId mnGroup, MnHeader *pHeader, bool hasNext=true)
Default constructor.
Definition tiffcomposite_int.cpp:69
TiffIfdMakernote(const TiffIfdMakernote &)=delete
Copy constructor.
TiffIfdMakernote & operator=(const TiffIfdMakernote &)=delete
Assignment operator.
size_t doSize() const override
Implements size(). Return the size of the Makernote header, TIFF directory, values and additional dat...
Definition tiffcomposite_int.cpp:1336
TiffComponent * doAddChild(TiffComponent::UniquePtr tiffComponent) override
Implements addChild(). The default implementation does nothing.
Definition tiffcomposite_int.cpp:599
A standard TIFF IFD entry consisting of a value which is an array of offsets to image data areas....
Definition tiffcomposite_int.hpp:714
void doEncode(TiffEncoder &encoder, const Exifdatum *datum) override
Implements encode().
Definition tiffcomposite_int.cpp:739
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:1250
void doAccept(TiffVisitor &visitor) override
Implements accept().
Definition tiffcomposite_int.cpp:652
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:1156
TiffImageEntry * doClone() const override
Internal virtual copy constructor, implements clone().
Definition tiffcomposite_int.cpp:161
size_t doSizeData() const override
Implements sizeData(). Return the size of the image data area.
Definition tiffcomposite_int.cpp:1387
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:1011
void setStrips(const Value *pSize, const byte *pData, size_t sizeData, size_t baseOffset) override
Set the data areas ("strips").
Definition tiffcomposite_int.cpp:287
size_t doSize() const override
Implements size(). Return the size of the strip pointers.
Definition tiffcomposite_int.cpp:1321
size_t doSizeImage() const override
Implements sizeImage(). Return the size of the image data area.
Definition tiffcomposite_int.cpp:1445
TiffComponent * doAddPath(uint16_t tag, TiffPath &tiffPath, TiffComponent *pRoot, TiffComponent::UniquePtr object) override
Implements addPath(). The default implementation does nothing.
Definition tiffcomposite_int.cpp:513
TiffComponent * doAddNext(TiffComponent::UniquePtr tiffComponent) override
Implements addNext(). The default implementation does nothing.
Definition tiffcomposite_int.cpp:627
constexpr TiffMnEntry(uint16_t tag, IfdId group, IfdId mnGroup)
Default constructor.
Definition tiffcomposite_int.hpp:1015
TiffMnEntry * doClone() const override
Internal virtual copy constructor, implements clone().
Definition tiffcomposite_int.cpp:177
void doAccept(TiffVisitor &visitor) override
Implements accept().
Definition tiffcomposite_int.cpp:684
void doEncode(TiffEncoder &encoder, const Exifdatum *datum) override
Implements encode().
Definition tiffcomposite_int.cpp:743
TiffComponent * doAddChild(TiffComponent::UniquePtr tiffComponent) override
Implements addChild(). The default implementation does nothing.
Definition tiffcomposite_int.cpp:591
size_t doSize() const override
Implements size() by forwarding the call to the actual concrete Makernote, if there is one.
Definition tiffcomposite_int.cpp:1329
size_t doCount() const override
Implements count(). Return number of components in the entry.
Definition tiffcomposite_int.cpp:767
TiffMnEntry(const TiffMnEntry &)=delete
Copy constructor.
~TiffMnEntry() override
Virtual destructor.
Definition tiffcomposite_int.cpp:104
TiffMnEntry & operator=(const TiffMnEntry &)=delete
Assignment operator.
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:1049
IfdId group() const
Return the group.
Definition tiffcomposite_int.hpp:82
uint16_t tag() const
Return the tag corresponding to the extended tag.
Definition tiffcomposite_int.hpp:74
uint32_t extendedTag() const
Return the extended tag (32 bit so that it can contain special tags)
Definition tiffcomposite_int.hpp:78
constexpr TiffPathItem(uint32_t extendedTag, IfdId group)
Constructor.
Definition tiffcomposite_int.hpp:67
A TIFF IFD entry containing the size of a data area of a related TiffDataEntry. This component is use...
Definition tiffcomposite_int.hpp:778
IfdId dtGroup() const
Return the group of the related entry which has the data area.
Definition tiffcomposite_int.hpp:796
constexpr TiffSizeEntry(uint16_t tag, IfdId group, uint16_t dtTag, IfdId dtGroup)
Constructor.
Definition tiffcomposite_int.hpp:783
uint16_t dtTag() const
Return the group of the related entry which has the data area.
Definition tiffcomposite_int.hpp:792
TiffSizeEntry * doClone() const override
Internal virtual copy constructor, implements clone().
Definition tiffcomposite_int.cpp:165
void doAccept(TiffVisitor &visitor) override
Implements accept().
Definition tiffcomposite_int.cpp:656
void doEncode(TiffEncoder &encoder, const Exifdatum *datum) override
Implements encode().
Definition tiffcomposite_int.cpp:747
size_t doSizeImage() const override
Implements sizeImage(). Return the sum of the image sizes of all sub-IFDs.
Definition tiffcomposite_int.cpp:1429
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:1035
TiffSubIfd * doClone() const override
Internal virtual copy constructor, implements clone().
Definition tiffcomposite_int.cpp:173
~TiffSubIfd() override
Virtual destructor.
Definition tiffcomposite_int.cpp:94
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:1182
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:1234
size_t doSizeData() const override
Implements sizeData(). Return the sum of the sizes of all sub-IFDs.
Definition tiffcomposite_int.cpp:1402
TiffComponent * doAddPath(uint16_t tag, TiffPath &tiffPath, TiffComponent *pRoot, TiffComponent::UniquePtr object) override
Implements addPath(). The default implementation does nothing.
Definition tiffcomposite_int.cpp:486
TiffSubIfd(uint16_t tag, IfdId group, IfdId newGroup)
Default constructor.
Definition tiffcomposite_int.cpp:65
size_t doSize() const override
Implements size(). Return the size of the sub-Ifd pointers.
Definition tiffcomposite_int.cpp:1325
TiffComponent * doAddChild(TiffComponent::UniquePtr tiffComponent) override
Implements addChild(). The default implementation does nothing.
Definition tiffcomposite_int.cpp:585
void doEncode(TiffEncoder &encoder, const Exifdatum *datum) override
Implements encode().
Definition tiffcomposite_int.cpp:751
void doAccept(TiffVisitor &visitor) override
Implements accept().
Definition tiffcomposite_int.cpp:675
Abstract base class defining the interface for TIFF composite visitors (Visitor pattern)
Definition tiffvisitor_int.hpp:39
Common interface for all types of values used with metadata.
Definition value.hpp:33
std::unique_ptr< Value > UniquePtr
Shortcut for a Value auto pointer.
Definition value.hpp:36
Definition tiffcomposite_int.hpp:46
const uint32_t cmt2
Special tag: root IFD of CR3 images.
Definition tiffcomposite_int.hpp:53
const uint32_t fuji
Special tag: root IFD of Fujifilm RAF images.
Definition tiffcomposite_int.hpp:52
const uint32_t none
Dummy tag.
Definition tiffcomposite_int.hpp:47
const uint32_t cmt4
Special tag: root IFD of CR3 images.
Definition tiffcomposite_int.hpp:55
const uint32_t pana
Special tag: root IFD of Panasonic RAW images.
Definition tiffcomposite_int.hpp:51
const uint32_t root
Special tag: root IFD.
Definition tiffcomposite_int.hpp:48
const uint32_t cmt3
Special tag: root IFD of CR3 images.
Definition tiffcomposite_int.hpp:54
const uint32_t all
Special tag: all tags in a group.
Definition tiffcomposite_int.hpp:50
const uint32_t next
Special tag: next IFD.
Definition tiffcomposite_int.hpp:49
Helper structure for the Matroska tags lookup table.
Definition matroskavideo.hpp:39
const TiffType ttTiffFloat
TIFF FLOAT type.
Definition tiffcomposite_int.hpp:34
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 newTiffThumbSize(uint16_t tag, IfdId group)
Function to create and initialize a new TIFF entry for a thumbnail (size)
Definition tiffcomposite_int.hpp:1540
const TiffType ttUnsignedLong
Exif LONG type.
Definition tiffcomposite_int.hpp:27
const TiffType ttSignedByte
Exif SBYTE type.
Definition tiffcomposite_int.hpp:29
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
const TiffType ttUnsignedRational
Exif RATIONAL type.
Definition tiffcomposite_int.hpp:28
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:1505
const TiffType ttTiffDouble
TIFF DOUBLE type.
Definition tiffcomposite_int.hpp:35
TiffComponent::UniquePtr newTiffEntry(uint16_t tag, IfdId group)
Function to create and initialize a new TIFF entry.
Definition tiffcomposite_int.cpp:1515
TiffComponent::UniquePtr newTiffBinaryArray0(uint16_t tag, IfdId group)
Function to create and initialize a new binary array entry.
Definition tiffcomposite_int.hpp:1516
TiffComponent::UniquePtr newTiffDirectory(uint16_t tag, IfdId)
Function to create and initialize a new TIFF directory.
Definition tiffcomposite_int.hpp:1504
TiffComponent::UniquePtr newTiffMnEntry(uint16_t tag, IfdId group)
Function to create and initialize a new TIFF makernote entry.
Definition tiffcomposite_int.cpp:1519
TiffComponent::UniquePtr newTiffSubIfd(uint16_t tag, IfdId group)
Function to create and initialize a new TIFF sub-directory.
Definition tiffcomposite_int.hpp:1510
const TiffType ttTiffIfd
TIFF IFD type.
Definition tiffcomposite_int.hpp:36
const TiffType ttSignedShort
Exif SSHORT type.
Definition tiffcomposite_int.hpp:31
uint16_t TiffType
TIFF value type.
Definition tiffcomposite_int.hpp:22
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
void(TiffEncoder::*)(TiffEntryBase *, const Exifdatum *) EncoderFct
Function pointer type for a TiffDecoder member function to decode a TIFF component.
Definition tifffwd_int.hpp:60
const TiffType ttAsciiString
Exif ASCII type.
Definition tiffcomposite_int.hpp:25
const TiffType ttUnsignedShort
Exif SHORT type.
Definition tiffcomposite_int.hpp:26
const TiffType ttSignedLong
Exif SLONG type.
Definition tiffcomposite_int.hpp:32
TiffComponent::UniquePtr newTiffBinaryArray1(uint16_t tag, IfdId group)
Function to create and initialize a new simple binary array entry.
Definition tiffcomposite_int.hpp:1522
TiffComponent::UniquePtr newTiffBinaryArray2(uint16_t tag, IfdId group)
Function to create and initialize a new complex binary array entry.
Definition tiffcomposite_int.hpp:1528
const TiffType ttUnsignedByte
Exif BYTE type.
Definition tiffcomposite_int.hpp:24
void(TiffDecoder::*)(const TiffEntryBase *) DecoderFct
Function pointer type for a TiffDecoder member function to decode a TIFF component.
Definition tifffwd_int.hpp:55
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:1511
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
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:1477
TiffType toTiffType(TypeId typeId)
Convert the Exiv2 typeId to a TIFF value type.
Definition tiffcomposite_int.cpp:1494
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
const TiffType ttUndefined
Exif UNDEFINED type.
Definition tiffcomposite_int.hpp:30
TiffComponent::UniquePtr newTiffBinaryElement(uint16_t tag, IfdId group)
Function to create and initialize a new binary array element.
Definition tiffcomposite_int.cpp:1523
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
const TiffType ttSignedRational
Exif SRATIONAL type.
Definition tiffcomposite_int.hpp:33
Class CrwImage to access Canon CRW images. References: The Canon RAW (CRW) File Format by Phil Harv...
Definition asfvideo.hpp:15
IfdId
Type to specify the IFD to which a metadata belongs.
Definition tags.hpp:34
TypeId
Exiv2 value type identifiers.
Definition types.hpp:70
ByteOrder
Type to express the byte order (little or big endian)
Definition types.hpp:34
Utility class containing a character array. All it does is to take care of memory allocation and dele...
Definition types.hpp:124
Additional configuration for a binary array.
Definition tiffcomposite_int.hpp:1244
bool hasSize_
If true, first tag is the size element.
Definition tiffcomposite_int.hpp:1257
ArrayDef elDefaultDef_
Default element.
Definition tiffcomposite_int.hpp:1260
bool concat_
If true, concatenate gaps between defined tags to single tags.
Definition tiffcomposite_int.hpp:1259
CryptFct cryptFct_
Crypt function, 0 if not used.
Definition tiffcomposite_int.hpp:1256
TiffType elTiffType_
Type for the array entry and the size element, if any.
Definition tiffcomposite_int.hpp:1255
ByteOrder byteOrder_
Byte order, invalidByteOrder to inherit.
Definition tiffcomposite_int.hpp:1254
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
IfdId group_
Group for the elements.
Definition tiffcomposite_int.hpp:1253
bool hasFillers_
If true, write all defined tags.
Definition tiffcomposite_int.hpp:1258
Defines one tag in a binary array.
Definition tiffcomposite_int.hpp:1230
size_t count_
Number of components.
Definition tiffcomposite_int.hpp:1240
bool operator==(size_t idx) const
Comparison with idx.
Definition tiffcomposite_int.hpp:1232
size_t idx_
Index in bytes from the start.
Definition tiffcomposite_int.hpp:1238
TiffType tiffType_
TIFF type of the element.
Definition tiffcomposite_int.hpp:1239
size_t size(uint16_t tag, IfdId group) const
Get the size in bytes of a tag.
Definition tiffcomposite_int.cpp:365
Combination of array configuration and definition for arrays.
Definition tiffcomposite_int.hpp:1264
const ArrayDef * def_
Binary array definition array.
Definition tiffcomposite_int.hpp:1266
ArrayCfg cfg_
Binary array configuration.
Definition tiffcomposite_int.hpp:1265
size_t defSize_
Size of the array definition array.
Definition tiffcomposite_int.hpp:1267
Search key for TIFF mapping structures.
Definition tiffcomposite_int.hpp:368
std::string m_
Camera make.
Definition tiffcomposite_int.hpp:369
uint32_t e_
Extended tag.
Definition tiffcomposite_int.hpp:370
IfdId g_
Group
Definition tiffcomposite_int.hpp:371
TIFF mapping table for functions to decode special cases.
Definition tiffcomposite_int.hpp:342
IfdId group_
Group that contains the tag.
Definition tiffcomposite_int.hpp:361
const char * make_
Camera make for which these mapping functions apply.
Definition tiffcomposite_int.hpp:359
uint16_t tag() const
Return the tag corresponding to the extended tag.
Definition tiffcomposite_int.hpp:354
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
uint32_t extendedTag_
Tag (32 bit so that it can contain special tags)
Definition tiffcomposite_int.hpp:360
DecoderFct decoderFct_
Decoder function for matching tags.
Definition tiffcomposite_int.hpp:362
EncoderFct encoderFct_
Encoder function for matching tags.
Definition tiffcomposite_int.hpp:363