PoDoFo  1.0.0-dev
PdfDataContainer.h
1 
7 #ifndef PDF_CONTAINER_DATATYPE_H
8 #define PDF_CONTAINER_DATATYPE_H
9 
10 #include "PdfBaseDataTypes.h"
11 #include "PdfObject.h"
12 
13 namespace PoDoFo {
14 
15 class PdfDocument;
16 
21 class PODOFO_API PdfDataContainer : public PdfDataProvider<PdfDataContainer>
22 {
23  friend class PdfObject;
24  friend class PdfArray;
25  friend class PdfDictionary;
26 
27 private:
34 
35 public:
36  virtual ~PdfDataContainer();
37 
42  inline const PdfObject* GetOwner() const { return m_Owner; }
43  inline PdfObject* GetOwner() { return m_Owner; }
44 
51  virtual void Write(OutputStream& stream, PdfWriteFlags writeMode,
52  const PdfStatefulEncrypt* encrypt, charbuff& buffer) const = 0;
53 
54 protected:
55  virtual void resetDirty() = 0;
56  PdfObject* GetIndirectObject(const PdfReference& reference) const;
57  PdfDocument* GetObjectDocument();
58  void SetDirty();
59  bool IsIndirectReferenceAllowed(const PdfObject& obj);
60  virtual void setChildrenParent() = 0;
61  void AssertMutable() const;
62 
63 private:
64  void SetOwner(PdfObject& owner);
65  void ResetDirty();
66 
67 private:
68  PdfObject* m_Owner;
69 };
70 
71 class PODOFO_API PdfIndirectIterableBase
72 {
73  template <typename TObject, typename TListIterator>
74  friend class PdfArrayIndirectIterableBase;
75 
76  template <typename TObject, typename TMapIterator>
78 
79 private:
80  PdfIndirectIterableBase();
81 
82  PdfIndirectIterableBase(PdfDataContainer& container);
83 
84 protected:
85  static PdfObject* GetObject(const PdfIndirectObjectList& list, const PdfReference& ref);
86 
87  PdfIndirectObjectList* GetObjects() const { return m_Objects; }
88 
89 private:
90  PdfIndirectObjectList* m_Objects;
91 };
92 
93 }
94 
95 #endif // PDF_CONTAINER_DATATYPE_H
An interface for writing blocks of data to a data source.
Definition: OutputStream.h:18
Helper class to iterate through array indirect objects.
Definition: PdfArray.h:23
This class represents a PdfArray Use it for all arrays that are written to a PDF file.
Definition: PdfArray.h:81
A PdfDataProvider object with a PdfObject owner, specialized in holding objects.
Definition: PdfDataContainer.h:22
virtual void Write(OutputStream &stream, PdfWriteFlags writeMode, const PdfStatefulEncrypt *encrypt, charbuff &buffer) const =0
Write the complete datatype to a file.
const PdfObject * GetOwner() const
Definition: PdfDataContainer.h:42
An helper class to inherit to provide common serialization methods.
Definition: PdfBaseDataTypes.h:40
Helper class to iterate through indirect objects.
Definition: PdfDictionary.h:22
The PDF dictionary data type of PoDoFo (inherits from PdfDataContainer, the base class for such repre...
Definition: PdfDictionary.h:82
PdfDocument is the core interface for working with PDF documents.
Definition: PdfDocument.h:108
A list of PdfObjects that constitutes the indirect object list of the document The PdfParser will rea...
Definition: PdfIndirectObjectList.h:30
This class represents a PDF indirect Object in memory.
Definition: PdfObject.h:35
A reference is a pointer to a object in the PDF file of the form "4 0 R", where 4 is the object numbe...
Definition: PdfReference.h:24
Convenient type for char array storage and/or buffer with std::string compatibility.
Definition: basetypes.h:38
SPDX-FileCopyrightText: (C) 2022 Francesco Pretto ceztko@gmail.com SPDX-License-Identifier: LGPL-2....
Definition: basetypes.h:16
PdfWriteFlags
Specify additional options for writing the PDF.
Definition: PdfDeclarations.h:137