Mako 8.4.0 API
MakoCore SDK API Documentation
Loading...
Searching...
No Matches
pdfobjects.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2019-2026 Hybrid Software Helix Ltd. All rights reserved.
3 */
4
5#ifndef JAWSMAKO_PDFOBJECTS_H
6#define JAWSMAKO_PDFOBJECTS_H
7
20
21#include <jawsmako/types.h>
22#include <jawsmako/hashable.h>
23
24namespace JawsMako
25{
26 using namespace EDL;
27
48
56 class IPDFObject : public IRCObject, public IHashable
57 {
58 public:
59
64 virtual ePDFObjectType getType() const = 0;
65
72 virtual IPDFObjectPtr clone() const = 0;
73
82 virtual IPDFObjectPtr deepClone() const = 0;
83
89 virtual bool getIsExecutable() const = 0;
90
97 virtual bool containsReferences() const = 0;
98
104 virtual void emitPostScriptCode(const IOutputStreamPtr &dest) const = 0;
105
106 //
107 // Convenience functions
108 //
109
110#ifdef SWIG
111 %apply double &OUTPUT { double &number };
112#endif
119 virtual bool getNumber(double &number) const = 0;
120#ifdef SWIG
121 %clear double &number;
122#endif
123
124#ifdef SWIG
125 %apply float &OUTPUT { float &number };
126#endif
136 virtual bool getNumber(float &number) const = 0;
137#ifdef SWIG
138 %apply int32_t &OUTPUT { int32 &number };
139#endif
140
141#ifdef SWIG
142 %apply int32_t &OUTPUT { int32 &number };
143#endif
151 virtual bool getNumber(int32 &number) const = 0;
152#ifdef SWIG
153 %clear int32 &number;
154#endif
155
162 static JAWSMAKO_API IPDFObjectPtr createNumber(double number);
163
170 virtual bool getString(RawString &string) const = 0;
171 };
172 #define obj2IPDFObject(obj) JawsMako::IPDFObjectPtr(dynamic_cast<JawsMako::IPDFObject *>((IRCObject *) (obj)), true)
173
174 // A useful templated utility for faster casting between object types
175 // with checking, but without requiring dynamic casting.
176 template <typename T>
177 CSmartPtr<T> pdfObj2Type(const IPDFObjectPtr &object, ePDFObjectType type)
178 {
179 if (!object || object->getType() != type)
180 {
181 return CSmartPtr<T> ();
182 }
183 return CSmartPtr<T>(static_cast<T *>((IPDFObject *) object), true);
184 }
185
191 class IPDFInteger : public IPDFObject
192 {
193 public:
194 virtual ~IPDFInteger() {}
195
201 static JAWSMAKO_API IPDFIntegerPtr create(int32 integer);
202
207 virtual int32 getValue() const = 0;
208 };
209 #define pdfObj2IPDFInteger(obj) JawsMako::pdfObj2Type<JawsMako::IPDFInteger>(obj, JawsMako::ePOTInteger)
210 #define obj2IPDFInteger(obj) JawsMako::IPDFIntegerPtr(dynamic_cast<JawsMako::IPDFInteger *>((IRCObject *) (obj)), true)
211
217 class IPDFBoolean : public IPDFObject
218 {
219 public:
220 virtual ~IPDFBoolean() {}
221
227 static JAWSMAKO_API IPDFBooleanPtr create(bool boolean);
228
233 virtual bool getValue() const = 0;
234 };
235 #define pdfObj2IPDFBoolean(obj) JawsMako::pdfObj2Type<JawsMako::IPDFBoolean>(obj, JawsMako::ePOTBoolean)
236 #define obj2IPDFBoolean(obj) JawsMako::IPDFBooleanPtr(dynamic_cast<JawsMako::IPDFBoolean *>((IRCObject *) (obj)), true)
237
238
244 class IPDFReal : public IPDFObject
245 {
246 public:
247 virtual ~IPDFReal() {}
248
254 static JAWSMAKO_API IPDFRealPtr create(double real);
255
260 virtual double getValue() const = 0;
261 };
262 #define pdfObj2IPDFReal(obj) JawsMako::pdfObj2Type<JawsMako::IPDFReal>(obj, JawsMako::ePOTReal)
263 #define obj2IPDFReal(obj) JawsMako::IPDFRealPtr(dynamic_cast<JawsMako::IPDFReal *>((IRCObject *) (obj)), true)
264
270 class IPDFNull : public IPDFObject
271 {
272 public:
273 virtual ~IPDFNull() {}
274
279 static JAWSMAKO_API IPDFNullPtr create();
280 };
281 #define pdfObj2IPDFNull(obj) JawsMako::pdfObj2Type<JawsMako::IPDFNull>(obj, JawsMako::ePOTNull)
282 #define obj2IPDFNull(obj) JawsMako::IPDFNullPtr(dynamic_cast<JawsMako::IPDFNull *>((IRCObject *) (obj)), true)
283
290 class IPDFString : public IPDFObject
291 {
292 public:
293 virtual ~IPDFString() {}
294
302 static JAWSMAKO_API IPDFStringPtr create(const RawString &string, bool executable = false, bool pdf2 = false);
303
311 static JAWSMAKO_API IPDFStringPtr createText(const U8String &string, bool executable = false, bool pdf2 = false);
312
321 static JAWSMAKO_API IPDFStringPtr create(const IInputStreamPtr &stream, bool executable = false, bool pdf2 = false, int64 startOffset = 0);
322
328 virtual bool isUtf8Encoded() = 0;
329
334 virtual const RawString &getValue() const = 0;
335
340 virtual U8String getTextValue() const = 0;
341 };
342 #define pdfObj2IPDFString(obj) JawsMako::pdfObj2Type<JawsMako::IPDFString>(obj, JawsMako::ePOTString)
343 #define obj2IPDFString(obj) JawsMako::IPDFStringPtr(dynamic_cast<JawsMako::IPDFString *>((IRCObject *) (obj)), true)
344
350 class IPDFName : public IPDFObject
351 {
352 public:
353 virtual ~IPDFName() {}
354
363 static JAWSMAKO_API IPDFNamePtr create(IEDLClassFactory *pFactory, const RawString &name);
364
371 static JAWSMAKO_API IPDFNamePtr create(const RawString &name, bool executable = false);
372
377 virtual bool isValidUtf8() const = 0;
378
383 virtual const RawString &getValue() const = 0;
384 };
385 #define pdfObj2IPDFName(obj) JawsMako::pdfObj2Type<JawsMako::IPDFName>(obj, JawsMako::ePOTName)
386 #define obj2IPDFName(obj) JawsMako::IPDFNamePtr(dynamic_cast<JawsMako::IPDFName *>((IRCObject *) (obj)), true)
387
395 {
396 public:
398 {
399 m_objectNum = -1;
400 m_generation = -1;
401 }
402
407 CPDFReference(int32 objectNum, int32 generation)
408 {
409 m_objectNum = objectNum;
410 m_generation = generation;
411 }
412
418 {
419 return m_objectNum;
420 }
421
427 {
428 return m_generation;
429 }
430
431 // For use in maps and other containers.
432 bool operator==(const CPDFReference& other) const
433 {
434 return ((m_objectNum == other.m_objectNum) && (m_generation == other.m_generation));
435 }
436 bool operator!=(const CPDFReference& other) const
437 {
438 return ((m_objectNum != other.m_objectNum) || (m_generation != other.m_generation));
439 }
440 bool operator<(const CPDFReference& other) const
441 {
442 if (m_objectNum < other.m_objectNum)
443 return true;
444 else if (m_objectNum > other.m_objectNum)
445 return false;
446 else if (m_generation < other.m_generation)
447 return true;
448 else
449 return false;
450 }
451 private:
452 int32 m_objectNum;
453 int32 m_generation;
454 };
455
462 {
463 public:
464 virtual ~IPDFReference() {}
465
471 static JAWSMAKO_API IPDFReferencePtr create(const CPDFReference &reference);
472
479 static JAWSMAKO_API IPDFReferencePtr create(int32 objectNum, int32 generation)
480 {
481 return create(CPDFReference(objectNum, generation));
482 }
483
488 virtual const CPDFReference &getValue() const = 0;
489
495 {
496 return getValue().getObjectNum();
497 }
498
504 {
505 return getValue().getGeneration();
506 }
507 };
508 #define pdfObj2IPDFReference(obj) JawsMako::pdfObj2Type<IPDFReference>(obj, JawsMako::ePOTReference)
509 #define obj2IPDFReference(obj) JawsMako::IPDFReferencePtr(dynamic_cast<JawsMako::IPDFReference *>((IRCObject *) (obj)), true)
510
518 {
519 public:
521 {
522 m_docId = INVALID_DOM_ID;
523 m_allocatorId = INVALID_DOM_ID;
524 m_objectNum = -1;
525 m_generation = -1;
526 }
527
535 CPDFFarReference(DOMid docId, DOMid allocatorId, int32 objectNum, int32 generation)
536 {
537 m_docId = docId;
538 m_allocatorId = allocatorId;
539 m_objectNum = objectNum;
540 m_generation = generation;
541 }
542
543 // For use in maps and other containers
544 bool operator==(const CPDFFarReference &other) const
545 {
546 return (m_docId == other.m_docId &&
547 m_allocatorId == other.m_allocatorId &&
548 m_objectNum == other.m_objectNum &&
549 m_generation == other.m_generation);
550 }
551
552 bool operator!=(const CPDFFarReference &other) const
553 {
554 return !(other == *this);
555 }
556
557 bool operator<(const CPDFFarReference &other) const
558 {
559 if (m_docId < other.m_docId)
560 return true;
561 else if (m_docId > other.m_docId)
562 return false;
563 else if (m_allocatorId < other.m_allocatorId)
564 return true;
565 else if (m_allocatorId > other.m_allocatorId)
566 return false;
567 else if (m_objectNum < other.m_objectNum)
568 return true;
569 else if (m_objectNum > other.m_objectNum)
570 return false;
571 else if (m_generation < other.m_generation)
572 return true;
573 else
574 return false;
575 }
576
582 {
583 return m_docId;
584 }
585
593 {
594 return m_allocatorId;
595 }
596
602 {
603 return m_objectNum;
604 }
605
611 {
612 return m_generation;
613 }
614
615 private:
616 DOMid m_docId;
617 DOMid m_allocatorId;
618 int32 m_objectNum;
619 int32 m_generation;
620 };
621
629 {
630 public:
631 virtual ~IPDFFarReference() {}
632
638 static JAWSMAKO_API IPDFFarReferencePtr create(const CPDFFarReference &reference);
639
644 virtual const CPDFFarReference &getValue() const = 0;
645 };
646 #define pdfObj2IPDFFarReference(obj) pdfObj2Type<JawsMako::IPDFFarReference>(obj, JawsMako::ePOTFarReference)
647 #define obj2IPDFFarReference(obj) JawsMako::IPDFFarReferencePtr(dynamic_cast<JawsMako::IPDFFarReference *>((IRCObject *) (obj)), true)
648
654 class IPDFArray : public IPDFObject
655 {
656 public:
657 virtual ~IPDFArray() {}
658
665 static JAWSMAKO_API IPDFArrayPtr create(uint32 size = 0, bool executable = false);
666
673 static JAWSMAKO_API IPDFArrayPtr create(const CPDFObjectVect &objects, bool executable = false);
674
680 static JAWSMAKO_API IPDFArrayPtr createFromNumbers(const CDoubleVect &numbers);
681
687 static JAWSMAKO_API IPDFArrayPtr createFromFloatNumbers(const CFloatVect &numbers);
688
689#ifdef SWIG
690#if SWIGJAVA
691 %apply double [] { const double *numbers };
692#endif
693#if SWIGCSHARP
694 %apply double INPUT[] { const double *numbers };
695#endif
696#endif
703 static JAWSMAKO_API IPDFArrayPtr createFromNumbersArray(const double *numbers, uint32 numNumbers);
704#ifdef SWIG
705 %clear const double *numbers;
706#endif
707
714 static JAWSMAKO_API IPDFArrayPtr createFromNames(IEDLClassFactory *pFactory, const CRawStringVect &nameStrings);
715
721 static JAWSMAKO_API IPDFArrayPtr createFromFBox(const FBox &box);
722
727 virtual uint32 getSize() const = 0;
728
735 virtual IPDFObjectPtr get(uint32 index) const = 0;
736
743 virtual ePDFObjectType getTypeAtIndex(uint32 index) const = 0;
744
753 virtual void put(uint32 index, const IPDFObjectPtr &value) = 0;
754
762 virtual void insert(uint32 index, const IPDFObjectPtr &value) = 0;
763
770 virtual void remove(uint32 index) = 0;
771
776 virtual void append(const IPDFObjectPtr &value) = 0;
777
786 virtual void copy(uint32 destIndex, const IPDFArrayPtr &sourceArray, uint32 sourceIndex) = 0;
787
793 virtual bool getNumbers(CDoubleVect &numbers) = 0;
794
800 virtual bool getBox(FBox &box) = 0;
801
808 virtual int32 getInteger(uint32 index) const = 0;
809
816 virtual bool containsCompositeObject(const IPDFObjectPtr &object) const = 0;
817 };
818 #define pdfObj2IPDFArray(obj) JawsMako::pdfObj2Type<JawsMako::IPDFArray>(obj, JawsMako::ePOTArray)
819 #define obj2IPDFArray(obj) JawsMako::IPDFArrayPtr(dynamic_cast<JawsMako::IPDFArray *>((IRCObject *) (obj)), true)
820
828 {
829 public:
830 virtual ~IPDFDictionary() {}
831
838 static JAWSMAKO_API IPDFDictionaryPtr create(IEDLClassFactory *pFactory, uint32 size = 0);
839
844 virtual uint32 getSize() const = 0;
845
851 virtual IPDFNamePtr getKeyAtIndex(uint32 index) const = 0;
852
858 virtual IPDFObjectPtr getValueAtIndex(uint32 index) const = 0;
859
866 virtual ePDFObjectType getValueTypeAtIndex(uint32 index) const = 0;
867
873 virtual IPDFObjectPtr get(const char *key) const = 0;
874
880 virtual IPDFObjectPtr get(const RawString &key) const = 0;
881
887 virtual IPDFObjectPtr get(const IPDFNamePtr &key) const = 0;
888
894 virtual void put(const char *key, const IPDFObjectPtr &value) = 0;
895
901 virtual void put(const RawString &key, const IPDFObjectPtr &value) = 0;
902
908 virtual void put(const IPDFNamePtr &key, const IPDFObjectPtr &value) = 0;
909
914 virtual void undefine(const char *key) = 0;
915
920 virtual void undefine(const RawString &key) = 0;
921
926 virtual void undefine(const IPDFNamePtr &key) = 0;
927
935 virtual void copy(const IPDFDictionaryPtr &sourceDict, uint32 sourceIndex) = 0;
936
942 virtual void putInteger(const IPDFNamePtr &key, int32 integer) = 0;
943
949 virtual void putInteger(const RawString &key, int32 integer) = 0;
950
956 virtual void putReal(const IPDFNamePtr &key, double real) = 0;
957
963 virtual void putReal(const RawString &key, double real) = 0;
964
970 virtual void putBoolean(const IPDFNamePtr &key, bool boolean) = 0;
971
977 virtual void putBoolean(const RawString &key, bool boolean) = 0;
978
984 virtual void putName(const IPDFNamePtr &key, const RawString &name) = 0;
985
991 virtual void putName(const RawString &key, const RawString &name) = 0;
992
998 virtual void putString(const IPDFNamePtr &key, const RawString &string) = 0;
999
1005 virtual void putString(const RawString &key, const RawString &string) = 0;
1006
1013 virtual bool containsCompositeObject(const IPDFObjectPtr &object) const = 0;
1014
1020 {
1021 public:
1022 Iterator(const IPDFDictionaryPtr &dict, bool begin)
1023 {
1024 if (!dict)
1025 {
1027 }
1028 m_index = 0;
1029 m_limit = dict->getSize();
1030 m_dict = dict;
1031
1032 if (begin)
1033 {
1034 if (m_limit > 0 && dict->getKeyAtIndex(0) == NULL)
1035 {
1036 // First index is an empty slot - skip it
1037 increment();
1038 }
1039 }
1040 else
1041 {
1042 m_index = m_limit;
1043 }
1044 }
1045
1046 Iterator(const Iterator &other)
1047 {
1048 assign(other);
1049 }
1050
1052 {
1053 m_index = 0;
1054 m_limit = 0;
1055 m_dict = NULL;
1056 }
1057
1058 const Iterator &operator=(const Iterator &other)
1059 {
1060 assign(other);
1061 return *this;
1062 }
1063
1065 {
1066 increment();
1067 return *this;
1068 }
1070 {
1071 Iterator i = *this;
1072 increment();
1073 return i;
1074 }
1075 bool operator==(const Iterator &other) const
1076 {
1077 return (m_index == other.m_index &&
1078 m_dict == other.m_dict);
1079 }
1080 bool operator!=(const Iterator &other) const
1081 {
1082 return (m_index != other.m_index ||
1083 m_dict != other.m_dict);
1084 }
1085
1091 {
1092 if (!m_dict)
1093 {
1095 }
1096 return m_index;
1097 }
1098
1103 IPDFNamePtr getKey() const
1104 {
1105 if (!m_dict)
1106 {
1108 }
1109 if (m_index == m_limit)
1110 {
1112 }
1113 IPDFNamePtr key = m_dict->getKeyAtIndex(m_index);
1114 if (!key)
1115 {
1117 }
1118 return key;
1119 }
1120
1125 IPDFObjectPtr getValue() const
1126 {
1127 if (!m_dict)
1128 {
1130 }
1131 if (m_index == m_limit)
1132 {
1134 }
1135 return m_dict->getValueAtIndex(m_index);
1136 }
1137
1143 {
1144 if (!m_dict)
1145 {
1147 }
1148 if (m_index == m_limit)
1149 {
1151 }
1152 return m_dict->getValueTypeAtIndex(m_index);
1153 }
1154 private:
1155 void assign(const Iterator &other)
1156 {
1157 m_dict = other.m_dict;
1158 m_index = other.m_index;
1159 m_limit = other.m_limit;
1160 }
1161 void increment()
1162 {
1163 if (m_index == m_limit)
1164 {
1166 }
1167 do
1168 {
1169 m_index++;
1170 }
1171 while (m_index < m_limit && m_dict->getKeyAtIndex(m_index) == NULL);
1172 }
1173
1174 uint32 m_index;
1175 uint32 m_limit;
1176 IPDFDictionaryPtr m_dict;
1177 };
1178
1184 virtual Iterator begin() = 0;
1185
1190 virtual Iterator end() = 0;
1191 };
1192
1193 static inline IPDFDictionaryPtr pdfObj2IPDFDictionary(const IPDFObjectPtr &object)
1194 {
1195 if (!object || (object->getType() != ePOTDictionary && object->getType() != ePOTStream))
1196 {
1197 return IPDFDictionaryPtr();
1198 }
1199 return IPDFDictionaryPtr(static_cast<IPDFDictionary *>((IPDFObject *) object), true);
1200 }
1201 #define obj2IPDFDictionary(obj) JawsMako::IPDFDictionaryPtr(dynamic_cast<JawsMako::IPDFDictionary *>((IRCObject *) (obj)), true)
1202
1210 {
1211 public:
1212 virtual ~IPDFStream() {}
1213
1221 static JAWSMAKO_API IPDFStreamPtr create(IEDLClassFactory *pFactory, const IInputStreamPtr &stream, uint32 size = 0);
1222
1229 virtual IRAInputStreamPtr getStream() const = 0;
1230
1235 virtual IInputStreamPtr getRawStream() const = 0;
1236 };
1237 #define pdfObj2IPDFStream(obj) JawsMako::pdfObj2Type<JawsMako::IPDFStream>(obj, JawsMako::ePOTStream)
1238 #define obj2IPDFStream(obj) JawsMako::IPDFStreamPtr(dynamic_cast<JawsMako::IPDFStream *>((IRCObject *) (obj)), true)
1239
1247 {
1248 public:
1249 virtual ~IPDFOperator() {}
1250
1251 static JAWSMAKO_API IPDFOperatorPtr create(const U8String &operatorName);
1252 static JAWSMAKO_API IPDFOperatorPtr create(uint32 operatorId);
1253
1258 virtual U8String getValue() const = 0;
1259
1264 virtual uint32 getOperatorId() const = 0;
1265 };
1266 #define pdfObj2IPDFOperator(obj) JawsMako::pdfObj2Type<JawsMako::IPDFOperator>(obj, JawsMako::ePOTOperator)
1267 #define obj2IPDFOperator(obj) JawsMako::IPDFOperatorPtr(dynamic_cast<JawsMako::IPDFOperator *>((IRCObject *) (obj)), true)
1268
1278 {
1279 public:
1280 virtual ~IPDFObjectStore() {}
1281
1286 virtual IPDFObjectStorePtr clone() const = 0;
1287
1292 virtual IPDFFarReferencePtr getRootObjectReference() const = 0;
1293
1298 virtual IPDFObjectPtr getRootObject() const = 0;
1299
1306 virtual bool hasReferencedObject(const IPDFObjectPtr &reference) const = 0;
1307
1318 virtual IPDFObjectPtr resolve(const IPDFObjectPtr &object) const = 0;
1319
1328 virtual void resolveArray(IPDFArrayPtr &array) const = 0;
1329
1338 virtual void dirtyObject(const IPDFObjectPtr &object) = 0;
1339
1343 virtual void dirtyRootObject() = 0;
1344
1349 virtual IPDFReferencePtr newReference() = 0;
1350
1358 virtual void store(const IPDFObjectPtr &object, const IPDFReferencePtr &reference, bool markDirty = true) = 0;
1359
1366 virtual IPDFReferencePtr storeUsingNewReference(const IPDFObjectPtr &object)
1367 {
1368 IPDFReferencePtr reference = newReference();
1369 store(object, reference, true);
1370 return reference;
1371 }
1372
1379 virtual IPDFFarReferencePtr getFarReferenceForReference(const IPDFReferencePtr &reference) const = 0;
1380 };
1381}
1382
1383#endif /* JAWSMAKO_PDFOBJECTS_H */
EDL Factory Interface allows one part of the EDL infrastructure to register class creation methods id...
Definition iedlfactory.h:31
Base class Interface for all Reference Counted objects.
Definition ircobject.h:35
A simple concrete class representing indirect reference data stored in a remote context,...
Definition pdfobjects.h:518
int32 getGeneration() const
Obtain the generation number of this reference data.
Definition pdfobjects.h:610
CPDFFarReference(DOMid docId, DOMid allocatorId, int32 objectNum, int32 generation)
Construct the reference data from remote document, allocator, object number and generator.
Definition pdfobjects.h:535
CPDFFarReference()
Definition pdfobjects.h:520
DOMid getAllocatorId() const
Obtain the id of the entity that allocated the object. If the same as the document id,...
Definition pdfobjects.h:592
int32 getObjectNum() const
Obtain the object number of this reference data.
Definition pdfobjects.h:601
bool operator!=(const CPDFFarReference &other) const
Definition pdfobjects.h:552
DOMid getDocumentId() const
Obtain the source document ID for this document.
Definition pdfobjects.h:581
bool operator<(const CPDFFarReference &other) const
Definition pdfobjects.h:557
bool operator==(const CPDFFarReference &other) const
Definition pdfobjects.h:544
A simple concrete class representing indirect reference data.
Definition pdfobjects.h:395
int32 getObjectNum() const
Obtain the object number of this reference data.
Definition pdfobjects.h:417
CPDFReference(int32 objectNum, int32 generation)
Construct the reference data from an object number and generation.
Definition pdfobjects.h:407
bool operator==(const CPDFReference &other) const
Definition pdfobjects.h:432
int32 getGeneration() const
Obtain the generation number of this reference data.
Definition pdfobjects.h:426
bool operator!=(const CPDFReference &other) const
Definition pdfobjects.h:436
bool operator<(const CPDFReference &other) const
Definition pdfobjects.h:440
CPDFReference()
Definition pdfobjects.h:397
Simple interface to provide a consistent hashing method for Mako objects.
Definition hashable.h:25
A simple class representing a mutable array of other PDF objects.
Definition pdfobjects.h:655
static JAWSMAKO_API IPDFArrayPtr create(const CPDFObjectVect &objects, bool executable=false)
Create a new PDF array from a vector of IPDFObjects.
virtual bool containsCompositeObject(const IPDFObjectPtr &object) const =0
Recursively check to see if the array contains the given composite object (That is,...
virtual void insert(uint32 index, const IPDFObjectPtr &value)=0
Insert the given object in the array at the given index, moving the following objects forward to make...
static JAWSMAKO_API IPDFArrayPtr createFromNames(IEDLClassFactory *pFactory, const CRawStringVect &nameStrings)
Create an array of names from a vector of strings.
static JAWSMAKO_API IPDFArrayPtr createFromFBox(const FBox &box)
Create from an FBox.
static JAWSMAKO_API IPDFArrayPtr createFromNumbersArray(const double *numbers, uint32 numNumbers)
Create from an array of numbers.
virtual bool getNumbers(CDoubleVect &numbers)=0
If the array consists entirely of numbers, retrieve those numbers.
virtual ePDFObjectType getTypeAtIndex(uint32 index) const =0
Get the type of the object stored at the given index. An exception will be thrown if the index is out...
virtual void append(const IPDFObjectPtr &value)=0
Convenience member to append an object to the end of the array.
virtual void put(uint32 index, const IPDFObjectPtr &value)=0
Store the given object in the array at the given index, replacing the currently stored object....
virtual ~IPDFArray()
Definition pdfobjects.h:657
virtual int32 getInteger(uint32 index) const =0
Convenience member to obtain an integer from the array at the given index. An exception will be throw...
virtual uint32 getSize() const =0
Get the current size of the array.
static JAWSMAKO_API IPDFArrayPtr create(uint32 size=0, bool executable=false)
Create a new PDF array of the given initial size.
virtual void copy(uint32 destIndex, const IPDFArrayPtr &sourceArray, uint32 sourceIndex)=0
Copy (but not clone) an entry from another array into an existing position in this array,...
virtual bool getBox(FBox &box)=0
If the array consists of four numbers, retrieve those numbers as a box (left, bottom,...
static JAWSMAKO_API IPDFArrayPtr createFromNumbers(const CDoubleVect &numbers)
Create from a vector of numbers.
virtual IPDFObjectPtr get(uint32 index) const =0
Get the object stored at the given index. An exception will be thrown if the index is out of range.
virtual void remove(uint32 index)=0
Remove the object at the given index from the array, decreasing the size of the array by 1....
static JAWSMAKO_API IPDFArrayPtr createFromFloatNumbers(const CFloatVect &numbers)
Create from a vector of numbers as floats.
A simple immutable boolean PDF object type.
Definition pdfobjects.h:218
virtual bool getValue() const =0
Get the value of the boolean.
virtual ~IPDFBoolean()
Definition pdfobjects.h:220
static JAWSMAKO_API IPDFBooleanPtr create(bool boolean)
Create a boolean object.
Definition pdfobjects.h:1020
uint32 getIndex() const
Get the index within the dictionary of the current iterator position.
Definition pdfobjects.h:1090
Iterator operator++(int)
Definition pdfobjects.h:1069
Iterator()
Definition pdfobjects.h:1051
Iterator(const IPDFDictionaryPtr &dict, bool begin)
Definition pdfobjects.h:1022
IPDFObjectPtr getValue() const
Get the value within the dictionary at the current iterator position.
Definition pdfobjects.h:1125
Iterator & operator++()
Definition pdfobjects.h:1064
ePDFObjectType getValueType() const
Get the type of the value within the dictionary at the current iterator position.
Definition pdfobjects.h:1142
const Iterator & operator=(const Iterator &other)
Definition pdfobjects.h:1058
Iterator(const Iterator &other)
Definition pdfobjects.h:1046
IPDFNamePtr getKey() const
Get the key within the dictionary at the current iterator position.
Definition pdfobjects.h:1103
bool operator!=(const Iterator &other) const
Definition pdfobjects.h:1080
bool operator==(const Iterator &other) const
Definition pdfobjects.h:1075
A simple class representing a mutable dictionary of key-value pairs where the keys are PDF names and ...
Definition pdfobjects.h:828
static JAWSMAKO_API IPDFDictionaryPtr create(IEDLClassFactory *pFactory, uint32 size=0)
Create a new PDF dictionary of the given initial capacity.
virtual void putReal(const RawString &key, double real)=0
Convenience member to add a real to a dictionary.
virtual void putName(const IPDFNamePtr &key, const RawString &name)=0
Convenience member to add a name to a dictionary.
virtual void putName(const RawString &key, const RawString &name)=0
Convenience member to add a name to a dictionary.
virtual void undefine(const char *key)=0
Remove the object stored under the given key, if it exists.
virtual ~IPDFDictionary()
Definition pdfobjects.h:830
virtual void undefine(const IPDFNamePtr &key)=0
Remove the object stored under the given key, if it exists.
virtual Iterator begin()=0
Create an iterator to iterate through all the key-value pairs in the dictionary, beginning at the fir...
virtual Iterator end()=0
Obtain an iterator representing the end of the dictionary.
virtual IPDFObjectPtr get(const IPDFNamePtr &key) const =0
Get the object stored in the dictionary with the given DF name as key.
virtual IPDFObjectPtr get(const char *key) const =0
Get the object stored in the dictionary with the given null-terminated string as key.
virtual void putString(const RawString &key, const RawString &string)=0
Convenience member to add a string to a dictionary.
virtual IPDFObjectPtr get(const RawString &key) const =0
Get the object stored in the dictionary with the given raw string as key.
virtual uint32 getSize() const =0
Get the current size of the dictionary, including currently empty entries.
virtual void undefine(const RawString &key)=0
Remove the object stored under the given key, if it exists.
virtual void putReal(const IPDFNamePtr &key, double real)=0
Convenience member to add a real to a dictionary.
virtual void putInteger(const IPDFNamePtr &key, int32 integer)=0
Convenience member to add an Integer to a dictionary.
virtual void put(const IPDFNamePtr &key, const IPDFObjectPtr &value)=0
Store an object in the dictionary under the given key.
virtual IPDFObjectPtr getValueAtIndex(uint32 index) const =0
Get the value stored in the dictionary entry at the given index.
virtual ePDFObjectType getValueTypeAtIndex(uint32 index) const =0
Get the type of the value stored in the dictionary entry at the given index. An exception is thrown i...
virtual void put(const char *key, const IPDFObjectPtr &value)=0
Store an object in the dictionary under the given key.
virtual void putBoolean(const IPDFNamePtr &key, bool boolean)=0
Convenience member to add a boolean to a dictionary.
virtual bool containsCompositeObject(const IPDFObjectPtr &object) const =0
Recursively check to see if the dictionary contains the given composite object (That is,...
virtual void put(const RawString &key, const IPDFObjectPtr &value)=0
Store an object in the dictionary under the given key.
virtual void putBoolean(const RawString &key, bool boolean)=0
Convenience member to add a boolean to a dictionary.
virtual IPDFNamePtr getKeyAtIndex(uint32 index) const =0
Get the key of the dictionary entry at the given index.
virtual void putString(const IPDFNamePtr &key, const RawString &string)=0
Convenience member to add a string to a dictionary.
virtual void putInteger(const RawString &key, int32 integer)=0
Convenience member to add an Integer to a dictionary.
virtual void copy(const IPDFDictionaryPtr &sourceDict, uint32 sourceIndex)=0
Copy (but not clone) an entry from another dictionary into this dictionary, replacing any currently s...
A simple class representing an immutable PDF indirect reference from a remote context such as (for ex...
Definition pdfobjects.h:629
virtual ~IPDFFarReference()
Definition pdfobjects.h:631
virtual const CPDFFarReference & getValue() const =0
Obtain the CPDFFarReference data for this reference.
static JAWSMAKO_API IPDFFarReferencePtr create(const CPDFFarReference &reference)
Create a remote indirect reference object from CPDFFarReference data.
A simple immutable integer PDF object type.
Definition pdfobjects.h:192
virtual int32 getValue() const =0
Get the value of the integer.
virtual ~IPDFInteger()
Definition pdfobjects.h:194
static JAWSMAKO_API IPDFIntegerPtr create(int32 integer)
Create an integer object.
Definition pdfobjects.h:351
virtual const RawString & getValue() const =0
Get the raw string value of the name.
static JAWSMAKO_API IPDFNamePtr create(IEDLClassFactory *pFactory, const RawString &name)
Create a name object from the given raw string. An attempt will be made to reuse an existing name obj...
static JAWSMAKO_API IPDFNamePtr create(const RawString &name, bool executable=false)
Create a new name object from the given raw string.
virtual bool isValidUtf8() const =0
Determine if the string representing the name will validate as UTF-8.
virtual ~IPDFName()
Definition pdfobjects.h:353
A simple immutable "null" pdf object.
Definition pdfobjects.h:271
virtual ~IPDFNull()
Definition pdfobjects.h:273
static JAWSMAKO_API IPDFNullPtr create()
Create a "null" object.
Abstract interface for a PDF internal object and common interfaces. All non-composite objects are imm...
Definition pdfobjects.h:57
virtual bool containsReferences() const =0
Get whether the object contains indirect references to other objects (that is, does the object or any...
virtual ePDFObjectType getType() const =0
Get the type of this PDF object.
virtual bool getNumber(int32 &number) const =0
If the object is an integer (a integral real or integer) within the range of a 32-bit integer,...
virtual IPDFObjectPtr clone() const =0
Create a clone of this PDF object if appropriate. Note that simple immutable objects are not actually...
virtual void emitPostScriptCode(const IOutputStreamPtr &dest) const =0
Convert the object to PostScript code and write to the given stream. Only allowed for objects that ar...
virtual IPDFObjectPtr deepClone() const =0
Create a deep clone of this PDF object if appropriate. Note that simple immutable objects are not act...
virtual bool getIsExecutable() const =0
Get whether the object is considered executable, such as an executable name, array,...
static JAWSMAKO_API IPDFObjectPtr createNumber(double number)
If the given number is an integer, create an IPDFInteger, otherwise create an IPDFReal.
virtual bool getString(RawString &string) const =0
If the object is a string or a name, retrieve the raw string data.
virtual bool getNumber(float &number) const =0
If the object is a number (a real or integer) within the range of a 32-bit float, obtain that number....
virtual bool getNumber(double &number) const =0
If the object is a number (a real or integer) obtain that number.
A store of IPDFObjects holding a subset/subtree of an entire PDF object database, allowing storage,...
Definition pdfobjects.h:1278
virtual IPDFFarReferencePtr getFarReferenceForReference(const IPDFReferencePtr &reference) const =0
For a given resource present in this store, produce a far reference that can be used to point to it f...
virtual bool hasReferencedObject(const IPDFObjectPtr &reference) const =0
Is the object referred to by the given IPDFReference or IPDFFarReference present in this store?
virtual IPDFObjectPtr getRootObject() const =0
Get the root object from the store.
virtual IPDFFarReferencePtr getRootObjectReference() const =0
Get the far reference for the root object in this store.
virtual void store(const IPDFObjectPtr &object, const IPDFReferencePtr &reference, bool markDirty=true)=0
Store an object in the store under the given reference.
virtual IPDFObjectPtr resolve(const IPDFObjectPtr &object) const =0
Resolve the given object, if an IPDFReference or IPDFFarReference to the object it points to....
virtual IPDFObjectStorePtr clone() const =0
Return a clone of this object store.
virtual void resolveArray(IPDFArrayPtr &array) const =0
For the given array, if there are any indirect objects in the top level of the array,...
virtual IPDFReferencePtr newReference()=0
Allocate a new indirect reference to use for a stored object.
virtual void dirtyObject(const IPDFObjectPtr &object)=0
Mark the given object as dirty so that PDF output will know that it has changed. Only mutable objects...
virtual ~IPDFObjectStore()
Definition pdfobjects.h:1280
virtual void dirtyRootObject()=0
Convenience to mark the root object as dirty. See dirtyObject().
virtual IPDFReferencePtr storeUsingNewReference(const IPDFObjectPtr &object)
Store an object and return a new indirect reference to that object. A convenience that performs newRe...
Definition pdfobjects.h:1366
Definition pdfobjects.h:1247
virtual U8String getValue() const =0
Get the operator name as a string.
static JAWSMAKO_API IPDFOperatorPtr create(uint32 operatorId)
static JAWSMAKO_API IPDFOperatorPtr create(const U8String &operatorName)
virtual uint32 getOperatorId() const =0
Get the (internal) operator integral Id.
virtual ~IPDFOperator()
Definition pdfobjects.h:1249
A simple immutable floating-point PDF object type.
Definition pdfobjects.h:245
virtual double getValue() const =0
Get the value of the real.
virtual ~IPDFReal()
Definition pdfobjects.h:247
static JAWSMAKO_API IPDFRealPtr create(double real)
Create a real object.
A simple class representing an immutable PDF indirect reference.
Definition pdfobjects.h:462
static JAWSMAKO_API IPDFReferencePtr create(const CPDFReference &reference)
Create an indirect reference object from CPDFReference data.
int32 getObjectNum() const
Obtain the object number for this reference.
Definition pdfobjects.h:494
int32 getGeneration() const
Obtain the generation number for this reference.
Definition pdfobjects.h:503
static JAWSMAKO_API IPDFReferencePtr create(int32 objectNum, int32 generation)
Create an indirect reference object from an object number and generation.
Definition pdfobjects.h:479
virtual const CPDFReference & getValue() const =0
Obtain the CPDFReference data for this reference.
virtual ~IPDFReference()
Definition pdfobjects.h:464
Definition pdfobjects.h:1210
virtual IInputStreamPtr getRawStream() const =0
Get a clone of the attached stream.
static JAWSMAKO_API IPDFStreamPtr create(IEDLClassFactory *pFactory, const IInputStreamPtr &stream, uint32 size=0)
Create a new PDF stream of the given initial capacity.
virtual ~IPDFStream()
Definition pdfobjects.h:1212
virtual IRAInputStreamPtr getStream() const =0
Get a clone of the attached stream. If the stream is not random access, a new stream will be created ...
A simple immutable string pdf object containing raw unencoded data or PDF Text information.
Definition pdfobjects.h:291
static JAWSMAKO_API IPDFStringPtr create(const IInputStreamPtr &stream, bool executable=false, bool pdf2=false, int64 startOffset=0)
Create a raw string object using the contents of a string.
static JAWSMAKO_API IPDFStringPtr createText(const U8String &string, bool executable=false, bool pdf2=false)
Create a string object in PDF encoding from a UTF-8 string.
virtual bool isUtf8Encoded()=0
Determine if the string is UTF-8 encoded. Will only be true for strings from PDF 2....
static JAWSMAKO_API IPDFStringPtr create(const RawString &string, bool executable=false, bool pdf2=false)
Create a string object from a raw unencoded string.
virtual U8String getTextValue() const =0
Get the UTF-8 value of this PDF Text-encoded string.
virtual ~IPDFString()
Definition pdfobjects.h:293
virtual const RawString & getValue() const =0
Get the raw value of the string.
EDL_API void throwEDLError(uint32 errorcode)
Utility - Throw an IEDLError exception with the given error code.
BoxTmpl< double > FBox
Definition edlgeom.h:443
unsigned int uint32
Definition edltypes.h:34
signed int int32
Definition edltypes.h:29
signed long long int64
Definition edltypes.h:30
@ EDL_ERR_UNDEFINED
Undefined error.
Definition edlerrors.h:30
@ JM_ERR_RANGE_ERROR
An attempt was made to request or add an item from the API with an out-of-bounds index.
Definition edlerrors.h:57
@ EDL_ERR_BAD_ARGUMENTS
General error for bad arguments passed to an API function.
Definition edlerrors.h:44
EDL::uint64 DOMid
Type used to uniquely idenitify a DOM node.
Definition idomid.h:17
ePDFObjectType
An enumeration of PDF object types.
Definition pdfobjects.h:33
@ ePOTInteger
A PDF Integer object.
Definition pdfobjects.h:34
@ ePOTReference
An indirect reference to a local PDF object stored in the same context.
Definition pdfobjects.h:42
@ ePOTBoolean
A PDF Boolean object.
Definition pdfobjects.h:35
@ ePOTString
A PDF String object.
Definition pdfobjects.h:37
@ ePOTOperator
A PDF/PostScript Operator object.
Definition pdfobjects.h:45
@ ePOTName
A PDF Name object.
Definition pdfobjects.h:38
@ ePOTReal
A PDF Real Object.
Definition pdfobjects.h:36
@ ePOTFarReference
An indirect reference to a non-local PDF object.
Definition pdfobjects.h:43
@ ePOTNull
A PDF NULL object.
Definition pdfobjects.h:41
@ ePOTArray
A PDF Array object.
Definition pdfobjects.h:39
@ ePOTDictionary
A PDF Dictionary object.
Definition pdfobjects.h:40
@ ePOTStream
A PDF Stream object.
Definition pdfobjects.h:44
@ ePOTLargeInteger
A 64 bit integer object. Mako internal use only.
Definition pdfobjects.h:46
EDLSysString U8String
A UTF-8 String.
Definition types.h:146
EDLSysString RawString
A raw, 8 bit string. Encoding depends on context.
Definition types.h:152
An abstract interface for an object that can be hashed.
const DOMid INVALID_DOM_ID
Definition idomid.h:19
Definition apexcustompostprocess.h:17
CEDLVector< double > CDoubleVect
Definition types.h:188
CEDLSysStringVect CRawStringVect
Definition types.h:170
CEDLVector< IPDFObjectPtr > CPDFObjectVect
Definition types.h:97
CEDLVector< float > CFloatVect
Definition types.h:187
CSmartPtr< T > pdfObj2Type(const IPDFObjectPtr &object, ePDFObjectType type)
Definition pdfobjects.h:177
#define CSmartPtr
Definition smartptr.h:222
#define JAWSMAKO_API
Definition types.h:29