mirror of
https://github.com/qpdf/qpdf.git
synced 2025-01-03 07:12:28 +00:00
C-API expose QPDFObjectHandle::getKeyIfDict
This commit is contained in:
parent
8371060340
commit
5901fcad4c
@ -812,6 +812,8 @@ extern "C" {
|
||||
QPDF_BOOL qpdf_oh_has_key(qpdf_data qpdf, qpdf_oh oh, char const* key);
|
||||
QPDF_DLL
|
||||
qpdf_oh qpdf_oh_get_key(qpdf_data qpdf, qpdf_oh oh, char const* key);
|
||||
QPDF_DLL
|
||||
qpdf_oh qpdf_oh_get_key_if_dict(qpdf_data qpdf, qpdf_oh oh, char const* key);
|
||||
|
||||
QPDF_DLL
|
||||
QPDF_BOOL qpdf_oh_is_or_has_name(
|
||||
|
@ -1550,6 +1550,15 @@ qpdf_oh qpdf_oh_get_key(qpdf_data qpdf, qpdf_oh oh, char const* key)
|
||||
});
|
||||
}
|
||||
|
||||
qpdf_oh qpdf_oh_get_key_if_dict(qpdf_data qpdf, qpdf_oh oh, char const* key)
|
||||
{
|
||||
return do_with_oh<qpdf_oh>(
|
||||
qpdf, oh, return_null(qpdf), [qpdf, key](QPDFObjectHandle& o) {
|
||||
QTC::TC("qpdf", "qpdf-c called qpdf_oh_get_key_if_dict");
|
||||
return new_object(qpdf, o.getKeyIfDict(key));
|
||||
});
|
||||
}
|
||||
|
||||
QPDF_BOOL qpdf_oh_is_or_has_name(qpdf_data qpdf, qpdf_oh oh, char const* key)
|
||||
{
|
||||
return do_with_oh<QPDF_BOOL>(
|
||||
|
@ -592,6 +592,17 @@ static void test24(char const* infile,
|
||||
"/Encoding");
|
||||
assert(strcmp(qpdf_oh_get_name(qpdf, encoding), "/WinAnsiEncoding") == 0);
|
||||
|
||||
qpdf_oh res = qpdf_oh_get_key_if_dict(qpdf, page1, "/Resources");
|
||||
assert(qpdf_oh_has_key(qpdf, res, "/Font"));
|
||||
/* check no warning when called with null */
|
||||
while (qpdf_more_warnings(qpdf))
|
||||
{
|
||||
qpdf_next_warning(qpdf);
|
||||
}
|
||||
res = qpdf_oh_get_key_if_dict(
|
||||
qpdf, qpdf_oh_get_key_if_dict(qpdf, page1, "/Missing"), "/Font");
|
||||
assert(! qpdf_more_warnings(qpdf));
|
||||
|
||||
/* Look at page contents to exercise stream functions */
|
||||
qpdf_oh contents = qpdf_oh_get_key(qpdf, page1, "/Contents");
|
||||
assert(qpdf_oh_is_stream(qpdf, contents));
|
||||
|
@ -504,6 +504,7 @@ qpdf-c called qpdf_oh_dict_more_keys 0
|
||||
qpdf-c called qpdf_oh_dict_next_key 0
|
||||
qpdf-c called qpdf_oh_has_key 0
|
||||
qpdf-c called qpdf_oh_get_key 0
|
||||
qpdf-c called qpdf_oh_get_key_if_dict 0
|
||||
qpdf-c called qpdf_oh_is_or_has_name 0
|
||||
qpdf-c called qpdf_oh_new_null 0
|
||||
qpdf-c called qpdf_oh_new_bool 0
|
||||
|
Loading…
Reference in New Issue
Block a user