From c7005e8a6d626d1c66bd780314c2520d12b0ca9a Mon Sep 17 00:00:00 2001 From: m-holger Date: Tue, 2 Aug 2022 22:57:33 +0100 Subject: Remove virtual methods QPDFValue::getTypeCode and getTypeName --- include/qpdf/QPDFObject.hh | 5 ++--- include/qpdf/QPDFValue.hh | 16 +++++++++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/qpdf/QPDFObject.hh b/include/qpdf/QPDFObject.hh index db6efa4c..a1930168 100644 --- a/include/qpdf/QPDFObject.hh +++ b/include/qpdf/QPDFObject.hh @@ -87,7 +87,7 @@ class QPDFObject object_type_e getTypeCode() const { - return value->getTypeCode(); + return value->type_code; } // Return a string literal that describes the type, useful for @@ -95,9 +95,8 @@ class QPDFObject char const* getTypeName() const { - return value->getTypeName(); + return value->type_name; } - void setDescription(QPDF* qpdf, std::string const& description) { diff --git a/include/qpdf/QPDFValue.hh b/include/qpdf/QPDFValue.hh index b957b813..33558f1b 100644 --- a/include/qpdf/QPDFValue.hh +++ b/include/qpdf/QPDFValue.hh @@ -43,8 +43,6 @@ class QPDFValue virtual std::shared_ptr shallowCopy() = 0; virtual std::string unparse() = 0; virtual JSON getJSON(int json_version) = 0; - virtual qpdf_object_type_e getTypeCode() const = 0; - virtual char const* getTypeName() const = 0; virtual void setDescription(QPDF* qpdf, std::string const& description) { @@ -75,7 +73,17 @@ class QPDFValue } protected: - QPDFValue() = default; + QPDFValue() : + type_code(::ot_uninitialized), + type_name("uninitilized") + { + } + QPDFValue(qpdf_object_type_e type_code, char const* type_name) : + type_code(type_code), + type_name(type_name) + { + } + virtual void releaseResolved() { @@ -88,6 +96,8 @@ class QPDFValue QPDF* owning_qpdf{nullptr}; std::string object_description; qpdf_offset_t parsed_offset{-1}; + const qpdf_object_type_e type_code; + char const* type_name; }; #endif // QPDFVALUE_HH -- cgit v1.2.3-54-g00ecf