aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf
diff options
context:
space:
mode:
authorm-holger <m-holger@kubitscheck.org>2022-08-02 14:12:17 +0200
committerm-holger <m-holger@kubitscheck.org>2022-08-31 23:46:09 +0200
commit7248cab71b69efe1e5efa3f1400d4d3970271a77 (patch)
treee5099c59aef6a19a91425310d73aa4472b31c0bd /libqpdf
parentbd300be08d94add92657aef1d46afd100459302b (diff)
downloadqpdf-7248cab71b69efe1e5efa3f1400d4d3970271a77.tar.zst
Add class QPDF_Unresolved
Allow QPDFObjectHandle::obj to be set prior resolving object. ot_unresolved has been appended to the list object types in order to preserve the output of existing test cases.
Diffstat (limited to 'libqpdf')
-rw-r--r--libqpdf/CMakeLists.txt1
-rw-r--r--libqpdf/QPDF_Unresolved.cc41
-rw-r--r--libqpdf/qpdf/QPDF_Unresolved.hh21
3 files changed, 63 insertions, 0 deletions
diff --git a/libqpdf/CMakeLists.txt b/libqpdf/CMakeLists.txt
index 51f7476d..7a4ef333 100644
--- a/libqpdf/CMakeLists.txt
+++ b/libqpdf/CMakeLists.txt
@@ -99,6 +99,7 @@ set(libqpdf_SOURCES
QPDF_Reserved.cc
QPDF_Stream.cc
QPDF_String.cc
+ QPDF_Unresolved.cc
QPDF_encryption.cc
QPDF_json.cc
QPDF_linearization.cc
diff --git a/libqpdf/QPDF_Unresolved.cc b/libqpdf/QPDF_Unresolved.cc
new file mode 100644
index 00000000..f348ec36
--- /dev/null
+++ b/libqpdf/QPDF_Unresolved.cc
@@ -0,0 +1,41 @@
+#include <qpdf/QPDF_Unresolved.hh>
+
+#include <stdexcept>
+
+std::shared_ptr<QPDFObject>
+QPDF_Unresolved::create()
+{
+ return do_create(new QPDF_Unresolved());
+}
+
+std::shared_ptr<QPDFObject>
+QPDF_Unresolved::shallowCopy()
+{
+ return create();
+}
+
+std::string
+QPDF_Unresolved::unparse()
+{
+ throw std::logic_error(
+ "attempted to unparse an unresolveded QPDFObjectHandle");
+ return "";
+}
+
+JSON
+QPDF_Unresolved::getJSON(int json_version)
+{
+ return JSON::makeNull();
+}
+
+QPDFObject::object_type_e
+QPDF_Unresolved::getTypeCode() const
+{
+ return QPDFObject::ot_unresolved;
+}
+
+char const*
+QPDF_Unresolved::getTypeName() const
+{
+ return "unresolved";
+}
diff --git a/libqpdf/qpdf/QPDF_Unresolved.hh b/libqpdf/qpdf/QPDF_Unresolved.hh
new file mode 100644
index 00000000..4f1c5238
--- /dev/null
+++ b/libqpdf/qpdf/QPDF_Unresolved.hh
@@ -0,0 +1,21 @@
+#ifndef QPDF_UNRESOLVED_HH
+#define QPDF_UNRESOLVED_HH
+
+#include <qpdf/QPDFObject.hh>
+
+class QPDF_Unresolved: public QPDFObject
+{
+ public:
+ virtual ~QPDF_Unresolved() = default;
+ static std::shared_ptr<QPDFObject> create();
+ virtual std::shared_ptr<QPDFObject> shallowCopy();
+ virtual std::string unparse();
+ virtual JSON getJSON(int json_version);
+ virtual QPDFObject::object_type_e getTypeCode() const;
+ virtual char const* getTypeName() const;
+
+ private:
+ QPDF_Unresolved() = default;
+};
+
+#endif // QPDF_UNRESOLVED_HH