aboutsummaryrefslogtreecommitdiffstats
path: root/examples/pdf-count-strings.cc
diff options
context:
space:
mode:
authorm-holger <m-holger@kubitscheck.org>2023-05-27 19:19:52 +0200
committerm-holger <m-holger@kubitscheck.org>2023-06-02 17:00:40 +0200
commit3c5700c255f4603b5df9c6d183d13dd71a083cc3 (patch)
tree0f01c62c54b56d009b341922fa3441907a2e560b /examples/pdf-count-strings.cc
parent6e6a73d28f5f61f038209a61a3e85995dc71aa32 (diff)
downloadqpdf-3c5700c255f4603b5df9c6d183d13dd71a083cc3.tar.zst
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.