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/qpdf/QPDFValue.hh | |
parent | da14ab4dc7b1caee1708483cf714683f7d811ca7 (diff) | |
download | qpdf-1496472e1c2f64f46d2d7d76481aef1aa3fff869.tar.zst |
Add method QPDFValue::setChildDescription
Diffstat (limited to 'libqpdf/qpdf/QPDFValue.hh')
-rw-r--r-- | libqpdf/qpdf/QPDFValue.hh | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/libqpdf/qpdf/QPDFValue.hh b/libqpdf/qpdf/QPDFValue.hh index 9a1a6df1..e8a1834f 100644 --- a/libqpdf/qpdf/QPDFValue.hh +++ b/libqpdf/qpdf/QPDFValue.hh @@ -8,13 +8,14 @@ #include <qpdf/Types.h> #include <string> +#include <string_view> #include <variant> class QPDF; class QPDFObjectHandle; class QPDFObject; -class QPDFValue +class QPDFValue: public std::enable_shared_from_this<QPDFValue> { friend class QPDFObject; @@ -38,7 +39,24 @@ class QPDFValue std::string object; }; - using Description = std::variant<std::string, JSON_Descr>; + struct ChildDescr + { + ChildDescr( + std::shared_ptr<QPDFValue> parent, + std::string_view const& static_descr, + std::string var_descr) : + parent(parent), + static_descr(static_descr), + var_descr(var_descr) + { + } + + std::weak_ptr<QPDFValue> parent; + std::string_view const& static_descr; + std::string var_descr; + }; + + using Description = std::variant<std::string, JSON_Descr, ChildDescr>; virtual void setDescription( @@ -56,6 +74,17 @@ class QPDFValue qpdf = a_qpdf; og = a_og; } + void + setChildDescription( + QPDF* a_qpdf, + std::shared_ptr<QPDFValue> parent, + std::string_view const& static_descr, + std::string var_descr) + { + object_description = std::make_shared<Description>( + ChildDescr(parent, static_descr, var_descr)); + qpdf = a_qpdf; + } std::string getDescription(); bool hasDescription() |