diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/pdf-bookmarks.cc | 4 | ||||
-rw-r--r-- | examples/pdf-count-strings.cc | 10 | ||||
-rw-r--r-- | examples/pdf-create.cc | 12 | ||||
-rw-r--r-- | examples/pdf-custom-filter.cc | 20 | ||||
-rw-r--r-- | examples/pdf-double-page-size.cc | 4 | ||||
-rw-r--r-- | examples/pdf-filter-tokens.cc | 14 | ||||
-rw-r--r-- | examples/pdf-invert-images.cc | 10 | ||||
-rw-r--r-- | examples/pdf-mod-info.cc | 6 | ||||
-rw-r--r-- | examples/pdf-name-number-tree.cc | 1 | ||||
-rw-r--r-- | examples/pdf-npages.cc | 4 | ||||
-rw-r--r-- | examples/pdf-overlay-page.cc | 3 | ||||
-rw-r--r-- | examples/pdf-parse-content.cc | 11 | ||||
-rw-r--r-- | examples/pdf-set-form-values.cc | 4 | ||||
-rw-r--r-- | examples/pdf-split-pages.cc | 2 | ||||
-rw-r--r-- | examples/qpdf-job.cc | 2 | ||||
-rw-r--r-- | examples/qpdfjob-c-save-attachment.c | 1 | ||||
-rw-r--r-- | examples/qpdfjob-remove-annotations.cc | 3 |
17 files changed, 48 insertions, 63 deletions
diff --git a/examples/pdf-bookmarks.cc b/examples/pdf-bookmarks.cc index b6f87e49..d507f559 100644 --- a/examples/pdf-bookmarks.cc +++ b/examples/pdf-bookmarks.cc @@ -5,8 +5,8 @@ #include <qpdf/QTC.hh> #include <qpdf/QUtil.hh> #include <iostream> -#include <stdlib.h> -#include <string.h> +#include <cstdlib> +#include <cstring> // This program demonstrates extraction of bookmarks using the qpdf // outlines API. Note that all the information shown by this program diff --git a/examples/pdf-count-strings.cc b/examples/pdf-count-strings.cc index 529f6bdc..93676375 100644 --- a/examples/pdf-count-strings.cc +++ b/examples/pdf-count-strings.cc @@ -5,14 +5,12 @@ // #include <iostream> -#include <stdlib.h> -#include <string.h> +#include <cstdlib> #include <qpdf/Pl_StdioFile.hh> #include <qpdf/QPDF.hh> #include <qpdf/QPDFObjectHandle.hh> #include <qpdf/QPDFPageDocumentHelper.hh> -#include <qpdf/QPDFPageObjectHelper.hh> #include <qpdf/QUtil.hh> static char const* whoami = nullptr; @@ -32,9 +30,9 @@ class StringCounter: public QPDFObjectHandle::TokenFilter count(0) { } - virtual ~StringCounter() = default; - virtual void handleToken(QPDFTokenizer::Token const&); - virtual void handleEOF(); + ~StringCounter() override = default; + void handleToken(QPDFTokenizer::Token const&) override; + void handleEOF() override; int getCount() const; private: diff --git a/examples/pdf-create.cc b/examples/pdf-create.cc index 527243a7..64ae5cb8 100644 --- a/examples/pdf-create.cc +++ b/examples/pdf-create.cc @@ -12,13 +12,11 @@ #include <qpdf/QPDF.hh> #include <qpdf/QPDFObjectHandle.hh> #include <qpdf/QPDFPageDocumentHelper.hh> -#include <qpdf/QPDFPageObjectHelper.hh> #include <qpdf/QPDFWriter.hh> #include <qpdf/QUtil.hh> #include <iostream> #include <memory> -#include <stdlib.h> -#include <string.h> +#include <cstdlib> static char const* whoami = nullptr; @@ -28,8 +26,8 @@ class ImageProvider: public QPDFObjectHandle::StreamDataProvider { public: ImageProvider(std::string const& color_space, std::string const& filter); - virtual ~ImageProvider() = default; - virtual void provideStreamData(QPDFObjGen const&, Pipeline* pipeline); + ~ImageProvider() override = default; + void provideStreamData(QPDFObjGen const&, Pipeline* pipeline) override; size_t getWidth() const; size_t getHeight() const; @@ -168,7 +166,7 @@ add_page( // mode. Since we are not specifying, QPDFWriter will compress // with /FlateDecode if we don't provide any other form of // compression. - ImageProvider* p = new ImageProvider(color_space, filter); + auto* p = new ImageProvider(color_space, filter); std::shared_ptr<QPDFObjectHandle::StreamDataProvider> provider(p); size_t width = p->getWidth(); size_t height = p->getHeight(); @@ -288,7 +286,7 @@ check( if (!this_errors) { // Check image data auto actual_data = image.getStreamData(qpdf_dl_all); - ImageProvider* p = new ImageProvider(desired_color_space, "null"); + auto* p = new ImageProvider(desired_color_space, "null"); std::shared_ptr<QPDFObjectHandle::StreamDataProvider> provider(p); Pl_Buffer b_p("get image data"); provider->provideStreamData(QPDFObjGen(), &b_p); diff --git a/examples/pdf-custom-filter.cc b/examples/pdf-custom-filter.cc index 2310a687..d99c6ab2 100644 --- a/examples/pdf-custom-filter.cc +++ b/examples/pdf-custom-filter.cc @@ -48,9 +48,9 @@ class Pl_XOR: public Pipeline public: Pl_XOR(char const* identifier, Pipeline* next, unsigned char key); - virtual ~Pl_XOR() = default; - virtual void write(unsigned char const* data, size_t len) override; - virtual void finish() override; + ~Pl_XOR() override = default; + void write(unsigned char const* data, size_t len) override; + void finish() override; private: unsigned char key; @@ -91,10 +91,10 @@ class SF_XORDecode: public QPDFStreamFilter // filter, which just means QPDF assumes that it should not // "uncompress" the stream by default. public: - virtual ~SF_XORDecode() = default; - virtual bool setDecodeParms(QPDFObjectHandle decode_parms) override; - virtual Pipeline* getDecodePipeline(Pipeline* next) override; - virtual bool isSpecializedCompression() override; + ~SF_XORDecode() override = default; + bool setDecodeParms(QPDFObjectHandle decode_parms) override; + Pipeline* getDecodePipeline(Pipeline* next) override; + bool isSpecializedCompression() override; private: unsigned char key; @@ -199,8 +199,8 @@ class StreamReplacer: public QPDFObjectHandle::StreamDataProvider public: StreamReplacer(QPDF* pdf); - virtual ~StreamReplacer() = default; - virtual void + ~StreamReplacer() override = default; + void provideStreamData(QPDFObjGen const& og, Pipeline* pipeline) override; void registerStream( @@ -409,7 +409,7 @@ process( // Create a single StreamReplacer instance. The interface requires // a std::shared_ptr in various places, so allocate a StreamReplacer // and stash it in a std::shared_ptr. - StreamReplacer* replacer = new StreamReplacer(&qpdf); + auto* replacer = new StreamReplacer(&qpdf); std::shared_ptr<QPDFObjectHandle::StreamDataProvider> p(replacer); for (auto& o: qpdf.getAllObjects()) { diff --git a/examples/pdf-double-page-size.cc b/examples/pdf-double-page-size.cc index 1ebe71df..d1fb3344 100644 --- a/examples/pdf-double-page-size.cc +++ b/examples/pdf-double-page-size.cc @@ -5,8 +5,8 @@ #include <qpdf/QPDFWriter.hh> #include <qpdf/QUtil.hh> #include <iostream> -#include <stdlib.h> -#include <string.h> +#include <cstdlib> +#include <cstring> static char const* whoami = nullptr; diff --git a/examples/pdf-filter-tokens.cc b/examples/pdf-filter-tokens.cc index a99ce70c..a897ef65 100644 --- a/examples/pdf-filter-tokens.cc +++ b/examples/pdf-filter-tokens.cc @@ -8,13 +8,11 @@ #include <algorithm> #include <deque> #include <iostream> -#include <stdlib.h> -#include <string.h> +#include <cstdlib> #include <qpdf/QPDF.hh> #include <qpdf/QPDFObjectHandle.hh> #include <qpdf/QPDFPageDocumentHelper.hh> -#include <qpdf/QPDFPageObjectHelper.hh> #include <qpdf/QPDFWriter.hh> #include <qpdf/QUtil.hh> @@ -35,8 +33,8 @@ usage() class StringReverser: public QPDFObjectHandle::TokenFilter { public: - virtual ~StringReverser() = default; - virtual void handleToken(QPDFTokenizer::Token const&); + ~StringReverser() override = default; + void handleToken(QPDFTokenizer::Token const&) override; }; void @@ -68,9 +66,9 @@ StringReverser::handleToken(QPDFTokenizer::Token const& token) class ColorToGray: public QPDFObjectHandle::TokenFilter { public: - virtual ~ColorToGray() = default; - virtual void handleToken(QPDFTokenizer::Token const&); - virtual void handleEOF(); + ~ColorToGray() override = default; + void handleToken(QPDFTokenizer::Token const&) override; + void handleEOF() override; private: bool isNumeric(QPDFTokenizer::token_type_e); diff --git a/examples/pdf-invert-images.cc b/examples/pdf-invert-images.cc index 9ffb9c1f..fae305b1 100644 --- a/examples/pdf-invert-images.cc +++ b/examples/pdf-invert-images.cc @@ -6,8 +6,8 @@ #include <qpdf/QPDFWriter.hh> #include <qpdf/QUtil.hh> #include <iostream> -#include <stdlib.h> -#include <string.h> +#include <cstdlib> +#include <cstring> static char const* whoami = nullptr; @@ -33,8 +33,8 @@ usage() class ImageInverter: public QPDFObjectHandle::StreamDataProvider { public: - virtual ~ImageInverter() = default; - virtual void + ~ImageInverter() override = default; + void provideStreamData(QPDFObjGen const& og, Pipeline* pipeline) override; void registerImage( @@ -124,7 +124,7 @@ main(int argc, char* argv[]) QPDF qpdf; qpdf.processFile(infilename, password); - ImageInverter* inv = new ImageInverter; + auto* inv = new ImageInverter; auto p = std::shared_ptr<QPDFObjectHandle::StreamDataProvider>(inv); // For each page... diff --git a/examples/pdf-mod-info.cc b/examples/pdf-mod-info.cc index fa49738b..196ce979 100644 --- a/examples/pdf-mod-info.cc +++ b/examples/pdf-mod-info.cc @@ -6,9 +6,9 @@ #include <qpdf/QTC.hh> #include <qpdf/QUtil.hh> #include <iostream> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> +#include <cstdio> +#include <cstdlib> +#include <cstring> static char const* version = "1.1"; static char const* whoami = nullptr; diff --git a/examples/pdf-name-number-tree.cc b/examples/pdf-name-number-tree.cc index f9dcb0fc..e1dfde05 100644 --- a/examples/pdf-name-number-tree.cc +++ b/examples/pdf-name-number-tree.cc @@ -3,7 +3,6 @@ #include <qpdf/QPDFNumberTreeObjectHelper.hh> #include <qpdf/QPDFWriter.hh> #include <qpdf/QUtil.hh> -#include <cstring> #include <iostream> static char const* whoami = nullptr; diff --git a/examples/pdf-npages.cc b/examples/pdf-npages.cc index 3d34d489..e98d1365 100644 --- a/examples/pdf-npages.cc +++ b/examples/pdf-npages.cc @@ -1,6 +1,6 @@ #include <iostream> -#include <stdlib.h> -#include <string.h> +#include <cstdlib> +#include <cstring> #include <qpdf/QPDF.hh> #include <qpdf/QUtil.hh> diff --git a/examples/pdf-overlay-page.cc b/examples/pdf-overlay-page.cc index 04a1e921..5c7bf46f 100644 --- a/examples/pdf-overlay-page.cc +++ b/examples/pdf-overlay-page.cc @@ -4,8 +4,7 @@ #include <qpdf/QPDFWriter.hh> #include <qpdf/QUtil.hh> #include <iostream> -#include <stdlib.h> -#include <string.h> +#include <cstdlib> // This program demonstrates use of form XObjects to overlay a page // from one file onto all pages of another file. The qpdf program's diff --git a/examples/pdf-parse-content.cc b/examples/pdf-parse-content.cc index 481633e6..968c980b 100644 --- a/examples/pdf-parse-content.cc +++ b/examples/pdf-parse-content.cc @@ -1,6 +1,5 @@ #include <iostream> -#include <stdlib.h> -#include <string.h> +#include <cstdlib> #include <qpdf/QIntC.hh> #include <qpdf/QPDF.hh> @@ -23,10 +22,10 @@ usage() class ParserCallbacks: public QPDFObjectHandle::ParserCallbacks { public: - virtual ~ParserCallbacks() = default; - virtual void contentSize(size_t); - virtual void handleObject(QPDFObjectHandle, size_t offset, size_t length); - virtual void handleEOF(); + ~ParserCallbacks() override = default; + void contentSize(size_t) override; + void handleObject(QPDFObjectHandle, size_t offset, size_t length) override; + void handleEOF() override; }; void diff --git a/examples/pdf-set-form-values.cc b/examples/pdf-set-form-values.cc index 1398c0dd..d13f0608 100644 --- a/examples/pdf-set-form-values.cc +++ b/examples/pdf-set-form-values.cc @@ -4,9 +4,7 @@ #include <qpdf/QPDFWriter.hh> #include <qpdf/QUtil.hh> #include <iostream> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> +#include <cstdlib> static char const* whoami = nullptr; diff --git a/examples/pdf-split-pages.cc b/examples/pdf-split-pages.cc index 5d65853e..6a4f149b 100644 --- a/examples/pdf-split-pages.cc +++ b/examples/pdf-split-pages.cc @@ -12,7 +12,7 @@ #include <cstring> #include <iostream> -#include <stdlib.h> +#include <cstdlib> #include <string> static bool static_id = false; diff --git a/examples/qpdf-job.cc b/examples/qpdf-job.cc index 614abbe6..c7131f77 100644 --- a/examples/qpdf-job.cc +++ b/examples/qpdf-job.cc @@ -1,8 +1,6 @@ -#include <qpdf/QIntC.hh> #include <qpdf/QPDFJob.hh> #include <qpdf/QUtil.hh> -#include <cstring> #include <iostream> // This program is a simple demonstration of different ways to use the diff --git a/examples/qpdfjob-c-save-attachment.c b/examples/qpdfjob-c-save-attachment.c index 39d1f69a..301bf635 100644 --- a/examples/qpdfjob-c-save-attachment.c +++ b/examples/qpdfjob-c-save-attachment.c @@ -1,4 +1,3 @@ -#include <qpdf/Constants.h> #include <qpdf/qpdfjob-c.h> #include <qpdf/qpdflogger-c.h> diff --git a/examples/qpdfjob-remove-annotations.cc b/examples/qpdfjob-remove-annotations.cc index dfab3f7b..5334e7dc 100644 --- a/examples/qpdfjob-remove-annotations.cc +++ b/examples/qpdfjob-remove-annotations.cc @@ -4,7 +4,6 @@ #include <cstdio> #include <cstdlib> -#include <cstring> #include <iostream> // This example demonstrates how we can use the QPDFJob createQPDF and writeQPDF @@ -12,7 +11,7 @@ // The example is a full copy of the qpdf program modified to allways remove all // annotations from the final output. -static char const* whoami = 0; +static char const* whoami = nullptr; static void usageExit(std::string const& msg) |