diff options
author | m-holger <m-holger@kubitscheck.org> | 2023-02-17 14:58:21 +0100 |
---|---|---|
committer | m-holger <m-holger@kubitscheck.org> | 2023-02-18 09:35:45 +0100 |
commit | 1496472e1c2f64f46d2d7d76481aef1aa3fff869 (patch) | |
tree | 40ed2ee4ac78c8240c36396f3fb1824d7703f952 /libqpdf/QPDFValue.cc | |
parent | da14ab4dc7b1caee1708483cf714683f7d811ca7 (diff) | |
download | qpdf-1496472e1c2f64f46d2d7d76481aef1aa3fff869.tar.zst |
Add method QPDFValue::setChildDescription
Diffstat (limited to 'libqpdf/QPDFValue.cc')
-rw-r--r-- | libqpdf/QPDFValue.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libqpdf/QPDFValue.cc b/libqpdf/QPDFValue.cc index a89afd55..30d534dc 100644 --- a/libqpdf/QPDFValue.cc +++ b/libqpdf/QPDFValue.cc @@ -17,6 +17,7 @@ QPDFValue::getDescription() switch (object_description->index()) { case 0: { + // Simple template string auto description = std::get<0>(*object_description); if (auto pos = description.find("$OG"); @@ -36,12 +37,27 @@ QPDFValue::getDescription() } case 1: { + // QPDF::JSONReactor generated description auto j_descr = std::get<1>(*object_description); return ( *j_descr.input + (j_descr.object.empty() ? "" : ", " + j_descr.object) + " at offset " + std::to_string(parsed_offset)); } + case 2: + { + // Child object description + auto j_descr = std::get<2>(*object_description); + std::string result; + if (auto p = j_descr.parent.lock()) { + result = p->getDescription(); + } + result += j_descr.static_descr; + if (auto pos = result.find("$VD"); pos != std::string::npos) { + result.replace(pos, 3, j_descr.var_descr); + } + return result; + } } } else if (og.isIndirect()) { return "object " + og.unparse(' '); |