aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2018-12-31 23:12:38 +0100
committerJay Berkenbilt <ejb@ql.org>2019-01-01 14:12:56 +0100
commit95d6b17a8904b110c3625e66538368c433f48042 (patch)
treed5d845a2319885d26ed8baaf094adc98f38af765 /include
parent104fd6da522c8828571580cb30f324c3cbe7283f (diff)
downloadqpdf-95d6b17a8904b110c3625e66538368c433f48042.tar.zst
Add QPDFObjectHandle::mergeDictionary()
Diffstat (limited to 'include')
-rw-r--r--include/qpdf/QPDFObjectHandle.hh26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh
index a4b469c2..030ee11c 100644
--- a/include/qpdf/QPDFObjectHandle.hh
+++ b/include/qpdf/QPDFObjectHandle.hh
@@ -559,6 +559,28 @@ class QPDFObjectHandle
QPDF_DLL
bool isOrHasName(std::string const&);
+ // Merge dictionaries with the following behavior, where "object"
+ // refers to the object whose method is invoked, and "other"
+ // refers to the argument:
+ // * If either object or other is not a dictionary, do nothing
+ // * Otherwise
+ // * For each key in other
+ // * If key is absent in object, insert it
+ // * If key is present in object
+ // * If both values are dictionaries, merge the dictionary from
+ // other into the one from object
+ // * If both values are arrays, append scalar elements from
+ // other's that are not present in object's onto object's,
+ // and ignore non-scalar elements in other's
+ // * Otherwise ignore
+ // The primary purpose of this method is to facilitate merging of
+ // resource dictionaries. Conflicts are ignored. If needed, a
+ // future version of qpdf may provide some mechanism for conflict
+ // resolution, such as providing a handler that is invoked with
+ // the path to the conflict.
+ QPDF_DLL
+ void mergeDictionary(QPDFObjectHandle other);
+
// Return the QPDF object that owns an indirect object. Returns
// null for a direct object.
QPDF_DLL
@@ -970,6 +992,10 @@ class QPDFObjectHandle
ParserCallbacks* callbacks);
std::vector<QPDFObjectHandle> arrayOrStreamToStreamArray(
std::string const& description, std::string& all_description);
+ void mergeDictionaryInternal(
+ QPDFObjectHandle other,
+ std::set<QPDFObjGen>& visiting,
+ int depth);
static void warn(QPDF*, QPDFExc const&);
class Members