PoDoFo  1.0.0-dev
PdfElement.h
1 
7 #ifndef PDF_ELEMENT_H
8 #define PDF_ELEMENT_H
9 
10 #include "PdfObject.h"
11 
12 namespace PoDoFo {
13 
29 class PODOFO_API PdfElement
30 {
31 public:
32 
33  virtual ~PdfElement();
34 
38  inline PdfObject& GetObject() { return *m_Object; }
39 
45  inline const PdfObject& GetObject() const { return *m_Object; }
46 
47  PdfDocument& GetDocument() const;
48 
49 protected:
50  PdfElement(PdfObject& obj);
51 
62  PdfElement(PdfObject& obj, PdfDataType expectedDataType);
63 
64  PdfElement(const PdfElement& element) = default;
65 
66 private:
67  PdfElement& operator=(const PdfElement& element) = delete;
68 
69 private:
70  PdfObject* m_Object;
71 };
72 
73 class PODOFO_API PdfDictionaryElement : public PdfElement
74 {
75 protected:
81  PdfDictionaryElement(PdfDocument& parent,
82  const PdfName& type = PdfName::Null,
83  const PdfName& subtype = PdfName::Null);
84 
91  PdfDictionaryElement(PdfObject& obj);
92 
93  PdfDictionaryElement(const PdfDictionaryElement& element) = default;
94 
95 public:
96  PdfDictionary& GetDictionary();
97  const PdfDictionary& GetDictionary() const;
98 };
99 
100 class PODOFO_API PdfArrayElement : public PdfElement
101 {
102 protected:
106  PdfArrayElement(PdfDocument& parent);
107 
114  PdfArrayElement(PdfObject& obj);
115 
116  PdfArrayElement(const PdfArrayElement& element) = default;
117 
118 public:
119  PdfArray& GetArray();
120  const PdfArray& GetArray() const;
121 };
122 
123 };
124 
125 #endif // PDF_ELEMENT_H
PdfDocument is the core interface for working with PDF documents.
Definition: PdfDocument.h:108
PdfElement is a common base class for all elements in a PDF file.
Definition: PdfElement.h:30
PdfObject & GetObject()
Get access to the internal object.
Definition: PdfElement.h:38
const PdfObject & GetObject() const
Get access to the internal object This is an overloaded member function.
Definition: PdfElement.h:45
static const PdfName Null
Null name, corresponds to "/".
Definition: PdfName.h:30
This class represents a PDF indirect Object in memory.
Definition: PdfObject.h:35
SPDX-FileCopyrightText: (C) 2022 Francesco Pretto ceztko@gmail.com SPDX-License-Identifier: LGPL-2....
Definition: basetypes.h:16
PdfDataType
Every PDF datatype that can occur in a PDF file is referenced by an own enum (e.g.
Definition: PdfDeclarations.h:155