summaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDFOutlineObjectHelper.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-04-02 23:14:10 +0200
committerJay Berkenbilt <ejb@ql.org>2022-04-04 14:10:40 +0200
commit12f1eb15ca3fed6310402847559a7c99d3c77847 (patch)
tree8935675b623c6f3b4914b8b44f7fa5f2816a9241 /libqpdf/QPDFOutlineObjectHelper.cc
parentf20fa61eb4c323eb1642c69c236b3d9a1f8b2cdb (diff)
downloadqpdf-12f1eb15ca3fed6310402847559a7c99d3c77847.tar.zst
Programmatically apply new formatting to code
Run this: for i in **/*.cc **/*.c **/*.h **/*.hh; do clang-format < $i >| $i.new && mv $i.new $i done
Diffstat (limited to 'libqpdf/QPDFOutlineObjectHelper.cc')
-rw-r--r--libqpdf/QPDFOutlineObjectHelper.cc36
1 files changed, 12 insertions, 24 deletions
diff --git a/libqpdf/QPDFOutlineObjectHelper.cc b/libqpdf/QPDFOutlineObjectHelper.cc
index cf6d3fcf..713c1412 100644
--- a/libqpdf/QPDFOutlineObjectHelper.cc
+++ b/libqpdf/QPDFOutlineObjectHelper.cc
@@ -17,22 +17,19 @@ QPDFOutlineObjectHelper::QPDFOutlineObjectHelper(
QPDFObjectHelper(oh),
m(new Members(dh))
{
- if (depth > 50)
- {
+ if (depth > 50) {
// Not exercised in test suite, but was tested manually by
// temporarily changing max depth to 1.
return;
}
if (QPDFOutlineDocumentHelper::Accessor::checkSeen(
- this->m->dh, this->oh.getObjGen()))
- {
+ this->m->dh, this->oh.getObjGen())) {
QTC::TC("qpdf", "QPDFOutlineObjectHelper loop");
return;
}
QPDFObjectHandle cur = oh.getKey("/First");
- while (! cur.isNull())
- {
+ while (!cur.isNull()) {
QPDFOutlineObjectHelper new_ooh(cur, dh, 1 + depth);
new_ooh.m->parent = make_pointer_holder<QPDFOutlineObjectHelper>(*this);
this->m->kids.push_back(new_ooh);
@@ -57,26 +54,20 @@ QPDFOutlineObjectHelper::getDest()
{
QPDFObjectHandle dest;
QPDFObjectHandle A;
- if (this->oh.hasKey("/Dest"))
- {
+ if (this->oh.hasKey("/Dest")) {
QTC::TC("qpdf", "QPDFOutlineObjectHelper direct dest");
dest = this->oh.getKey("/Dest");
- }
- else if ((A = this->oh.getKey("/A")).isDictionary() &&
- A.getKey("/S").isName() &&
- (A.getKey("/S").getName() == "/GoTo") &&
- A.hasKey("/D"))
- {
+ } else if (
+ (A = this->oh.getKey("/A")).isDictionary() && A.getKey("/S").isName() &&
+ (A.getKey("/S").getName() == "/GoTo") && A.hasKey("/D")) {
QTC::TC("qpdf", "QPDFOutlineObjectHelper action dest");
dest = A.getKey("/D");
}
- if (! dest.isInitialized())
- {
+ if (!dest.isInitialized()) {
dest = QPDFObjectHandle::newNull();
}
- if (dest.isName() || dest.isString())
- {
+ if (dest.isName() || dest.isString()) {
QTC::TC("qpdf", "QPDFOutlineObjectHelper named dest");
dest = this->m->dh.resolveNamedDest(dest);
}
@@ -88,8 +79,7 @@ QPDFObjectHandle
QPDFOutlineObjectHelper::getDestPage()
{
QPDFObjectHandle dest = getDest();
- if ((dest.isArray()) && (dest.getArrayNItems() > 0))
- {
+ if ((dest.isArray()) && (dest.getArrayNItems() > 0)) {
return dest.getArrayItem(0);
}
return QPDFObjectHandle::newNull();
@@ -99,8 +89,7 @@ int
QPDFOutlineObjectHelper::getCount()
{
int count = 0;
- if (this->oh.hasKey("/Count"))
- {
+ if (this->oh.hasKey("/Count")) {
count = this->oh.getKey("/Count").getIntValueAsInt();
}
return count;
@@ -110,8 +99,7 @@ std::string
QPDFOutlineObjectHelper::getTitle()
{
std::string result;
- if (this->oh.hasKey("/Title"))
- {
+ if (this->oh.hasKey("/Title")) {
result = this->oh.getKey("/Title").getUTF8Value();
}
return result;