diff options
author | Jay Berkenbilt <ejb@ql.org> | 2023-05-21 19:35:09 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2023-05-21 19:35:09 +0200 |
commit | 60965d5f4d608bdccc2ffd4e8753e12cbbbd71d2 (patch) | |
tree | a707602da466c02ff1a54b3263c3a881cd7204a4 /examples/pdf-filter-tokens.cc | |
parent | 6b077332d38c093de2618d5e1481b42222106065 (diff) | |
download | qpdf-60965d5f4d608bdccc2ffd4e8753e12cbbbd71d2.tar.zst |
Rerun clang-format
Diffstat (limited to 'examples/pdf-filter-tokens.cc')
-rw-r--r-- | examples/pdf-filter-tokens.cc | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/examples/pdf-filter-tokens.cc b/examples/pdf-filter-tokens.cc index 9cfd3949..68d6e149 100644 --- a/examples/pdf-filter-tokens.cc +++ b/examples/pdf-filter-tokens.cc @@ -22,8 +22,7 @@ void usage() { std::cerr << "Usage: " << whoami << " infile outfile" << std::endl - << "Applies token filters to infile and writes outfile" - << std::endl; + << "Applies token filters to infile and writes outfile" << std::endl; exit(2); } @@ -82,17 +81,13 @@ class ColorToGray: public QPDFObjectHandle::TokenFilter bool ColorToGray::isNumeric(QPDFTokenizer::token_type_e token_type) { - return ( - (token_type == QPDFTokenizer::tt_integer) || - (token_type == QPDFTokenizer::tt_real)); + return ((token_type == QPDFTokenizer::tt_integer) || (token_type == QPDFTokenizer::tt_real)); } bool ColorToGray::isIgnorable(QPDFTokenizer::token_type_e token_type) { - return ( - (token_type == QPDFTokenizer::tt_space) || - (token_type == QPDFTokenizer::tt_comment)); + return ((token_type == QPDFTokenizer::tt_space) || (token_type == QPDFTokenizer::tt_comment)); } double @@ -128,8 +123,7 @@ ColorToGray::handleToken(QPDFTokenizer::Token const& token) // kinds of operands, replace the command. Flush any additional // accumulated tokens to keep the stack only four tokens deep. - while ((!this->all_stack.empty()) && - isIgnorable(this->all_stack.at(0).getType())) { + while ((!this->all_stack.empty()) && isIgnorable(this->all_stack.at(0).getType())) { writeToken(this->all_stack.at(0)); this->all_stack.pop_front(); } @@ -138,8 +132,7 @@ ColorToGray::handleToken(QPDFTokenizer::Token const& token) if (!isIgnorable(token_type)) { this->stack.push_back(token); if ((this->stack.size() == 4) && token.isWord("rg") && - (isNumeric(this->stack.at(0).getType())) && - (isNumeric(this->stack.at(1).getType())) && + (isNumeric(this->stack.at(0).getType())) && (isNumeric(this->stack.at(1).getType())) && (isNumeric(this->stack.at(2).getType()))) { double r = numericValue(this->stack.at(0)); double g = numericValue(this->stack.at(1)); @@ -195,11 +188,9 @@ main(int argc, char* argv[]) // applied. See comments on the filters for additional // details. page.addContentTokenFilter( - std::shared_ptr<QPDFObjectHandle::TokenFilter>( - new StringReverser)); + std::shared_ptr<QPDFObjectHandle::TokenFilter>(new StringReverser)); page.addContentTokenFilter( - std::shared_ptr<QPDFObjectHandle::TokenFilter>( - new ColorToGray)); + std::shared_ptr<QPDFObjectHandle::TokenFilter>(new ColorToGray)); } QPDFWriter w(pdf, outfilename); |