Mako 8.3.0 API
MakoCore SDK API Documentation
Loading...
Searching...
No Matches
pdfobjects.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2019-2025 Global Graphics Software 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 if (m_objectNum < other.m_objectNum)
439 return true;
440 else if (m_objectNum > other.m_objectNum)
441 return false;
442 else if (m_generation < other.m_generation)
443 return true;
444 else
445 return false;
446 }
447 private:
448 int32 m_objectNum;
449 int32 m_generation;
450 };
451
458 {
459 public:
460 virtual ~IPDFReference() {}
461
467 static JAWSMAKO_API IPDFReferencePtr create(const CPDFReference &reference);
468
475 static JAWSMAKO_API IPDFReferencePtr create(int32 objectNum, int32 generation)
476 {
477 return create(CPDFReference(objectNum, generation));
478 }
479
484 virtual const CPDFReference &getValue() const = 0;
485
491 {
492 return getValue().getObjectNum();
493 }
494
500 {
501 return getValue().getGeneration();
502 }
503 };
504 #define pdfObj2IPDFReference(obj) JawsMako::pdfObj2Type<IPDFReference>(obj, JawsMako::ePOTReference)
505 #define obj2IPDFReference(obj) JawsMako::IPDFReferencePtr(dynamic_cast<JawsMako::IPDFReference *>((IRCObject *) (obj)), true)
506
514 {
515 public:
517 {
518 m_docId = INVALID_DOM_ID;
519 m_allocatorId = INVALID_DOM_ID;
520 m_objectNum = -1;
521 m_generation = -1;
522 }
523
531 CPDFFarReference(DOMid docId, DOMid allocatorId, int32 objectNum, int32 generation)
532 {
533 m_docId = docId;
534 m_allocatorId = allocatorId;
535 m_objectNum = objectNum;
536 m_generation = generation;
537 }
538
539 // For use in maps and other containers
540 bool operator==(const CPDFFarReference &other) const
541 {
542 return (m_docId == other.m_docId &&
543 m_allocatorId == other.m_allocatorId &&
544 m_objectNum == other.m_objectNum &&
545 m_generation == other.m_generation);
546 }
547
548 bool operator!=(const CPDFFarReference &other) const
549 {
550 return !(other == *this);
551 }
552
553 bool operator<(const CPDFFarReference &other) const
554 {
555 if (m_docId < other.m_docId)
556 return true;
557 else if (m_docId > other.m_docId)
558 return false;
559 else if (m_allocatorId < other.m_allocatorId)
560 return true;
561 else if (m_allocatorId > other.m_allocatorId)
562 return false;
563 else if (m_objectNum < other.m_objectNum)
564 return true;
565 else if (m_objectNum > other.m_objectNum)
566 return false;
567 else if (m_generation < other.m_generation)
568 return true;
569 else
570 return false;
571 }
572
578 {
579 return m_docId;
580 }
581
589 {
590 return m_allocatorId;
591 }
592
598 {
599 return m_objectNum;
600 }
601
607 {
608 return m_generation;
609 }
610
611 private:
612 DOMid m_docId;
613 DOMid m_allocatorId;
614 int32 m_objectNum;
615 int32 m_generation;
616 };
617
625 {
626 public:
627 virtual ~IPDFFarReference() {}
628
634 static JAWSMAKO_API IPDFFarReferencePtr create(const CPDFFarReference &reference);
635
640 virtual const CPDFFarReference &getValue() const = 0;
641 };
642 #define pdfObj2IPDFFarReference(obj) pdfObj2Type<JawsMako::IPDFFarReference>(obj, JawsMako::ePOTFarReference)
643 #define obj2IPDFFarReference(obj) JawsMako::IPDFFarReferencePtr(dynamic_cast<JawsMako::IPDFFarReference *>((IRCObject *) (obj)), true)
644
650 class IPDFArray : public IPDFObject
651 {
652 public:
653 virtual ~IPDFArray() {}
654
661 static JAWSMAKO_API IPDFArrayPtr create(uint32 size = 0, bool executable = false);
662
669 static JAWSMAKO_API IPDFArrayPtr create(const CPDFObjectVect &objects, bool executable = false);
670
676 static JAWSMAKO_API IPDFArrayPtr createFromNumbers(const CDoubleVect &numbers);
677
683 static JAWSMAKO_API IPDFArrayPtr createFromFloatNumbers(const CFloatVect &numbers);
684
685#ifdef SWIG
686#if SWIGJAVA
687 %apply double [] { const double *numbers };
688#endif
689#if SWIGCSHARP
690 %apply double INPUT[] { const double *numbers };
691#endif
692#endif
699 static JAWSMAKO_API IPDFArrayPtr createFromNumbersArray(const double *numbers, uint32 numNumbers);
700#ifdef SWIG
701 %clear const double *numbers;
702#endif
703
710 static JAWSMAKO_API IPDFArrayPtr createFromNames(IEDLClassFactory *pFactory, const CRawStringVect &nameStrings);
711
717 static JAWSMAKO_API IPDFArrayPtr createFromFBox(const FBox &box);
718
723 virtual uint32 getSize() const = 0;
724
731 virtual IPDFObjectPtr get(uint32 index) const = 0;
732
739 virtual ePDFObjectType getTypeAtIndex(uint32 index) const = 0;
740
749 virtual void put(uint32 index, const IPDFObjectPtr &value) = 0;
750
758 virtual void insert(uint32 index, const IPDFObjectPtr &value) = 0;
759
766 virtual void remove(uint32 index) = 0;
767
772 virtual void append(const IPDFObjectPtr &value) = 0;
773
782 virtual void copy(uint32 destIndex, const IPDFArrayPtr &sourceArray, uint32 sourceIndex) = 0;
783
789 virtual bool getNumbers(CDoubleVect &numbers) = 0;
790
796 virtual bool getBox(FBox &box) = 0;
797
804 virtual int32 getInteger(uint32 index) const = 0;
805
812 virtual bool containsCompositeObject(const IPDFObjectPtr &object) const = 0;
813 };
814 #define pdfObj2IPDFArray(obj) JawsMako::pdfObj2Type<JawsMako::IPDFArray>(obj, JawsMako::ePOTArray)
815 #define obj2IPDFArray(obj) JawsMako::IPDFArrayPtr(dynamic_cast<JawsMako::IPDFArray *>((IRCObject *) (obj)), true)
816
824 {
825 public:
826 virtual ~IPDFDictionary() {}
827
834 static JAWSMAKO_API IPDFDictionaryPtr create(IEDLClassFactory *pFactory, uint32 size = 0);
835
840 virtual uint32 getSize() const = 0;
841
847 virtual IPDFNamePtr getKeyAtIndex(uint32 index) const = 0;
848
854 virtual IPDFObjectPtr getValueAtIndex(uint32 index) const = 0;
855
862 virtual ePDFObjectType getValueTypeAtIndex(uint32 index) const = 0;
863
869 virtual IPDFObjectPtr get(const char *key) const = 0;
870
876 virtual IPDFObjectPtr get(const RawString &key) const = 0;
877
883 virtual IPDFObjectPtr get(const IPDFNamePtr &key) const = 0;
884
890 virtual void put(const char *key, const IPDFObjectPtr &value) = 0;
891
897 virtual void put(const RawString &key, const IPDFObjectPtr &value) = 0;
898
904 virtual void put(const IPDFNamePtr &key, const IPDFObjectPtr &value) = 0;
905
910 virtual void undefine(const char *key) = 0;
911
916 virtual void undefine(const RawString &key) = 0;
917
922 virtual void undefine(const IPDFNamePtr &key) = 0;
923
931 virtual void copy(const IPDFDictionaryPtr &sourceDict, uint32 sourceIndex) = 0;
932
938 virtual void putInteger(const IPDFNamePtr &key, int32 integer) = 0;
939
945 virtual void putInteger(const RawString &key, int32 integer) = 0;
946
952 virtual void putReal(const IPDFNamePtr &key, double real) = 0;
953
959 virtual void putReal(const RawString &key, double real) = 0;
960
967 virtual bool containsCompositeObject(const IPDFObjectPtr &object) const = 0;
968
974 {
975 public:
976 Iterator(const IPDFDictionaryPtr &dict, bool begin)
977 {
978 if (!dict)
979 {
981 }
982 m_index = 0;
983 m_limit = dict->getSize();
984 m_dict = dict;
985
986 if (begin)
987 {
988 if (m_limit > 0 && dict->getKeyAtIndex(0) == NULL)
989 {
990 // First index is an empty slot - skip it
991 increment();
992 }
993 }
994 else
995 {
996 m_index = m_limit;
997 }
998 }
999
1000 Iterator(const Iterator &other)
1001 {
1002 assign(other);
1003 }
1004
1006 {
1007 m_index = 0;
1008 m_limit = 0;
1009 m_dict = NULL;
1010 }
1011
1012 const Iterator &operator=(const Iterator &other)
1013 {
1014 assign(other);
1015 return *this;
1016 }
1017
1019 {
1020 increment();
1021 return *this;
1022 }
1024 {
1025 Iterator i = *this;
1026 increment();
1027 return i;
1028 }
1029 bool operator==(const Iterator &other) const
1030 {
1031 return (m_index == other.m_index &&
1032 m_dict == other.m_dict);
1033 }
1034 bool operator!=(const Iterator &other) const
1035 {
1036 return (m_index != other.m_index ||
1037 m_dict != other.m_dict);
1038 }
1039
1045 {
1046 if (!m_dict)
1047 {
1049 }
1050 return m_index;
1051 }
1052
1057 IPDFNamePtr getKey() const
1058 {
1059 if (!m_dict)
1060 {
1062 }
1063 if (m_index == m_limit)
1064 {
1066 }
1067 IPDFNamePtr key = m_dict->getKeyAtIndex(m_index);
1068 if (!key)
1069 {
1071 }
1072 return key;
1073 }
1074
1079 IPDFObjectPtr getValue() const
1080 {
1081 if (!m_dict)
1082 {
1084 }
1085 if (m_index == m_limit)
1086 {
1088 }
1089 return m_dict->getValueAtIndex(m_index);
1090 }
1091
1097 {
1098 if (!m_dict)
1099 {
1101 }
1102 if (m_index == m_limit)
1103 {
1105 }
1106 return m_dict->getValueTypeAtIndex(m_index);
1107 }
1108 private:
1109 void assign(const Iterator &other)
1110 {
1111 m_dict = other.m_dict;
1112 m_index = other.m_index;
1113 m_limit = other.m_limit;
1114 }
1115 void increment()
1116 {
1117 if (m_index == m_limit)
1118 {
1120 }
1121 do
1122 {
1123 m_index++;
1124 }
1125 while (m_index < m_limit && m_dict->getKeyAtIndex(m_index) == NULL);
1126 }
1127
1128 uint32 m_index;
1129 uint32 m_limit;
1130 IPDFDictionaryPtr m_dict;
1131 };
1132
1138 virtual Iterator begin() = 0;
1139
1144 virtual Iterator end() = 0;
1145 };
1146
1147 static IPDFDictionaryPtr pdfObj2IPDFDictionary(const IPDFObjectPtr &object)
1148 {
1149 if (!object || (object->getType() != ePOTDictionary && object->getType() != ePOTStream))
1150 {
1151 return IPDFDictionaryPtr();
1152 }
1153 return IPDFDictionaryPtr(static_cast<IPDFDictionary *>((IPDFObject *) object), true);
1154 }
1155 #define obj2IPDFDictionary(obj) JawsMako::IPDFDictionaryPtr(dynamic_cast<JawsMako::IPDFDictionary *>((IRCObject *) (obj)), true)
1156
1164 {
1165 public:
1166 virtual ~IPDFStream() {}
1167
1175 static JAWSMAKO_API IPDFStreamPtr create(IEDLClassFactory *pFactory, const IInputStreamPtr &stream, uint32 size = 0);
1176
1183 virtual IRAInputStreamPtr getStream() const = 0;
1184
1189 virtual IInputStreamPtr getRawStream() const = 0;
1190 };
1191 #define pdfObj2IPDFStream(obj) JawsMako::pdfObj2Type<JawsMako::IPDFStream>(obj, JawsMako::ePOTStream)
1192 #define obj2IPDFStream(obj) JawsMako::IPDFStreamPtr(dynamic_cast<JawsMako::IPDFStream *>((IRCObject *) (obj)), true)
1193
1201 {
1202 public:
1203 virtual ~IPDFOperator() {}
1204
1205 static JAWSMAKO_API IPDFOperatorPtr create(const U8String &operatorName);
1206 static JAWSMAKO_API IPDFOperatorPtr create(uint32 operatorId);
1207
1212 virtual U8String getValue() const = 0;
1213
1218 virtual uint32 getOperatorId() const = 0;
1219 };
1220 #define pdfObj2IPDFOperator(obj) JawsMako::pdfObj2Type<JawsMako::IPDFOperator>(obj, JawsMako::ePOTOperator)
1221 #define obj2IPDFOperator(obj) JawsMako::IPDFOperatorPtr(dynamic_cast<JawsMako::IPDFOperator *>((IRCObject *) (obj)), true)
1222
1232 {
1233 public:
1234 virtual ~IPDFObjectStore() {}
1235
1240 virtual IPDFObjectStorePtr clone() const = 0;
1241
1246 virtual IPDFFarReferencePtr getRootObjectReference() const = 0;
1247
1252 virtual IPDFObjectPtr getRootObject() const = 0;
1253
1260 virtual bool hasReferencedObject(const IPDFObjectPtr &reference) const = 0;
1261
1272 virtual IPDFObjectPtr resolve(const IPDFObjectPtr &object) const = 0;
1273
1282 virtual void resolveArray(IPDFArrayPtr &array) const = 0;
1283
1292 virtual void dirtyObject(const IPDFObjectPtr &object) = 0;
1293
1297 virtual void dirtyRootObject() = 0;
1298
1303 virtual IPDFReferencePtr newReference() = 0;
1304
1312 virtual void store(const IPDFObjectPtr &object, const IPDFReferencePtr &reference, bool markDirty = true) = 0;
1313
1320 virtual IPDFReferencePtr storeUsingNewReference(const IPDFObjectPtr &object)
1321 {
1322 IPDFReferencePtr reference = newReference();
1323 store(object, reference, true);
1324 return reference;
1325 }
1326
1333 virtual IPDFFarReferencePtr getFarReferenceForReference(const IPDFReferencePtr &reference) const = 0;
1334 };
1335}
1336
1337#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:514
int32 getGeneration() const
Obtain the generation number of this reference data.
Definition pdfobjects.h:606
CPDFFarReference(DOMid docId, DOMid allocatorId, int32 objectNum, int32 generation)
Construct the reference data from remote document, allocator, object number and generator.
Definition pdfobjects.h:531
CPDFFarReference()
Definition pdfobjects.h:516
DOMid getAllocatorId() const
Obtain the id of the entity that allocated the object. If the same as the document id,...
Definition pdfobjects.h:588
int32 getObjectNum() const
Obtain the object number of this reference data.
Definition pdfobjects.h:597
bool operator!=(const CPDFFarReference &other) const
Definition pdfobjects.h:548
DOMid getDocumentId() const
Obtain the source document ID for this document.
Definition pdfobjects.h:577
bool operator<(const CPDFFarReference &other) const
Definition pdfobjects.h:553
bool operator==(const CPDFFarReference &other) const
Definition pdfobjects.h:540
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
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:651
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:653
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:974
uint32 getIndex() const
Get the index within the dictionary of the current iterator position.
Definition pdfobjects.h:1044
Iterator operator++(int)
Definition pdfobjects.h:1023
Iterator()
Definition pdfobjects.h:1005
Iterator(const IPDFDictionaryPtr &dict, bool begin)
Definition pdfobjects.h:976
IPDFObjectPtr getValue() const
Get the value within the dictionary at the current iterator position.
Definition pdfobjects.h:1079
Iterator & operator++()
Definition pdfobjects.h:1018
ePDFObjectType getValueType() const
Get the type of the value within the dictionary at the current iterator position.
Definition pdfobjects.h:1096
const Iterator & operator=(const Iterator &other)
Definition pdfobjects.h:1012
Iterator(const Iterator &other)
Definition pdfobjects.h:1000
IPDFNamePtr getKey() const
Get the key within the dictionary at the current iterator position.
Definition pdfobjects.h:1057
bool operator!=(const Iterator &other) const
Definition pdfobjects.h:1034
bool operator==(const Iterator &other) const
Definition pdfobjects.h:1029
A simple class representing a mutable dictionary of key-value pairs where the keys are PDF names and ...
Definition pdfobjects.h:824
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 undefine(const char *key)=0
Remove the object stored under the given key, if it exists.
virtual ~IPDFDictionary()
Definition pdfobjects.h:826
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 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 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 IPDFNamePtr getKeyAtIndex(uint32 index) const =0
Get the key of the dictionary entry at the given index.
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:625
virtual ~IPDFFarReference()
Definition pdfobjects.h:627
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:1232
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:1234
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:1320
Definition pdfobjects.h:1201
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:1203
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:458
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:490
int32 getGeneration() const
Obtain the generation number for this reference.
Definition pdfobjects.h:499
static JAWSMAKO_API IPDFReferencePtr create(int32 objectNum, int32 generation)
Create an indirect reference object from an object number and generation.
Definition pdfobjects.h:475
virtual const CPDFReference & getValue() const =0
Obtain the CPDFReference data for this reference.
virtual ~IPDFReference()
Definition pdfobjects.h:460
Definition pdfobjects.h:1164
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:1166
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:441
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:28
@ 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:54
@ EDL_ERR_BAD_ARGUMENTS
General error for bad arguments passed to an API function.
Definition edlerrors.h:42
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:144
EDLSysString RawString
A raw, 8 bit string. Encoding depends on context.
Definition types.h:150
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:186
CEDLSysStringVect CRawStringVect
Definition types.h:168
CEDLVector< IPDFObjectPtr > CPDFObjectVect
Definition types.h:95
CEDLVector< float > CFloatVect
Definition types.h:185
CSmartPtr< T > pdfObj2Type(const IPDFObjectPtr &object, ePDFObjectType type)
Definition pdfobjects.h:177
#define CSmartPtr
Definition smartptr.h:215
#define JAWSMAKO_API
Definition types.h:29