Mako 8.2.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
47
55 class IPDFObject : public IRCObject, public IHashable
56 {
57 public:
58
63 virtual ePDFObjectType getType() const = 0;
64
71 virtual IPDFObjectPtr clone() const = 0;
72
81 virtual IPDFObjectPtr deepClone() const = 0;
82
88 virtual bool getIsExecutable() const = 0;
89
96 virtual bool containsReferences() const = 0;
97
103 virtual void emitPostScriptCode(const IOutputStreamPtr &dest) const = 0;
104
105 //
106 // Convenience functions
107 //
108
109#ifdef SWIG
110 %apply double &OUTPUT { double &number };
111#endif
118 virtual bool getNumber(double &number) const = 0;
119#ifdef SWIG
120 %clear double &number;
121#endif
122
123#ifdef SWIG
124 %apply float &OUTPUT { float &number };
125#endif
135 virtual bool getNumber(float &number) const = 0;
136#ifdef SWIG
137 %apply int32_t &OUTPUT { int32 &number };
138#endif
139
140#ifdef SWIG
141 %apply int32_t &OUTPUT { int32 &number };
142#endif
150 virtual bool getNumber(int32 &number) const = 0;
151#ifdef SWIG
152 %clear int32 &number;
153#endif
154
161 static JAWSMAKO_API IPDFObjectPtr createNumber(double number);
162
169 virtual bool getString(RawString &string) const = 0;
170 };
171 #define obj2IPDFObject(obj) JawsMako::IPDFObjectPtr(dynamic_cast<JawsMako::IPDFObject *>((IRCObject *) (obj)), true)
172
173 // A useful templated utility for faster casting between object types
174 // with checking, but without requiring dynamic casting.
175 template <typename T>
176 CSmartPtr<T> pdfObj2Type(const IPDFObjectPtr &object, ePDFObjectType type)
177 {
178 if (!object || object->getType() != type)
179 {
180 return CSmartPtr<T> ();
181 }
182 return CSmartPtr<T>(static_cast<T *>((IPDFObject *) object), true);
183 }
184
190 class IPDFInteger : public IPDFObject
191 {
192 public:
193 virtual ~IPDFInteger() {}
194
200 static JAWSMAKO_API IPDFIntegerPtr create(int32 integer);
201
206 virtual int32 getValue() const = 0;
207 };
208 #define pdfObj2IPDFInteger(obj) JawsMako::pdfObj2Type<JawsMako::IPDFInteger>(obj, JawsMako::ePOTInteger)
209 #define obj2IPDFInteger(obj) JawsMako::IPDFIntegerPtr(dynamic_cast<JawsMako::IPDFInteger *>((IRCObject *) (obj)), true)
210
216 class IPDFBoolean : public IPDFObject
217 {
218 public:
219 virtual ~IPDFBoolean() {}
220
226 static JAWSMAKO_API IPDFBooleanPtr create(bool boolean);
227
232 virtual bool getValue() const = 0;
233 };
234 #define pdfObj2IPDFBoolean(obj) JawsMako::pdfObj2Type<JawsMako::IPDFBoolean>(obj, JawsMako::ePOTBoolean)
235 #define obj2IPDFBoolean(obj) JawsMako::IPDFBooleanPtr(dynamic_cast<JawsMako::IPDFBoolean *>((IRCObject *) (obj)), true)
236
237
243 class IPDFReal : public IPDFObject
244 {
245 public:
246 virtual ~IPDFReal() {}
247
253 static JAWSMAKO_API IPDFRealPtr create(double real);
254
259 virtual double getValue() const = 0;
260 };
261 #define pdfObj2IPDFReal(obj) JawsMako::pdfObj2Type<JawsMako::IPDFReal>(obj, JawsMako::ePOTReal)
262 #define obj2IPDFReal(obj) JawsMako::IPDFRealPtr(dynamic_cast<JawsMako::IPDFReal *>((IRCObject *) (obj)), true)
263
269 class IPDFNull : public IPDFObject
270 {
271 public:
272 virtual ~IPDFNull() {}
273
278 static JAWSMAKO_API IPDFNullPtr create();
279 };
280 #define pdfObj2IPDFNull(obj) JawsMako::pdfObj2Type<JawsMako::IPDFNull>(obj, JawsMako::ePOTNull)
281 #define obj2IPDFNull(obj) JawsMako::IPDFNullPtr(dynamic_cast<JawsMako::IPDFNull *>((IRCObject *) (obj)), true)
282
289 class IPDFString : public IPDFObject
290 {
291 public:
292 virtual ~IPDFString() {}
293
301 static JAWSMAKO_API IPDFStringPtr create(const RawString &string, bool executable = false, bool pdf2 = false);
302
310 static JAWSMAKO_API IPDFStringPtr createText(const U8String &string, bool executable = false, bool pdf2 = false);
311
320 static JAWSMAKO_API IPDFStringPtr create(const IInputStreamPtr &stream, bool executable = false, bool pdf2 = false, int64 startOffset = 0);
321
327 virtual bool isUtf8Encoded() = 0;
328
333 virtual const RawString &getValue() const = 0;
334
339 virtual U8String getTextValue() const = 0;
340 };
341 #define pdfObj2IPDFString(obj) JawsMako::pdfObj2Type<JawsMako::IPDFString>(obj, JawsMako::ePOTString)
342 #define obj2IPDFString(obj) JawsMako::IPDFStringPtr(dynamic_cast<JawsMako::IPDFString *>((IRCObject *) (obj)), true)
343
349 class IPDFName : public IPDFObject
350 {
351 public:
352 virtual ~IPDFName() {}
353
362 static JAWSMAKO_API IPDFNamePtr create(IEDLClassFactory *pFactory, const RawString &name);
363
370 static JAWSMAKO_API IPDFNamePtr create(const RawString &name, bool executable = false);
371
376 virtual bool isValidUtf8() const = 0;
377
382 virtual const RawString &getValue() const = 0;
383 };
384 #define pdfObj2IPDFName(obj) JawsMako::pdfObj2Type<JawsMako::IPDFName>(obj, JawsMako::ePOTName)
385 #define obj2IPDFName(obj) JawsMako::IPDFNamePtr(dynamic_cast<JawsMako::IPDFName *>((IRCObject *) (obj)), true)
386
394 {
395 public:
397 {
398 m_objectNum = -1;
399 m_generation = -1;
400 }
401
406 CPDFReference(int32 objectNum, int32 generation)
407 {
408 m_objectNum = objectNum;
409 m_generation = generation;
410 }
411
417 {
418 return m_objectNum;
419 }
420
426 {
427 return m_generation;
428 }
429
430 // For use in maps and other containers.
431 bool operator==(const CPDFReference& other) const
432 {
433 return ((m_objectNum == other.m_objectNum) && (m_generation == other.m_generation));
434 }
435 bool operator<(const CPDFReference& other) const
436 {
437 if (m_objectNum < other.m_objectNum)
438 return true;
439 else if (m_objectNum > other.m_objectNum)
440 return false;
441 else if (m_generation < other.m_generation)
442 return true;
443 else
444 return false;
445 }
446 private:
447 int32 m_objectNum;
448 int32 m_generation;
449 };
450
457 {
458 public:
459 virtual ~IPDFReference() {}
460
466 static JAWSMAKO_API IPDFReferencePtr create(const CPDFReference &reference);
467
474 static JAWSMAKO_API IPDFReferencePtr create(int32 objectNum, int32 generation)
475 {
476 return create(CPDFReference(objectNum, generation));
477 }
478
483 virtual const CPDFReference &getValue() const = 0;
484
490 {
491 return getValue().getObjectNum();
492 }
493
499 {
500 return getValue().getGeneration();
501 }
502 };
503 #define pdfObj2IPDFReference(obj) JawsMako::pdfObj2Type<IPDFReference>(obj, JawsMako::ePOTReference)
504 #define obj2IPDFReference(obj) JawsMako::IPDFReferencePtr(dynamic_cast<JawsMako::IPDFReference *>((IRCObject *) (obj)), true)
505
513 {
514 public:
516 {
517 m_docId = INVALID_DOM_ID;
518 m_allocatorId = INVALID_DOM_ID;
519 m_objectNum = -1;
520 m_generation = -1;
521 }
522
530 CPDFFarReference(DOMid docId, DOMid allocatorId, int32 objectNum, int32 generation)
531 {
532 m_docId = docId;
533 m_allocatorId = allocatorId;
534 m_objectNum = objectNum;
535 m_generation = generation;
536 }
537
538 // For use in maps and other containers
539 bool operator==(const CPDFFarReference &other) const
540 {
541 return (m_docId == other.m_docId &&
542 m_allocatorId == other.m_allocatorId &&
543 m_objectNum == other.m_objectNum &&
544 m_generation == other.m_generation);
545 }
546
547 bool operator!=(const CPDFFarReference &other) const
548 {
549 return !(other == *this);
550 }
551
552 bool operator<(const CPDFFarReference &other) const
553 {
554 if (m_docId < other.m_docId)
555 return true;
556 else if (m_docId > other.m_docId)
557 return false;
558 else if (m_allocatorId < other.m_allocatorId)
559 return true;
560 else if (m_allocatorId > other.m_allocatorId)
561 return false;
562 else if (m_objectNum < other.m_objectNum)
563 return true;
564 else if (m_objectNum > other.m_objectNum)
565 return false;
566 else if (m_generation < other.m_generation)
567 return true;
568 else
569 return false;
570 }
571
577 {
578 return m_docId;
579 }
580
588 {
589 return m_allocatorId;
590 }
591
597 {
598 return m_objectNum;
599 }
600
606 {
607 return m_generation;
608 }
609
610 private:
611 DOMid m_docId;
612 DOMid m_allocatorId;
613 int32 m_objectNum;
614 int32 m_generation;
615 };
616
624 {
625 public:
626 virtual ~IPDFFarReference() {}
627
633 static JAWSMAKO_API IPDFFarReferencePtr create(const CPDFFarReference &reference);
634
639 virtual const CPDFFarReference &getValue() const = 0;
640 };
641 #define pdfObj2IPDFFarReference(obj) pdfObj2Type<JawsMako::IPDFFarReference>(obj, JawsMako::ePOTFarReference)
642 #define obj2IPDFFarReference(obj) JawsMako::IPDFFarReferencePtr(dynamic_cast<JawsMako::IPDFFarReference *>((IRCObject *) (obj)), true)
643
649 class IPDFArray : public IPDFObject
650 {
651 public:
652 virtual ~IPDFArray() {}
653
660 static JAWSMAKO_API IPDFArrayPtr create(uint32 size = 0, bool executable = false);
661
668 static JAWSMAKO_API IPDFArrayPtr create(const CPDFObjectVect &objects, bool executable = false);
669
675 static JAWSMAKO_API IPDFArrayPtr createFromNumbers(const CDoubleVect &numbers);
676
677#ifdef SWIG
678#if SWIGJAVA
679 %apply double [] { const double *numbers };
680#endif
681#if SWIGCSHARP
682 %apply double INPUT[] { const double *numbers };
683#endif
684#endif
691 static JAWSMAKO_API IPDFArrayPtr createFromNumbersArray(const double *numbers, uint32 numNumbers);
692#ifdef SWIG
693 %clear const double *numbers;
694#endif
695
701 static JAWSMAKO_API IPDFArrayPtr createFromFBox(const FBox &box);
702
707 virtual uint32 getSize() const = 0;
708
715 virtual IPDFObjectPtr get(uint32 index) const = 0;
716
723 virtual ePDFObjectType getTypeAtIndex(uint32 index) const = 0;
724
733 virtual void put(uint32 index, const IPDFObjectPtr &value) = 0;
734
742 virtual void insert(uint32 index, const IPDFObjectPtr &value) = 0;
743
750 virtual void remove(uint32 index) = 0;
751
756 virtual void append(const IPDFObjectPtr &value) = 0;
757
766 virtual void copy(uint32 destIndex, const IPDFArrayPtr &sourceArray, uint32 sourceIndex) = 0;
767
773 virtual bool getNumbers(CDoubleVect &numbers) = 0;
774
780 virtual bool getBox(FBox &box) = 0;
781
788 virtual int32 getInteger(uint32 index) const = 0;
789
796 virtual bool containsCompositeObject(const IPDFObjectPtr &object) const = 0;
797 };
798 #define pdfObj2IPDFArray(obj) JawsMako::pdfObj2Type<JawsMako::IPDFArray>(obj, JawsMako::ePOTArray)
799 #define obj2IPDFArray(obj) JawsMako::IPDFArrayPtr(dynamic_cast<JawsMako::IPDFArray *>((IRCObject *) (obj)), true)
800
808 {
809 public:
810 virtual ~IPDFDictionary() {}
811
818 static JAWSMAKO_API IPDFDictionaryPtr create(IEDLClassFactory *pFactory, uint32 size = 0);
819
824 virtual uint32 getSize() const = 0;
825
831 virtual IPDFNamePtr getKeyAtIndex(uint32 index) const = 0;
832
838 virtual IPDFObjectPtr getValueAtIndex(uint32 index) const = 0;
839
846 virtual ePDFObjectType getValueTypeAtIndex(uint32 index) const = 0;
847
853 virtual IPDFObjectPtr get(const char *key) const = 0;
854
860 virtual IPDFObjectPtr get(const RawString &key) const = 0;
861
867 virtual IPDFObjectPtr get(const IPDFNamePtr &key) const = 0;
868
874 virtual void put(const char *key, const IPDFObjectPtr &value) = 0;
875
881 virtual void put(const RawString &key, const IPDFObjectPtr &value) = 0;
882
888 virtual void put(const IPDFNamePtr &key, const IPDFObjectPtr &value) = 0;
889
894 virtual void undefine(const char *key) = 0;
895
900 virtual void undefine(const RawString &key) = 0;
901
906 virtual void undefine(const IPDFNamePtr &key) = 0;
907
915 virtual void copy(const IPDFDictionaryPtr &sourceDict, uint32 sourceIndex) = 0;
916
922 virtual void putInteger(const IPDFNamePtr &key, int32 integer) = 0;
923
929 virtual void putReal(const IPDFNamePtr &key, double real) = 0;
930
937 virtual bool containsCompositeObject(const IPDFObjectPtr &object) const = 0;
938
944 {
945 public:
946 Iterator(const IPDFDictionaryPtr &dict, bool begin)
947 {
948 if (!dict)
949 {
951 }
952 m_index = 0;
953 m_limit = dict->getSize();
954 m_dict = dict;
955
956 if (begin)
957 {
958 if (m_limit > 0 && dict->getKeyAtIndex(0) == NULL)
959 {
960 // First index is an empty slot - skip it
961 increment();
962 }
963 }
964 else
965 {
966 m_index = m_limit;
967 }
968 }
969
970 Iterator(const Iterator &other)
971 {
972 assign(other);
973 }
974
976 {
977 m_index = 0;
978 m_limit = 0;
979 m_dict = NULL;
980 }
981
982 const Iterator &operator=(const Iterator &other)
983 {
984 assign(other);
985 return *this;
986 }
987
989 {
990 increment();
991 return *this;
992 }
994 {
995 Iterator i = *this;
996 increment();
997 return i;
998 }
999 bool operator==(const Iterator &other) const
1000 {
1001 return (m_index == other.m_index &&
1002 m_dict == other.m_dict);
1003 }
1004 bool operator!=(const Iterator &other) const
1005 {
1006 return (m_index != other.m_index ||
1007 m_dict != other.m_dict);
1008 }
1009
1015 {
1016 if (!m_dict)
1017 {
1019 }
1020 return m_index;
1021 }
1022
1027 IPDFNamePtr getKey() const
1028 {
1029 if (!m_dict)
1030 {
1032 }
1033 if (m_index == m_limit)
1034 {
1036 }
1037 IPDFNamePtr key = m_dict->getKeyAtIndex(m_index);
1038 if (!key)
1039 {
1041 }
1042 return key;
1043 }
1044
1049 IPDFObjectPtr getValue() const
1050 {
1051 if (!m_dict)
1052 {
1054 }
1055 if (m_index == m_limit)
1056 {
1058 }
1059 return m_dict->getValueAtIndex(m_index);
1060 }
1061
1067 {
1068 if (!m_dict)
1069 {
1071 }
1072 if (m_index == m_limit)
1073 {
1075 }
1076 return m_dict->getValueTypeAtIndex(m_index);
1077 }
1078 private:
1079 void assign(const Iterator &other)
1080 {
1081 m_dict = other.m_dict;
1082 m_index = other.m_index;
1083 m_limit = other.m_limit;
1084 }
1085 void increment()
1086 {
1087 if (m_index == m_limit)
1088 {
1090 }
1091 do
1092 {
1093 m_index++;
1094 }
1095 while (m_index < m_limit && m_dict->getKeyAtIndex(m_index) == NULL);
1096 }
1097
1098 uint32 m_index;
1099 uint32 m_limit;
1100 IPDFDictionaryPtr m_dict;
1101 };
1102
1108 virtual Iterator begin() = 0;
1109
1114 virtual Iterator end() = 0;
1115 };
1116
1117 static IPDFDictionaryPtr pdfObj2IPDFDictionary(const IPDFObjectPtr &object)
1118 {
1119 if (!object || (object->getType() != ePOTDictionary && object->getType() != ePOTStream))
1120 {
1121 return IPDFDictionaryPtr();
1122 }
1123 return IPDFDictionaryPtr(static_cast<IPDFDictionary *>((IPDFObject *) object), true);
1124 }
1125 #define obj2IPDFDictionary(obj) JawsMako::IPDFDictionaryPtr(dynamic_cast<JawsMako::IPDFDictionary *>((IRCObject *) (obj)), true)
1126
1134 {
1135 public:
1136 virtual ~IPDFStream() {}
1137
1145 static JAWSMAKO_API IPDFStreamPtr create(IEDLClassFactory *pFactory, const IInputStreamPtr &stream, uint32 size = 0);
1146
1153 virtual IRAInputStreamPtr getStream() const = 0;
1154
1159 virtual IInputStreamPtr getRawStream() const = 0;
1160 };
1161 #define pdfObj2IPDFStream(obj) JawsMako::pdfObj2Type<JawsMako::IPDFStream>(obj, JawsMako::ePOTStream)
1162 #define obj2IPDFStream(obj) JawsMako::IPDFStreamPtr(dynamic_cast<JawsMako::IPDFStream *>((IRCObject *) (obj)), true)
1163
1171 {
1172 public:
1173 virtual ~IPDFOperator() {}
1174
1175 static JAWSMAKO_API IPDFOperatorPtr create(const U8String &operatorName);
1176 static JAWSMAKO_API IPDFOperatorPtr create(uint32 operatorId);
1177
1182 virtual U8String getValue() const = 0;
1183
1188 virtual uint32 getOperatorId() const = 0;
1189 };
1190 #define pdfObj2IPDFOperator(obj) JawsMako::pdfObj2Type<JawsMako::IPDFOperator>(obj, JawsMako::ePOTOperator)
1191 #define obj2IPDFOperator(obj) JawsMako::IPDFOperatorPtr(dynamic_cast<JawsMako::IPDFOperator *>((IRCObject *) (obj)), true)
1192
1202 {
1203 public:
1204 virtual ~IPDFObjectStore() {}
1205
1210 virtual IPDFObjectStorePtr clone() const = 0;
1211
1216 virtual IPDFFarReferencePtr getRootObjectReference() const = 0;
1217
1222 virtual IPDFObjectPtr getRootObject() const = 0;
1223
1230 virtual bool hasReferencedObject(const IPDFObjectPtr &reference) const = 0;
1231
1242 virtual IPDFObjectPtr resolve(const IPDFObjectPtr &object) const = 0;
1243
1252 virtual void resolveArray(IPDFArrayPtr &array) const = 0;
1253
1262 virtual void dirtyObject(const IPDFObjectPtr &object) = 0;
1263
1267 virtual void dirtyRootObject() = 0;
1268
1273 virtual IPDFReferencePtr newReference() = 0;
1274
1282 virtual void store(const IPDFObjectPtr &object, const IPDFReferencePtr &reference, bool markDirty = true) = 0;
1283
1290 virtual IPDFReferencePtr storeUsingNewReference(const IPDFObjectPtr &object)
1291 {
1292 IPDFReferencePtr reference = newReference();
1293 store(object, reference, true);
1294 return reference;
1295 }
1296
1303 virtual IPDFFarReferencePtr getFarReferenceForReference(const IPDFReferencePtr &reference) const = 0;
1304 };
1305}
1306
1307#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:513
int32 getGeneration() const
Obtain the generation number of this reference data.
Definition pdfobjects.h:605
CPDFFarReference(DOMid docId, DOMid allocatorId, int32 objectNum, int32 generation)
Construct the reference data from remote document, allocator, object number and generator.
Definition pdfobjects.h:530
CPDFFarReference()
Definition pdfobjects.h:515
DOMid getAllocatorId() const
Obtain the id of the entity that allocated the object. If the same as the document id,...
Definition pdfobjects.h:587
int32 getObjectNum() const
Obtain the object number of this reference data.
Definition pdfobjects.h:596
bool operator!=(const CPDFFarReference &other) const
Definition pdfobjects.h:547
DOMid getDocumentId() const
Obtain the source document ID for this document.
Definition pdfobjects.h:576
bool operator<(const CPDFFarReference &other) const
Definition pdfobjects.h:552
bool operator==(const CPDFFarReference &other) const
Definition pdfobjects.h:539
A simple concrete class representing indirect reference data.
Definition pdfobjects.h:394
int32 getObjectNum() const
Obtain the object number of this reference data.
Definition pdfobjects.h:416
CPDFReference(int32 objectNum, int32 generation)
Construct the reference data from an object number and generation.
Definition pdfobjects.h:406
bool operator==(const CPDFReference &other) const
Definition pdfobjects.h:431
int32 getGeneration() const
Obtain the generation number of this reference data.
Definition pdfobjects.h:425
bool operator<(const CPDFReference &other) const
Definition pdfobjects.h:435
CPDFReference()
Definition pdfobjects.h:396
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:650
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 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:652
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 posision 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....
A simple immutable boolean PDF object type.
Definition pdfobjects.h:217
virtual bool getValue() const =0
Get the value of the boolean.
virtual ~IPDFBoolean()
Definition pdfobjects.h:219
static JAWSMAKO_API IPDFBooleanPtr create(bool boolean)
Create a boolean object.
Definition pdfobjects.h:944
uint32 getIndex() const
Get the index within the dictionary of the current iterator position.
Definition pdfobjects.h:1014
Iterator operator++(int)
Definition pdfobjects.h:993
Iterator()
Definition pdfobjects.h:975
Iterator(const IPDFDictionaryPtr &dict, bool begin)
Definition pdfobjects.h:946
IPDFObjectPtr getValue() const
Get the value within the dictionary at the current iterator position.
Definition pdfobjects.h:1049
Iterator & operator++()
Definition pdfobjects.h:988
ePDFObjectType getValueType() const
Get the type of the value within the dictionary at the current iterator position.
Definition pdfobjects.h:1066
const Iterator & operator=(const Iterator &other)
Definition pdfobjects.h:982
Iterator(const Iterator &other)
Definition pdfobjects.h:970
IPDFNamePtr getKey() const
Get the key within the dictionary at the current iterator position.
Definition pdfobjects.h:1027
bool operator!=(const Iterator &other) const
Definition pdfobjects.h:1004
bool operator==(const Iterator &other) const
Definition pdfobjects.h:999
A simple class representing a mutable dictionary of key-value pairs where the keys are PDF names and ...
Definition pdfobjects.h:808
static JAWSMAKO_API IPDFDictionaryPtr create(IEDLClassFactory *pFactory, uint32 size=0)
Create a new PDF dictionary of the given initial capacity.
virtual void undefine(const char *key)=0
Remove the object stored under the given key, if it exists.
virtual ~IPDFDictionary()
Definition pdfobjects.h:810
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 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:624
virtual ~IPDFFarReference()
Definition pdfobjects.h:626
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:191
virtual int32 getValue() const =0
Get the value of the integer.
virtual ~IPDFInteger()
Definition pdfobjects.h:193
static JAWSMAKO_API IPDFIntegerPtr create(int32 integer)
Create an integer object.
Definition pdfobjects.h:350
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:352
A simple immutable "null" pdf object.
Definition pdfobjects.h:270
virtual ~IPDFNull()
Definition pdfobjects.h:272
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:56
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:1202
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:1204
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:1290
Definition pdfobjects.h:1171
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:1173
A simple immutable floating-point PDF object type.
Definition pdfobjects.h:244
virtual double getValue() const =0
Get the value of the real.
virtual ~IPDFReal()
Definition pdfobjects.h:246
static JAWSMAKO_API IPDFRealPtr create(double real)
Create a real object.
A simple class representing an immutable PDF indirect reference.
Definition pdfobjects.h:457
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:489
int32 getGeneration() const
Obtain the geneartion number for this reference.
Definition pdfobjects.h:498
static JAWSMAKO_API IPDFReferencePtr create(int32 objectNum, int32 generation)
Create an indirect reference object from an object number and generation.
Definition pdfobjects.h:474
virtual const CPDFReference & getValue() const =0
Obtain the CPDFReference data for this reference.
virtual ~IPDFReference()
Definition pdfobjects.h:459
Definition pdfobjects.h:1134
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:1136
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:290
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:292
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
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
CEDLVector< IPDFObjectPtr > CPDFObjectVect
Definition types.h:95
CSmartPtr< T > pdfObj2Type(const IPDFObjectPtr &object, ePDFObjectType type)
Definition pdfobjects.h:176
#define CSmartPtr
Definition smartptr.h:215
#define JAWSMAKO_API
Definition types.h:29