aboutsummaryrefslogtreecommitdiffstats
path: root/examples/pdf-count-strings.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <jberkenbilt@users.noreply.github.com>2023-06-17 15:26:16 +0200
committerGitHub <noreply@github.com>2023-06-17 15:26:16 +0200
commit44dce4e2988ec09e36dfb6d1fc527a143e6f597f (patch)
tree3cdb1999faeb5103eb87c36fb1673d8cbb5ab082 /examples/pdf-count-strings.cc
parentfc30e75122f6bef20ac8d676ac7cb8822feecf3e (diff)
parentacd0acf16931ce92bc908e4960c5a1e43d53b550 (diff)
downloadqpdf-44dce4e2988ec09e36dfb6d1fc527a143e6f597f.tar.zst
Merge pull request #978 from m-holger/reflow
Code tidy - reflow comments and strings
Diffstat (limited to 'examples/pdf-count-strings.cc')
-rw-r--r--examples/pdf-count-strings.cc20
1 files changed, 9 insertions, 11 deletions
diff --git a/examples/pdf-count-strings.cc b/examples/pdf-count-strings.cc
index c70e183e..2061a499 100644
--- a/examples/pdf-count-strings.cc
+++ b/examples/pdf-count-strings.cc
@@ -1,7 +1,7 @@
//
-// This example illustrates the use of QPDFObjectHandle::TokenFilter
-// with filterContents. See also pdf-filter-tokens.cc for an example
-// that uses QPDFObjectHandle::TokenFilter with addContentTokenFilter.
+// This example illustrates the use of QPDFObjectHandle::TokenFilter with filterContents. See also
+// pdf-filter-tokens.cc for an example that uses QPDFObjectHandle::TokenFilter with
+// addContentTokenFilter.
//
#include <cstdlib>
@@ -46,16 +46,15 @@ StringCounter::handleToken(QPDFTokenizer::Token const& token)
if (token.getType() == QPDFTokenizer::tt_string) {
++this->count;
}
- // Preserve input verbatim by passing each token to any specified
- // downstream filter.
+ // Preserve input verbatim by passing each token to any specified downstream filter.
writeToken(token);
}
void
StringCounter::handleEOF()
{
- // Write a comment at the end of the stream just to show how we
- // can enhance the output if we want.
+ // Write a comment at the end of the stream just to show how we can enhance the output if we
+ // want.
write("\n% strings found: ");
write(std::to_string(this->count));
}
@@ -82,10 +81,9 @@ main(int argc, char* argv[])
int pageno = 0;
for (auto& page: QPDFPageDocumentHelper(pdf).getAllPages()) {
++pageno;
- // Pass the contents of a page through our string counter.
- // If it's an even page, capture the output. This
- // illustrates that you may capture any output generated
- // by the filter, or you may ignore it.
+ // Pass the contents of a page through our string counter. If it's an even page, capture
+ // the output. This illustrates that you may capture any output generated by the filter,
+ // or you may ignore it.
StringCounter counter;
if (pageno % 2) {
// Ignore output for odd pages.