Commit 7248cab71b69efe1e5efa3f1400d4d3970271a77
1 parent
bd300be0
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.
Showing
5 changed files
with
66 additions
and
0 deletions
include/qpdf/Constants.h
| ... | ... | @@ -82,6 +82,8 @@ enum qpdf_object_type_e { |
| 82 | 82 | /* Additional object types that can occur in content streams */ |
| 83 | 83 | ot_operator, |
| 84 | 84 | ot_inlineimage, |
| 85 | + /* Object types internal to qpdf */ | |
| 86 | + ot_unresolved, | |
| 85 | 87 | /* NOTE: if adding to this list, update QPDFObject.hh */ |
| 86 | 88 | }; |
| 87 | 89 | ... | ... |
include/qpdf/QPDFObject.hh
| ... | ... | @@ -61,6 +61,7 @@ class QPDFObject |
| 61 | 61 | static constexpr object_type_e ot_stream = ::ot_stream; |
| 62 | 62 | static constexpr object_type_e ot_operator = ::ot_operator; |
| 63 | 63 | static constexpr object_type_e ot_inlineimage = ::ot_inlineimage; |
| 64 | + static constexpr object_type_e ot_unresolved = ::ot_unresolved; | |
| 64 | 65 | |
| 65 | 66 | virtual ~QPDFObject() = default; |
| 66 | 67 | virtual std::shared_ptr<QPDFObject> shallowCopy() = 0; | ... | ... |
libqpdf/CMakeLists.txt
libqpdf/QPDF_Unresolved.cc
0 → 100644
| 1 | +#include <qpdf/QPDF_Unresolved.hh> | |
| 2 | + | |
| 3 | +#include <stdexcept> | |
| 4 | + | |
| 5 | +std::shared_ptr<QPDFObject> | |
| 6 | +QPDF_Unresolved::create() | |
| 7 | +{ | |
| 8 | + return do_create(new QPDF_Unresolved()); | |
| 9 | +} | |
| 10 | + | |
| 11 | +std::shared_ptr<QPDFObject> | |
| 12 | +QPDF_Unresolved::shallowCopy() | |
| 13 | +{ | |
| 14 | + return create(); | |
| 15 | +} | |
| 16 | + | |
| 17 | +std::string | |
| 18 | +QPDF_Unresolved::unparse() | |
| 19 | +{ | |
| 20 | + throw std::logic_error( | |
| 21 | + "attempted to unparse an unresolveded QPDFObjectHandle"); | |
| 22 | + return ""; | |
| 23 | +} | |
| 24 | + | |
| 25 | +JSON | |
| 26 | +QPDF_Unresolved::getJSON(int json_version) | |
| 27 | +{ | |
| 28 | + return JSON::makeNull(); | |
| 29 | +} | |
| 30 | + | |
| 31 | +QPDFObject::object_type_e | |
| 32 | +QPDF_Unresolved::getTypeCode() const | |
| 33 | +{ | |
| 34 | + return QPDFObject::ot_unresolved; | |
| 35 | +} | |
| 36 | + | |
| 37 | +char const* | |
| 38 | +QPDF_Unresolved::getTypeName() const | |
| 39 | +{ | |
| 40 | + return "unresolved"; | |
| 41 | +} | ... | ... |
libqpdf/qpdf/QPDF_Unresolved.hh
0 → 100644
| 1 | +#ifndef QPDF_UNRESOLVED_HH | |
| 2 | +#define QPDF_UNRESOLVED_HH | |
| 3 | + | |
| 4 | +#include <qpdf/QPDFObject.hh> | |
| 5 | + | |
| 6 | +class QPDF_Unresolved: public QPDFObject | |
| 7 | +{ | |
| 8 | + public: | |
| 9 | + virtual ~QPDF_Unresolved() = default; | |
| 10 | + static std::shared_ptr<QPDFObject> create(); | |
| 11 | + virtual std::shared_ptr<QPDFObject> shallowCopy(); | |
| 12 | + virtual std::string unparse(); | |
| 13 | + virtual JSON getJSON(int json_version); | |
| 14 | + virtual QPDFObject::object_type_e getTypeCode() const; | |
| 15 | + virtual char const* getTypeName() const; | |
| 16 | + | |
| 17 | + private: | |
| 18 | + QPDF_Unresolved() = default; | |
| 19 | +}; | |
| 20 | + | |
| 21 | +#endif // QPDF_UNRESOLVED_HH | ... | ... |