aboutsummaryrefslogtreecommitdiffstats
path: root/examples/pdf-mod-info.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2021-01-29 20:17:25 +0100
committerJay Berkenbilt <ejb@ql.org>2021-01-30 21:15:24 +0100
commitce19ec5c4b0ae88592289bf3c5b32b71b9c22eaa (patch)
treeaf83beb3ded1212c44796243f1bf9bef04469bc6 /examples/pdf-mod-info.cc
parentde0b11fc4793213dc6156d34412580a6e4df0c48 (diff)
downloadqpdf-ce19ec5c4b0ae88592289bf3c5b32b71b9c22eaa.tar.zst
Update examples to use QPDFObjectHandle iterators
Diffstat (limited to 'examples/pdf-mod-info.cc')
-rw-r--r--examples/pdf-mod-info.cc17
1 files changed, 7 insertions, 10 deletions
diff --git a/examples/pdf-mod-info.cc b/examples/pdf-mod-info.cc
index 9ffd4ede..2f152799 100644
--- a/examples/pdf-mod-info.cc
+++ b/examples/pdf-mod-info.cc
@@ -40,25 +40,22 @@ void dumpInfoDict(QPDF& pdf,
if (trailer.hasKey("/Info"))
{
QPDFObjectHandle info = trailer.getKey("/Info");
- std::set<std::string> keys = info.getKeys();
- for (std::set<std::string>::const_iterator it = keys.begin();
- keys.end() != it; ++it)
+ for (auto& it: QPDFDictItems(info))
{
- QPDFObjectHandle elt = info.getKey(*it);
std::string val;
- if (elt.isString())
+ if (it.second.isString())
{
- val = elt.getStringValue();
+ val = it.second.getStringValue();
}
- else if (elt.isName())
+ else if (it.second.isName())
{
- val = elt.getName();
+ val = it.second.getName();
}
else // according to PDF Spec 1.5, shouldn't happen
{
- val = elt.unparseResolved();
+ val = it.second.unparseResolved();
}
- os << it->substr(1) << sep << val << std::endl; // skip '/'
+ os << it.first.substr(1) << sep << val << std::endl; // skip '/'
}
}
}