From d58ec90310c93653ab42bcb7373a38e3f8d43362 Mon Sep 17 00:00:00 2001 From: m-holger Date: Wed, 15 Feb 2023 10:35:10 +0000 Subject: Un-inline QPDFValue::getDescription --- libqpdf/QPDFValue.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'libqpdf/QPDFValue.cc') diff --git a/libqpdf/QPDFValue.cc b/libqpdf/QPDFValue.cc index ca3205b7..19679df2 100644 --- a/libqpdf/QPDFValue.cc +++ b/libqpdf/QPDFValue.cc @@ -9,3 +9,20 @@ QPDFValue::do_create(QPDFValue* object) obj->value = std::shared_ptr(object); return obj; } + +std::string +QPDFValue::getDescription() +{ + auto description = object_description ? *object_description : ""; + if (auto pos = description.find("$OG"); pos != std::string::npos) { + description.replace(pos, 3, og.unparse(' ')); + } + if (auto pos = description.find("$PO"); pos != std::string::npos) { + qpdf_offset_t shift = (type_code == ::ot_dictionary) ? 2 + : (type_code == ::ot_array) ? 1 + : 0; + + description.replace(pos, 3, std::to_string(parsed_offset + shift)); + } + return description; +} -- cgit v1.2.3-70-g09d2