aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDFExc.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/QPDFExc.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/QPDFExc.cc')
-rw-r--r--libqpdf/QPDFExc.cc44
1 files changed, 19 insertions, 25 deletions
diff --git a/libqpdf/QPDFExc.cc b/libqpdf/QPDFExc.cc
index df8ceaff..6c270c82 100644
--- a/libqpdf/QPDFExc.cc
+++ b/libqpdf/QPDFExc.cc
@@ -2,11 +2,12 @@
#include <qpdf/QUtil.hh>
-QPDFExc::QPDFExc(qpdf_error_code_e error_code,
- std::string const& filename,
- std::string const& object,
- qpdf_offset_t offset,
- std::string const& message) :
+QPDFExc::QPDFExc(
+ qpdf_error_code_e error_code,
+ std::string const& filename,
+ std::string const& object,
+ qpdf_offset_t offset,
+ std::string const& message) :
std::runtime_error(createWhat(filename, object, offset, message)),
error_code(error_code),
filename(filename),
@@ -17,41 +18,34 @@ QPDFExc::QPDFExc(qpdf_error_code_e error_code,
}
std::string
-QPDFExc::createWhat(std::string const& filename,
- std::string const& object,
- qpdf_offset_t offset,
- std::string const& message)
+QPDFExc::createWhat(
+ std::string const& filename,
+ std::string const& object,
+ qpdf_offset_t offset,
+ std::string const& message)
{
std::string result;
- if (! filename.empty())
- {
+ if (!filename.empty()) {
result += filename;
}
- if (! (object.empty() && offset == 0))
- {
- if (! filename.empty())
- {
+ if (!(object.empty() && offset == 0)) {
+ if (!filename.empty()) {
result += " (";
}
- if (! object.empty())
- {
+ if (!object.empty()) {
result += object;
- if (offset > 0)
- {
+ if (offset > 0) {
result += ", ";
}
}
- if (offset > 0)
- {
+ if (offset > 0) {
result += "offset " + QUtil::int_to_string(offset);
}
- if (! filename.empty())
- {
+ if (!filename.empty()) {
result += ")";
}
}
- if (! result.empty())
- {
+ if (!result.empty()) {
result += ": ";
}
result += message;