diff options
Diffstat (limited to 'libqpdf/QPDFExc.cc')
-rw-r--r-- | libqpdf/QPDFExc.cc | 44 |
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; |