mirror of
https://github.com/qpdf/qpdf.git
synced 2025-01-05 08:02:11 +00:00
Un-inline QPDFValue::getDescription
This commit is contained in:
parent
76189c44a2
commit
d58ec90310
@ -9,3 +9,20 @@ QPDFValue::do_create(QPDFValue* object)
|
|||||||
obj->value = std::shared_ptr<QPDFValue>(object);
|
obj->value = std::shared_ptr<QPDFValue>(object);
|
||||||
return obj;
|
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;
|
||||||
|
}
|
||||||
|
@ -44,22 +44,7 @@ class QPDFValue
|
|||||||
qpdf = a_qpdf;
|
qpdf = a_qpdf;
|
||||||
og = a_og;
|
og = a_og;
|
||||||
}
|
}
|
||||||
std::string
|
std::string getDescription();
|
||||||
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;
|
|
||||||
}
|
|
||||||
bool
|
bool
|
||||||
hasDescription()
|
hasDescription()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user