mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 10:58:58 +00:00
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.
This commit is contained in:
parent
bd300be08d
commit
7248cab71b
@ -82,6 +82,8 @@ enum qpdf_object_type_e {
|
||||
/* Additional object types that can occur in content streams */
|
||||
ot_operator,
|
||||
ot_inlineimage,
|
||||
/* Object types internal to qpdf */
|
||||
ot_unresolved,
|
||||
/* NOTE: if adding to this list, update QPDFObject.hh */
|
||||
};
|
||||
|
||||
|
@ -61,6 +61,7 @@ class QPDFObject
|
||||
static constexpr object_type_e ot_stream = ::ot_stream;
|
||||
static constexpr object_type_e ot_operator = ::ot_operator;
|
||||
static constexpr object_type_e ot_inlineimage = ::ot_inlineimage;
|
||||
static constexpr object_type_e ot_unresolved = ::ot_unresolved;
|
||||
|
||||
virtual ~QPDFObject() = default;
|
||||
virtual std::shared_ptr<QPDFObject> shallowCopy() = 0;
|
||||
|
@ -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
|
||||
|
41
libqpdf/QPDF_Unresolved.cc
Normal file
41
libqpdf/QPDF_Unresolved.cc
Normal file
@ -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";
|
||||
}
|
21
libqpdf/qpdf/QPDF_Unresolved.hh
Normal file
21
libqpdf/qpdf/QPDF_Unresolved.hh
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user