diff options
author | Jay Berkenbilt <ejb@ql.org> | 2022-04-30 19:23:18 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2022-04-30 19:27:18 +0200 |
commit | 4f24617e1ea4ba7a6627a9c44304c6e0a0114249 (patch) | |
tree | 65c02e9e31cac60bac6f6aec165e8397dcde70e2 /examples/pdf-filter-tokens.cc | |
parent | 7f023701dd843749cf878baabeb3d33917fda62f (diff) | |
download | qpdf-4f24617e1ea4ba7a6627a9c44304c6e0a0114249.tar.zst |
Code clean up: use range-style for loops wherever possible
Where not possible, use "auto" to get the iterator type.
Editorial note: I have avoid this change for a long time because of
not wanting to make gratuitous changes to version history, which can
obscure when certain changes were made, but with having recently
touched every single file to apply automatic code formatting and with
making several broad changes to the API, I decided it was time to take
the plunge and get rid of the older (pre-C++11) verbose iterator
syntax. The new code is just easier to read and understand, and in
many cases, it will be more effecient as fewer temporary copies are
being made.
m-holger, if you're reading, you can see that I've finally come
around. :-)
Diffstat (limited to 'examples/pdf-filter-tokens.cc')
-rw-r--r-- | examples/pdf-filter-tokens.cc | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/examples/pdf-filter-tokens.cc b/examples/pdf-filter-tokens.cc index 59c85271..3d4bad8b 100644 --- a/examples/pdf-filter-tokens.cc +++ b/examples/pdf-filter-tokens.cc @@ -193,15 +193,12 @@ main(int argc, char* argv[]) pdf.processFile(infilename); std::vector<QPDFPageObjectHelper> pages = QPDFPageDocumentHelper(pdf).getAllPages(); - for (std::vector<QPDFPageObjectHelper>::iterator iter = pages.begin(); - iter != pages.end(); - ++iter) { + for (auto& page: pages) { // Attach two token filters to each page of this file. // When the file is written, or when the pages' contents // are retrieved in any other way, the filters will be // applied. See comments on the filters for additional // details. - QPDFPageObjectHelper& page(*iter); page.addContentTokenFilter( std::shared_ptr<QPDFObjectHandle::TokenFilter>( new StringReverser)); |