Commit 783d591fa3d7f93f9ab90114636ae90961d34750

Authored by m-holger
1 parent 6a5cd991

Tidy public header files

- Remove unnecessary QPDF_DLLs
- make deleted constructors public
- move some comments to support tooltips
- modernise some constructors and destructors
- change some member shared pointers to unique pointers
Showing 66 changed files with 329 additions and 537 deletions
include/qpdf/Buffer.hh
@@ -46,6 +46,9 @@ class Buffer @@ -46,6 +46,9 @@ class Buffer
46 QPDF_DLL 46 QPDF_DLL
47 Buffer(std::string& content); 47 Buffer(std::string& content);
48 48
  49 + Buffer(Buffer const&) = delete;
  50 + Buffer& operator=(Buffer const&) = delete;
  51 +
49 QPDF_DLL 52 QPDF_DLL
50 Buffer(Buffer&&) noexcept; 53 Buffer(Buffer&&) noexcept;
51 QPDF_DLL 54 QPDF_DLL
include/qpdf/ClosedFileInputSource.hh
@@ -20,22 +20,25 @@ @@ -20,22 +20,25 @@
20 #ifndef QPDF_CLOSEDFILEINPUTSOURCE_HH 20 #ifndef QPDF_CLOSEDFILEINPUTSOURCE_HH
21 #define QPDF_CLOSEDFILEINPUTSOURCE_HH 21 #define QPDF_CLOSEDFILEINPUTSOURCE_HH
22 22
23 -// This is an input source that reads from files, like FileInputSource, except that it opens and  
24 -// closes the file surrounding every operation. This decreases efficiency, but it allows many more  
25 -// of these to exist at once than the maximum number of open file descriptors. This is used for  
26 -// merging large numbers of files.  
27 -  
28 #include <qpdf/InputSource.hh> 23 #include <qpdf/InputSource.hh>
29 24
30 #include <memory> 25 #include <memory>
31 26
32 class FileInputSource; 27 class FileInputSource;
33 28
  29 +// This is an input source that reads from files, like FileInputSource, except that it opens and
  30 +// closes the file surrounding every operation. This decreases efficiency, but it allows many more
  31 +// of these to exist at once than the maximum number of open file descriptors. This is used for
  32 +// merging large numbers of files.
34 class QPDF_DLL_CLASS ClosedFileInputSource: public InputSource 33 class QPDF_DLL_CLASS ClosedFileInputSource: public InputSource
35 { 34 {
36 public: 35 public:
37 QPDF_DLL 36 QPDF_DLL
38 ClosedFileInputSource(char const* filename); 37 ClosedFileInputSource(char const* filename);
  38 +
  39 + ClosedFileInputSource(ClosedFileInputSource const&) = delete;
  40 + ClosedFileInputSource& operator=(ClosedFileInputSource const&) = delete;
  41 +
39 QPDF_DLL 42 QPDF_DLL
40 ~ClosedFileInputSource() override; 43 ~ClosedFileInputSource() override;
41 QPDF_DLL 44 QPDF_DLL
@@ -60,9 +63,6 @@ class QPDF_DLL_CLASS ClosedFileInputSource: public InputSource @@ -60,9 +63,6 @@ class QPDF_DLL_CLASS ClosedFileInputSource: public InputSource
60 void stayOpen(bool); 63 void stayOpen(bool);
61 64
62 private: 65 private:
63 - ClosedFileInputSource(ClosedFileInputSource const&) = delete;  
64 - ClosedFileInputSource& operator=(ClosedFileInputSource const&) = delete;  
65 -  
66 QPDF_DLL_PRIVATE 66 QPDF_DLL_PRIVATE
67 void before(); 67 void before();
68 QPDF_DLL_PRIVATE 68 QPDF_DLL_PRIVATE
include/qpdf/FileInputSource.hh
@@ -25,8 +25,7 @@ @@ -25,8 +25,7 @@
25 class QPDF_DLL_CLASS FileInputSource: public InputSource 25 class QPDF_DLL_CLASS FileInputSource: public InputSource
26 { 26 {
27 public: 27 public:
28 - QPDF_DLL  
29 - FileInputSource(); 28 + FileInputSource() = default;
30 QPDF_DLL 29 QPDF_DLL
31 FileInputSource(char const* filename); 30 FileInputSource(char const* filename);
32 QPDF_DLL 31 QPDF_DLL
@@ -35,6 +34,10 @@ class QPDF_DLL_CLASS FileInputSource: public InputSource @@ -35,6 +34,10 @@ class QPDF_DLL_CLASS FileInputSource: public InputSource
35 void setFilename(char const* filename); 34 void setFilename(char const* filename);
36 QPDF_DLL 35 QPDF_DLL
37 void setFile(char const* description, FILE* filep, bool close_file); 36 void setFile(char const* description, FILE* filep, bool close_file);
  37 +
  38 + FileInputSource(FileInputSource const&) = delete;
  39 + FileInputSource& operator=(FileInputSource const&) = delete;
  40 +
38 QPDF_DLL 41 QPDF_DLL
39 ~FileInputSource() override; 42 ~FileInputSource() override;
40 QPDF_DLL 43 QPDF_DLL
@@ -53,12 +56,9 @@ class QPDF_DLL_CLASS FileInputSource: public InputSource @@ -53,12 +56,9 @@ class QPDF_DLL_CLASS FileInputSource: public InputSource
53 void unreadCh(char ch) override; 56 void unreadCh(char ch) override;
54 57
55 private: 58 private:
56 - FileInputSource(FileInputSource const&) = delete;  
57 - FileInputSource& operator=(FileInputSource const&) = delete;  
58 -  
59 - bool close_file; 59 + bool close_file{false};
60 std::string filename; 60 std::string filename;
61 - FILE* file; 61 + FILE* file{nullptr};
62 }; 62 };
63 63
64 #endif // QPDF_FILEINPUTSOURCE_HH 64 #endif // QPDF_FILEINPUTSOURCE_HH
include/qpdf/InputSource.hh
@@ -32,11 +32,8 @@ @@ -32,11 +32,8 @@
32 class QPDF_DLL_CLASS InputSource 32 class QPDF_DLL_CLASS InputSource
33 { 33 {
34 public: 34 public:
35 - QPDF_DLL  
36 - InputSource()  
37 - {  
38 - }  
39 - QPDF_DLL 35 + InputSource() = default;
  36 +
40 virtual ~InputSource() = default; 37 virtual ~InputSource() = default;
41 38
42 class QPDF_DLL_CLASS Finder 39 class QPDF_DLL_CLASS Finder
include/qpdf/JSON.hh
@@ -20,15 +20,6 @@ @@ -20,15 +20,6 @@
20 #ifndef JSON_HH 20 #ifndef JSON_HH
21 #define JSON_HH 21 #define JSON_HH
22 22
23 -// This is a simple JSON serializer and parser, primarily designed for serializing QPDF Objects as  
24 -// JSON. While it may work as a general-purpose JSON parser/serializer, there are better options.  
25 -// JSON objects contain their data as smart pointers. When one JSON object is added to another, this  
26 -// pointer is copied. This means you can create temporary JSON objects on the stack, add them to  
27 -// other objects, and let them go out of scope safely. It also means that if a JSON object is added  
28 -// in more than one place, all copies share the underlying data. This makes them similar in  
29 -// structure and behavior to QPDFObjectHandle and may feel natural within the QPDF codebase, but it  
30 -// is also a good reason not to use this as a general-purpose JSON package.  
31 -  
32 #include <qpdf/DLL.h> 23 #include <qpdf/DLL.h>
33 #include <qpdf/Types.h> 24 #include <qpdf/Types.h>
34 25
@@ -43,12 +34,19 @@ @@ -43,12 +34,19 @@
43 class Pipeline; 34 class Pipeline;
44 class InputSource; 35 class InputSource;
45 36
  37 +// This is a simple JSON serializer and parser, primarily designed for serializing QPDF Objects as
  38 +// JSON. While it may work as a general-purpose JSON parser/serializer, there are better options.
  39 +// JSON objects contain their data as smart pointers. When one JSON object is added to another, this
  40 +// pointer is copied. This means you can create temporary JSON objects on the stack, add them to
  41 +// other objects, and let them go out of scope safely. It also means that if a JSON object is added
  42 +// in more than one place, all copies share the underlying data. This makes them similar in
  43 +// structure and behavior to QPDFObjectHandle and may feel natural within the QPDF codebase, but it
  44 +// is also a good reason not to use this as a general-purpose JSON package.
46 class JSON 45 class JSON
47 { 46 {
48 public: 47 public:
49 static int constexpr LATEST = 2; 48 static int constexpr LATEST = 2;
50 49
51 - QPDF_DLL  
52 JSON() = default; 50 JSON() = default;
53 51
54 QPDF_DLL 52 QPDF_DLL
@@ -147,6 +145,7 @@ class JSON @@ -147,6 +145,7 @@ class JSON
147 // 145 //
148 // - If argument is wrong type, including null, return false 146 // - If argument is wrong type, including null, return false
149 // - If argument is right type, return true and initialize the value 147 // - If argument is right type, return true and initialize the value
  148 +
150 QPDF_DLL 149 QPDF_DLL
151 bool getString(std::string& utf8) const; 150 bool getString(std::string& utf8) const;
152 QPDF_DLL 151 QPDF_DLL
@@ -210,7 +209,6 @@ class JSON @@ -210,7 +209,6 @@ class JSON
210 class QPDF_DLL_CLASS Reactor 209 class QPDF_DLL_CLASS Reactor
211 { 210 {
212 public: 211 public:
213 - QPDF_DLL  
214 virtual ~Reactor() = default; 212 virtual ~Reactor() = default;
215 213
216 // The start/end methods are called when parsing of a dictionary or array is started or 214 // The start/end methods are called when parsing of a dictionary or array is started or
@@ -377,7 +375,6 @@ class JSON @@ -377,7 +375,6 @@ class JSON
377 friend class JSON; 375 friend class JSON;
378 376
379 public: 377 public:
380 - QPDF_DLL  
381 ~Members() = default; 378 ~Members() = default;
382 379
383 private: 380 private:
include/qpdf/PDFVersion.hh
@@ -23,18 +23,16 @@ @@ -23,18 +23,16 @@
23 #include <qpdf/DLL.h> 23 #include <qpdf/DLL.h>
24 #include <string> 24 #include <string>
25 25
  26 +// Represent a PDF version. PDF versions are typically major.minor, but PDF 1.7 has several
  27 +// extension levels as the ISO 32000 spec was in progress. This class helps with comparison of
  28 +// versions.
26 class PDFVersion 29 class PDFVersion
27 { 30 {
28 public: 31 public:
29 - // Represent a PDF version. PDF versions are typically major.minor, but PDF 1.7 has several  
30 - // extension levels as the ISO 32000 spec was in progress. This class helps with comparison of  
31 - // versions.  
32 - QPDF_DLL  
33 - PDFVersion();  
34 - QPDF_DLL 32 + PDFVersion() = default;
35 PDFVersion(PDFVersion const&) = default; 33 PDFVersion(PDFVersion const&) = default;
36 - QPDF_DLL  
37 PDFVersion& operator=(PDFVersion const&) = default; 34 PDFVersion& operator=(PDFVersion const&) = default;
  35 +
38 QPDF_DLL 36 QPDF_DLL
39 PDFVersion(int major, int minor, int extension = 0); 37 PDFVersion(int major, int minor, int extension = 0);
40 QPDF_DLL 38 QPDF_DLL
@@ -59,9 +57,9 @@ class PDFVersion @@ -59,9 +57,9 @@ class PDFVersion
59 int getExtensionLevel() const; 57 int getExtensionLevel() const;
60 58
61 private: 59 private:
62 - int major_version;  
63 - int minor_version;  
64 - int extension_level; 60 + int major_version{0};
  61 + int minor_version{0};
  62 + int extension_level{0};
65 }; 63 };
66 64
67 #endif // PDFVERSION_HH 65 #endif // PDFVERSION_HH
include/qpdf/Pipeline.hh
@@ -17,6 +17,14 @@ @@ -17,6 +17,14 @@
17 // License. At your option, you may continue to consider qpdf to be licensed under those terms. 17 // License. At your option, you may continue to consider qpdf to be licensed under those terms.
18 // Please see the manual for additional information. 18 // Please see the manual for additional information.
19 19
  20 +#ifndef PIPELINE_HH
  21 +#define PIPELINE_HH
  22 +
  23 +#include <qpdf/DLL.h>
  24 +
  25 +#include <memory>
  26 +#include <string>
  27 +
20 // Generalized Pipeline interface. By convention, subclasses of Pipeline are called Pl_Something. 28 // Generalized Pipeline interface. By convention, subclasses of Pipeline are called Pl_Something.
21 // 29 //
22 // When an instance of Pipeline is created with a pointer to a next pipeline, that pipeline writes 30 // When an instance of Pipeline is created with a pointer to a next pipeline, that pipeline writes
@@ -32,15 +40,7 @@ @@ -32,15 +40,7 @@
32 // Some pipelines are reusable (i.e., you can call write() after calling finish() and can call 40 // Some pipelines are reusable (i.e., you can call write() after calling finish() and can call
33 // finish() multiple times) while others are not. It is up to the caller to use a pipeline 41 // finish() multiple times) while others are not. It is up to the caller to use a pipeline
34 // according to its own restrictions. 42 // according to its own restrictions.
35 -  
36 -#ifndef PIPELINE_HH  
37 -#define PIPELINE_HH  
38 -  
39 -#include <qpdf/DLL.h>  
40 -  
41 -#include <memory>  
42 -#include <string>  
43 - 43 +//
44 // Remember to use QPDF_DLL_CLASS on anything derived from Pipeline so it will work with 44 // Remember to use QPDF_DLL_CLASS on anything derived from Pipeline so it will work with
45 // dynamic_cast across the shared object boundary. 45 // dynamic_cast across the shared object boundary.
46 class QPDF_DLL_CLASS Pipeline 46 class QPDF_DLL_CLASS Pipeline
@@ -49,7 +49,6 @@ class QPDF_DLL_CLASS Pipeline @@ -49,7 +49,6 @@ class QPDF_DLL_CLASS Pipeline
49 QPDF_DLL 49 QPDF_DLL
50 Pipeline(char const* identifier, Pipeline* next); 50 Pipeline(char const* identifier, Pipeline* next);
51 51
52 - QPDF_DLL  
53 virtual ~Pipeline() = default; 52 virtual ~Pipeline() = default;
54 53
55 // Subclasses should implement write and finish to do their jobs and then, if they are not 54 // Subclasses should implement write and finish to do their jobs and then, if they are not
@@ -98,7 +97,7 @@ class QPDF_DLL_CLASS Pipeline @@ -98,7 +97,7 @@ class QPDF_DLL_CLASS Pipeline
98 protected: 97 protected:
99 QPDF_DLL 98 QPDF_DLL
100 Pipeline* getNext(bool allow_null = false); 99 Pipeline* getNext(bool allow_null = false);
101 - QPDF_DLL 100 +
102 Pipeline* 101 Pipeline*
103 next() const noexcept 102 next() const noexcept
104 { 103 {
include/qpdf/Pl_Buffer.hh
@@ -20,6 +20,12 @@ @@ -20,6 +20,12 @@
20 #ifndef PL_BUFFER_HH 20 #ifndef PL_BUFFER_HH
21 #define PL_BUFFER_HH 21 #define PL_BUFFER_HH
22 22
  23 +#include <qpdf/Buffer.hh>
  24 +#include <qpdf/Pipeline.hh>
  25 +
  26 +#include <memory>
  27 +#include <string>
  28 +
23 // This pipeline accumulates the data passed to it into a memory buffer. Each subsequent use of 29 // This pipeline accumulates the data passed to it into a memory buffer. Each subsequent use of
24 // this buffer appends to the data accumulated so far. getBuffer() may be called only after calling 30 // this buffer appends to the data accumulated so far. getBuffer() may be called only after calling
25 // finish() and before calling any subsequent write(). At that point, a dynamically allocated 31 // finish() and before calling any subsequent write(). At that point, a dynamically allocated
@@ -28,13 +34,6 @@ @@ -28,13 +34,6 @@
28 // 34 //
29 // For this pipeline, "next" may be null. If a next pointer is provided, this pipeline will also 35 // For this pipeline, "next" may be null. If a next pointer is provided, this pipeline will also
30 // pass the data through to it. 36 // pass the data through to it.
31 -  
32 -#include <qpdf/Buffer.hh>  
33 -#include <qpdf/Pipeline.hh>  
34 -  
35 -#include <memory>  
36 -#include <string>  
37 -  
38 class QPDF_DLL_CLASS Pl_Buffer: public Pipeline 37 class QPDF_DLL_CLASS Pl_Buffer: public Pipeline
39 { 38 {
40 public: 39 public:
@@ -69,23 +68,9 @@ class QPDF_DLL_CLASS Pl_Buffer: public Pipeline @@ -69,23 +68,9 @@ class QPDF_DLL_CLASS Pl_Buffer: public Pipeline
69 std::string getString(); 68 std::string getString();
70 69
71 private: 70 private:
72 - class QPDF_DLL_PRIVATE Members  
73 - {  
74 - friend class Pl_Buffer;  
75 -  
76 - public:  
77 - QPDF_DLL  
78 - ~Members() = default;  
79 -  
80 - private:  
81 - Members() = default;  
82 - Members(Members const&) = delete;  
83 -  
84 - bool ready{true};  
85 - std::string data;  
86 - }; 71 + class Members;
87 72
88 - std::shared_ptr<Members> m; 73 + std::unique_ptr<Members> m;
89 }; 74 };
90 75
91 #endif // PL_BUFFER_HH 76 #endif // PL_BUFFER_HH
include/qpdf/Pl_Concatenate.hh
@@ -20,18 +20,18 @@ @@ -20,18 +20,18 @@
20 #ifndef PL_CONCATENATE_HH 20 #ifndef PL_CONCATENATE_HH
21 #define PL_CONCATENATE_HH 21 #define PL_CONCATENATE_HH
22 22
  23 +#include <qpdf/Pipeline.hh>
  24 +
23 // This pipeline will drop all regular finish calls rather than passing them onto next. To finish 25 // This pipeline will drop all regular finish calls rather than passing them onto next. To finish
24 // downstream streams, call manualFinish. This makes it possible to pipe multiple streams (e.g. 26 // downstream streams, call manualFinish. This makes it possible to pipe multiple streams (e.g.
25 // with QPDFObjectHandle::pipeStreamData) to a downstream like Pl_Flate that can't handle multiple 27 // with QPDFObjectHandle::pipeStreamData) to a downstream like Pl_Flate that can't handle multiple
26 // calls to finish(). 28 // calls to finish().
27 -  
28 -#include <qpdf/Pipeline.hh>  
29 -  
30 class QPDF_DLL_CLASS Pl_Concatenate: public Pipeline 29 class QPDF_DLL_CLASS Pl_Concatenate: public Pipeline
31 { 30 {
32 public: 31 public:
33 QPDF_DLL 32 QPDF_DLL
34 Pl_Concatenate(char const* identifier, Pipeline* next); 33 Pl_Concatenate(char const* identifier, Pipeline* next);
  34 +
35 QPDF_DLL 35 QPDF_DLL
36 ~Pl_Concatenate() override; 36 ~Pl_Concatenate() override;
37 37
@@ -51,7 +51,6 @@ class QPDF_DLL_CLASS Pl_Concatenate: public Pipeline @@ -51,7 +51,6 @@ class QPDF_DLL_CLASS Pl_Concatenate: public Pipeline
51 friend class Pl_Concatenate; 51 friend class Pl_Concatenate;
52 52
53 public: 53 public:
54 - QPDF_DLL  
55 ~Members() = default; 54 ~Members() = default;
56 55
57 private: 56 private:
@@ -59,7 +58,7 @@ class QPDF_DLL_CLASS Pl_Concatenate: public Pipeline @@ -59,7 +58,7 @@ class QPDF_DLL_CLASS Pl_Concatenate: public Pipeline
59 Members(Members const&) = delete; 58 Members(Members const&) = delete;
60 }; 59 };
61 60
62 - std::shared_ptr<Members> m; 61 + std::unique_ptr<Members> m{nullptr};
63 }; 62 };
64 63
65 #endif // PL_CONCATENATE_HH 64 #endif // PL_CONCATENATE_HH
include/qpdf/Pl_Count.hh
@@ -20,11 +20,10 @@ @@ -20,11 +20,10 @@
20 #ifndef PL_COUNT_HH 20 #ifndef PL_COUNT_HH
21 #define PL_COUNT_HH 21 #define PL_COUNT_HH
22 22
23 -// This pipeline is reusable; i.e., it is safe to call write() after calling finish().  
24 -  
25 #include <qpdf/Pipeline.hh> 23 #include <qpdf/Pipeline.hh>
26 #include <qpdf/Types.h> 24 #include <qpdf/Types.h>
27 25
  26 +// This pipeline is reusable; i.e., it is safe to call write() after calling finish().
28 class QPDF_DLL_CLASS Pl_Count: public Pipeline 27 class QPDF_DLL_CLASS Pl_Count: public Pipeline
29 { 28 {
30 public: 29 public:
@@ -45,24 +44,9 @@ class QPDF_DLL_CLASS Pl_Count: public Pipeline @@ -45,24 +44,9 @@ class QPDF_DLL_CLASS Pl_Count: public Pipeline
45 unsigned char getLastChar() const; 44 unsigned char getLastChar() const;
46 45
47 private: 46 private:
48 - class QPDF_DLL_PRIVATE Members  
49 - {  
50 - friend class Pl_Count;  
51 -  
52 - public:  
53 - QPDF_DLL  
54 - ~Members() = default;  
55 -  
56 - private:  
57 - Members();  
58 - Members(Members const&) = delete;  
59 -  
60 - // Must be qpdf_offset_t, not size_t, to handle writing more than size_t can handle.  
61 - qpdf_offset_t count{0};  
62 - unsigned char last_char{'\0'};  
63 - }; 47 + class Members;
64 48
65 - std::shared_ptr<Members> m; 49 + std::unique_ptr<Members> m;
66 }; 50 };
67 51
68 #endif // PL_COUNT_HH 52 #endif // PL_COUNT_HH
include/qpdf/Pl_DCT.hh
@@ -89,39 +89,9 @@ class QPDF_DLL_CLASS Pl_DCT: public Pipeline @@ -89,39 +89,9 @@ class QPDF_DLL_CLASS Pl_DCT: public Pipeline
89 89
90 enum action_e { a_compress, a_decompress }; 90 enum action_e { a_compress, a_decompress };
91 91
92 - class QPDF_DLL_PRIVATE Members  
93 - {  
94 - friend class Pl_DCT;  
95 -  
96 - public:  
97 - QPDF_DLL  
98 - ~Members() = default;  
99 - Members(Members const&) = delete;  
100 -  
101 - private:  
102 - // For compression  
103 - Members(  
104 - JDIMENSION image_width,  
105 - JDIMENSION image_height,  
106 - int components,  
107 - J_COLOR_SPACE color_space,  
108 - CompressConfig* config_callback);  
109 - // For decompression  
110 - Members();  
111 -  
112 - action_e action;  
113 - Pl_Buffer buf;  
114 -  
115 - // Used for compression  
116 - JDIMENSION image_width{0};  
117 - JDIMENSION image_height{0};  
118 - int components{1};  
119 - J_COLOR_SPACE color_space{JCS_GRAYSCALE};  
120 -  
121 - CompressConfig* config_callback{nullptr};  
122 - }; 92 + class Members;
123 93
124 - std::shared_ptr<Members> m; 94 + std::unique_ptr<Members> m;
125 }; 95 };
126 96
127 #endif // PL_DCT_HH 97 #endif // PL_DCT_HH
include/qpdf/Pl_Discard.hh
@@ -20,12 +20,11 @@ @@ -20,12 +20,11 @@
20 #ifndef PL_DISCARD_HH 20 #ifndef PL_DISCARD_HH
21 #define PL_DISCARD_HH 21 #define PL_DISCARD_HH
22 22
23 -// This pipeline discards its output. It is an end-of-line pipeline (with no next).  
24 -  
25 -// This pipeline is reusable; i.e., it is safe to call write() after calling finish().  
26 -  
27 #include <qpdf/Pipeline.hh> 23 #include <qpdf/Pipeline.hh>
28 24
  25 +// This pipeline discards its output. It is an end-of-line pipeline (with no next).
  26 +//
  27 +// This pipeline is reusable; i.e., it is safe to call write() after calling finish().
29 class QPDF_DLL_CLASS Pl_Discard: public Pipeline 28 class QPDF_DLL_CLASS Pl_Discard: public Pipeline
30 { 29 {
31 public: 30 public:
@@ -37,22 +36,6 @@ class QPDF_DLL_CLASS Pl_Discard: public Pipeline @@ -37,22 +36,6 @@ class QPDF_DLL_CLASS Pl_Discard: public Pipeline
37 void write(unsigned char const*, size_t) override; 36 void write(unsigned char const*, size_t) override;
38 QPDF_DLL 37 QPDF_DLL
39 void finish() override; 38 void finish() override;
40 -  
41 - private:  
42 - class QPDF_DLL_PRIVATE Members  
43 - {  
44 - friend class Pl_Discard;  
45 -  
46 - public:  
47 - QPDF_DLL  
48 - ~Members() = default;  
49 -  
50 - private:  
51 - Members() = default;  
52 - Members(Members const&) = delete;  
53 - };  
54 -  
55 - std::shared_ptr<Members> m;  
56 }; 39 };
57 40
58 #endif // PL_DISCARD_HH 41 #endif // PL_DISCARD_HH
include/qpdf/Pl_Flate.hh
@@ -104,11 +104,10 @@ class QPDF_DLL_CLASS Pl_Flate: public Pipeline @@ -104,11 +104,10 @@ class QPDF_DLL_CLASS Pl_Flate: public Pipeline
104 friend class Pl_Flate; 104 friend class Pl_Flate;
105 105
106 public: 106 public:
107 - QPDF_DLL 107 + Members(size_t out_bufsize, action_e action);
108 ~Members(); 108 ~Members();
109 109
110 private: 110 private:
111 - Members(size_t out_bufsize, action_e action);  
112 Members(Members const&) = delete; 111 Members(Members const&) = delete;
113 112
114 std::shared_ptr<unsigned char> outbuf; 113 std::shared_ptr<unsigned char> outbuf;
@@ -121,7 +120,7 @@ class QPDF_DLL_CLASS Pl_Flate: public Pipeline @@ -121,7 +120,7 @@ class QPDF_DLL_CLASS Pl_Flate: public Pipeline
121 std::unique_ptr<std::string> zopfli_buf; 120 std::unique_ptr<std::string> zopfli_buf;
122 }; 121 };
123 122
124 - std::shared_ptr<Members> m; 123 + std::unique_ptr<Members> m;
125 }; 124 };
126 125
127 #endif // PL_FLATE_HH 126 #endif // PL_FLATE_HH
include/qpdf/Pl_Function.hh
@@ -62,22 +62,9 @@ class QPDF_DLL_CLASS Pl_Function: public Pipeline @@ -62,22 +62,9 @@ class QPDF_DLL_CLASS Pl_Function: public Pipeline
62 void finish() override; 62 void finish() override;
63 63
64 private: 64 private:
65 - class QPDF_DLL_PRIVATE Members  
66 - {  
67 - friend class Pl_Function; 65 + class Members;
68 66
69 - public:  
70 - QPDF_DLL  
71 - ~Members() = default;  
72 -  
73 - private:  
74 - Members(writer_t);  
75 - Members(Members const&) = delete;  
76 -  
77 - writer_t fn;  
78 - };  
79 -  
80 - std::shared_ptr<Members> m; 67 + std::unique_ptr<Members> m;
81 }; 68 };
82 69
83 #endif // PL_FUNCTION_HH 70 #endif // PL_FUNCTION_HH
include/qpdf/Pl_OStream.hh
@@ -17,8 +17,6 @@ @@ -17,8 +17,6 @@
17 // License. At your option, you may continue to consider qpdf to be licensed under those terms. 17 // License. At your option, you may continue to consider qpdf to be licensed under those terms.
18 // Please see the manual for additional information. 18 // Please see the manual for additional information.
19 19
20 -// End-of-line pipeline that simply writes its data to a stdio FILE* object.  
21 -  
22 #ifndef PL_OSTREAM_HH 20 #ifndef PL_OSTREAM_HH
23 #define PL_OSTREAM_HH 21 #define PL_OSTREAM_HH
24 22
@@ -26,10 +24,9 @@ @@ -26,10 +24,9 @@
26 24
27 #include <iostream> 25 #include <iostream>
28 26
  27 +// End-of-line pipeline that simply writes its data to a stdio FILE* object.
29 // 28 //
30 // This pipeline is reusable. 29 // This pipeline is reusable.
31 -//  
32 -  
33 class QPDF_DLL_CLASS Pl_OStream: public Pipeline 30 class QPDF_DLL_CLASS Pl_OStream: public Pipeline
34 { 31 {
35 public: 32 public:
@@ -45,22 +42,9 @@ class QPDF_DLL_CLASS Pl_OStream: public Pipeline @@ -45,22 +42,9 @@ class QPDF_DLL_CLASS Pl_OStream: public Pipeline
45 void finish() override; 42 void finish() override;
46 43
47 private: 44 private:
48 - class QPDF_DLL_PRIVATE Members  
49 - {  
50 - friend class Pl_OStream;  
51 -  
52 - public:  
53 - QPDF_DLL  
54 - ~Members() = default;  
55 -  
56 - private:  
57 - Members(std::ostream&);  
58 - Members(Members const&) = delete;  
59 -  
60 - std::ostream& os;  
61 - }; 45 + class Members;
62 46
63 - std::shared_ptr<Members> m; 47 + std::unique_ptr<Members> m;
64 }; 48 };
65 49
66 #endif // PL_OSTREAM_HH 50 #endif // PL_OSTREAM_HH
include/qpdf/Pl_QPDFTokenizer.hh
@@ -31,11 +31,10 @@ @@ -31,11 +31,10 @@
31 // Tokenize the incoming text using QPDFTokenizer and pass the tokens in turn to a 31 // Tokenize the incoming text using QPDFTokenizer and pass the tokens in turn to a
32 // QPDFObjectHandle::TokenFilter object. All bytes of incoming content will be included in exactly 32 // QPDFObjectHandle::TokenFilter object. All bytes of incoming content will be included in exactly
33 // one token and passed downstream. 33 // one token and passed downstream.
34 - 34 +//
35 // This is a very low-level interface for working with token filters. Most code will want to use 35 // This is a very low-level interface for working with token filters. Most code will want to use
36 // QPDFObjectHandle::filterPageContents or QPDFObjectHandle::addTokenFilter. See QPDFObjectHandle.hh 36 // QPDFObjectHandle::filterPageContents or QPDFObjectHandle::addTokenFilter. See QPDFObjectHandle.hh
37 // for details. 37 // for details.
38 -  
39 class QPDF_DLL_CLASS Pl_QPDFTokenizer: public Pipeline 38 class QPDF_DLL_CLASS Pl_QPDFTokenizer: public Pipeline
40 { 39 {
41 public: 40 public:
@@ -52,23 +51,9 @@ class QPDF_DLL_CLASS Pl_QPDFTokenizer: public Pipeline @@ -52,23 +51,9 @@ class QPDF_DLL_CLASS Pl_QPDFTokenizer: public Pipeline
52 void finish() override; 51 void finish() override;
53 52
54 private: 53 private:
55 - class QPDF_DLL_PRIVATE Members  
56 - {  
57 - friend class Pl_QPDFTokenizer;  
58 -  
59 - public:  
60 - QPDF_DLL  
61 - ~Members() = default;  
62 -  
63 - private:  
64 - Members();  
65 - Members(Members const&) = delete; 54 + class Members;
66 55
67 - QPDFObjectHandle::TokenFilter* filter{nullptr};  
68 - QPDFTokenizer tokenizer;  
69 - Pl_Buffer buf;  
70 - };  
71 - std::shared_ptr<Members> m; 56 + std::unique_ptr<Members> m;
72 }; 57 };
73 58
74 #endif // PL_QPDFTOKENIZER_HH 59 #endif // PL_QPDFTOKENIZER_HH
include/qpdf/Pl_RunLength.hh
@@ -52,26 +52,9 @@ class QPDF_DLL_CLASS Pl_RunLength: public Pipeline @@ -52,26 +52,9 @@ class QPDF_DLL_CLASS Pl_RunLength: public Pipeline
52 52
53 enum state_e { st_top, st_copying, st_run }; 53 enum state_e { st_top, st_copying, st_run };
54 54
55 - class QPDF_DLL_PRIVATE Members  
56 - {  
57 - friend class Pl_RunLength; 55 + class Members;
58 56
59 - public:  
60 - QPDF_DLL  
61 - ~Members() = default;  
62 -  
63 - private:  
64 - Members(action_e);  
65 - Members(Members const&) = delete;  
66 -  
67 - action_e action;  
68 - state_e state{st_top};  
69 - unsigned char buf[128];  
70 - unsigned int length{0};  
71 - std::string out;  
72 - };  
73 -  
74 - std::shared_ptr<Members> m; 57 + std::unique_ptr<Members> m;
75 }; 58 };
76 59
77 #endif // PL_RUNLENGTH_HH 60 #endif // PL_RUNLENGTH_HH
include/qpdf/Pl_StdioFile.hh
@@ -29,7 +29,6 @@ @@ -29,7 +29,6 @@
29 // 29 //
30 // This pipeline is reusable. 30 // This pipeline is reusable.
31 // 31 //
32 -  
33 class QPDF_DLL_CLASS Pl_StdioFile: public Pipeline 32 class QPDF_DLL_CLASS Pl_StdioFile: public Pipeline
34 { 33 {
35 public: 34 public:
@@ -45,22 +44,10 @@ class QPDF_DLL_CLASS Pl_StdioFile: public Pipeline @@ -45,22 +44,10 @@ class QPDF_DLL_CLASS Pl_StdioFile: public Pipeline
45 void finish() override; 44 void finish() override;
46 45
47 private: 46 private:
48 - class QPDF_DLL_PRIVATE Members  
49 - {  
50 - friend class Pl_StdioFile;  
51 -  
52 - public:  
53 - QPDF_DLL  
54 - ~Members() = default;  
55 -  
56 - private:  
57 - Members(FILE*);  
58 - Members(Members const&) = delete;  
59 -  
60 - FILE* file;  
61 - }; 47 + class Members;
  48 + ;
62 49
63 - std::shared_ptr<Members> m; 50 + std::unique_ptr<Members> m;
64 }; 51 };
65 52
66 #endif // PL_STDIOFILE_HH 53 #endif // PL_STDIOFILE_HH
include/qpdf/Pl_String.hh
@@ -20,6 +20,10 @@ @@ -20,6 +20,10 @@
20 #ifndef PL_STRING_HH 20 #ifndef PL_STRING_HH
21 #define PL_STRING_HH 21 #define PL_STRING_HH
22 22
  23 +#include <qpdf/Pipeline.hh>
  24 +
  25 +#include <string>
  26 +
23 // This pipeline accumulates the data passed to it into a std::string, a reference to which is 27 // This pipeline accumulates the data passed to it into a std::string, a reference to which is
24 // passed in at construction. Each subsequent use of this pipeline appends to the data accumulated 28 // passed in at construction. Each subsequent use of this pipeline appends to the data accumulated
25 // so far. 29 // so far.
@@ -31,11 +35,6 @@ @@ -31,11 +35,6 @@
31 // this in front of another pipeline to capture data that is written to the other pipeline without 35 // this in front of another pipeline to capture data that is written to the other pipeline without
32 // interfering with when finish is called on the other pipeline and without having to put a 36 // interfering with when finish is called on the other pipeline and without having to put a
33 // Pl_Concatenate after it. 37 // Pl_Concatenate after it.
34 -  
35 -#include <qpdf/Pipeline.hh>  
36 -  
37 -#include <string>  
38 -  
39 class QPDF_DLL_CLASS Pl_String: public Pipeline 38 class QPDF_DLL_CLASS Pl_String: public Pipeline
40 { 39 {
41 public: 40 public:
@@ -50,22 +49,9 @@ class QPDF_DLL_CLASS Pl_String: public Pipeline @@ -50,22 +49,9 @@ class QPDF_DLL_CLASS Pl_String: public Pipeline
50 void finish() override; 49 void finish() override;
51 50
52 private: 51 private:
53 - class QPDF_DLL_PRIVATE Members  
54 - {  
55 - friend class Pl_String;  
56 -  
57 - public:  
58 - QPDF_DLL  
59 - ~Members() = default;  
60 -  
61 - private:  
62 - Members(std::string&);  
63 - Members(Members const&) = delete;  
64 -  
65 - std::string& s;  
66 - }; 52 + class Members;
67 53
68 - std::shared_ptr<Members> m; 54 + std::unique_ptr<Members> m;
69 }; 55 };
70 56
71 #endif // PL_STRING_HH 57 #endif // PL_STRING_HH
include/qpdf/QPDF.hh
@@ -1496,13 +1496,11 @@ class QPDF @@ -1496,13 +1496,11 @@ class QPDF
1496 friend class ResolveRecorder; 1496 friend class ResolveRecorder;
1497 1497
1498 public: 1498 public:
1499 - QPDF_DLL  
1500 - ~Members() = default;  
1501 -  
1502 - private:  
1503 Members(); 1499 Members();
1504 Members(Members const&) = delete; 1500 Members(Members const&) = delete;
  1501 + ~Members() = default;
1505 1502
  1503 + private:
1506 std::shared_ptr<QPDFLogger> log; 1504 std::shared_ptr<QPDFLogger> log;
1507 unsigned long long unique_id{0}; 1505 unsigned long long unique_id{0};
1508 QPDFTokenizer tokenizer; 1506 QPDFTokenizer tokenizer;
@@ -1577,7 +1575,7 @@ class QPDF @@ -1577,7 +1575,7 @@ class QPDF
1577 1575
1578 // Keep all member variables inside the Members object, which we dynamically allocate. This 1576 // Keep all member variables inside the Members object, which we dynamically allocate. This
1579 // makes it possible to add new private members without breaking binary compatibility. 1577 // makes it possible to add new private members without breaking binary compatibility.
1580 - std::shared_ptr<Members> m; 1578 + std::unique_ptr<Members> m;
1581 }; 1579 };
1582 1580
1583 #endif // QPDF_HH 1581 #endif // QPDF_HH
include/qpdf/QPDFAcroFormDocumentHelper.hh
@@ -20,6 +20,18 @@ @@ -20,6 +20,18 @@
20 #ifndef QPDFACROFORMDOCUMENTHELPER_HH 20 #ifndef QPDFACROFORMDOCUMENTHELPER_HH
21 #define QPDFACROFORMDOCUMENTHELPER_HH 21 #define QPDFACROFORMDOCUMENTHELPER_HH
22 22
  23 +#include <qpdf/QPDFDocumentHelper.hh>
  24 +
  25 +#include <qpdf/DLL.h>
  26 +
  27 +#include <qpdf/QPDFAnnotationObjectHelper.hh>
  28 +#include <qpdf/QPDFFormFieldObjectHelper.hh>
  29 +#include <qpdf/QPDFPageObjectHelper.hh>
  30 +
  31 +#include <map>
  32 +#include <set>
  33 +#include <vector>
  34 +
23 // This document helper is intended to help with operations on interactive forms. Here are the key 35 // This document helper is intended to help with operations on interactive forms. Here are the key
24 // things to know: 36 // things to know:
25 37
@@ -53,25 +65,12 @@ @@ -53,25 +65,12 @@
53 // under "/Fields" in the "/AcroForm" dictionary. In a more complex case, you may have to trace 65 // under "/Fields" in the "/AcroForm" dictionary. In a more complex case, you may have to trace
54 // through various "/Kids" elements in the "/AcroForm" field entry until you find the annotation 66 // through various "/Kids" elements in the "/AcroForm" field entry until you find the annotation
55 // dictionary. 67 // dictionary.
56 -  
57 -#include <qpdf/QPDFDocumentHelper.hh>  
58 -  
59 -#include <qpdf/DLL.h>  
60 -  
61 -#include <qpdf/QPDFAnnotationObjectHelper.hh>  
62 -#include <qpdf/QPDFFormFieldObjectHelper.hh>  
63 -#include <qpdf/QPDFPageObjectHelper.hh>  
64 -  
65 -#include <map>  
66 -#include <set>  
67 -#include <vector>  
68 -  
69 class QPDFAcroFormDocumentHelper: public QPDFDocumentHelper 68 class QPDFAcroFormDocumentHelper: public QPDFDocumentHelper
70 { 69 {
71 public: 70 public:
72 QPDF_DLL 71 QPDF_DLL
73 QPDFAcroFormDocumentHelper(QPDF&); 72 QPDFAcroFormDocumentHelper(QPDF&);
74 - QPDF_DLL 73 +
75 ~QPDFAcroFormDocumentHelper() override = default; 74 ~QPDFAcroFormDocumentHelper() override = default;
76 75
77 // This class lazily creates an internal cache of the mapping among form fields, annotations, 76 // This class lazily creates an internal cache of the mapping among form fields, annotations,
@@ -232,7 +231,6 @@ class QPDFAcroFormDocumentHelper: public QPDFDocumentHelper @@ -232,7 +231,6 @@ class QPDFAcroFormDocumentHelper: public QPDFDocumentHelper
232 friend class QPDFAcroFormDocumentHelper; 231 friend class QPDFAcroFormDocumentHelper;
233 232
234 public: 233 public:
235 - QPDF_DLL  
236 ~Members() = default; 234 ~Members() = default;
237 235
238 private: 236 private:
include/qpdf/QPDFAnnotationObjectHelper.hh
@@ -30,7 +30,7 @@ class QPDFAnnotationObjectHelper: public QPDFObjectHelper @@ -30,7 +30,7 @@ class QPDFAnnotationObjectHelper: public QPDFObjectHelper
30 public: 30 public:
31 QPDF_DLL 31 QPDF_DLL
32 QPDFAnnotationObjectHelper(QPDFObjectHandle); 32 QPDFAnnotationObjectHelper(QPDFObjectHandle);
33 - QPDF_DLL 33 +
34 ~QPDFAnnotationObjectHelper() override = default; 34 ~QPDFAnnotationObjectHelper() override = default;
35 35
36 // This class provides helper methods for annotations. More functionality will likely be added 36 // This class provides helper methods for annotations. More functionality will likely be added
@@ -92,7 +92,6 @@ class QPDFAnnotationObjectHelper: public QPDFObjectHelper @@ -92,7 +92,6 @@ class QPDFAnnotationObjectHelper: public QPDFObjectHelper
92 friend class QPDFAnnotationObjectHelper; 92 friend class QPDFAnnotationObjectHelper;
93 93
94 public: 94 public:
95 - QPDF_DLL  
96 ~Members() = default; 95 ~Members() = default;
97 96
98 private: 97 private:
include/qpdf/QPDFCryptoImpl.hh
@@ -32,40 +32,28 @@ @@ -32,40 +32,28 @@
32 // so, provide an implementation of QPDFCryptoImpl, ensure that you 32 // so, provide an implementation of QPDFCryptoImpl, ensure that you
33 // register it by calling QPDFCryptoProvider::registerImpl, and make 33 // register it by calling QPDFCryptoProvider::registerImpl, and make
34 // it the default by calling QPDFCryptoProvider::setDefaultProvider. 34 // it the default by calling QPDFCryptoProvider::setDefaultProvider.
35 -  
36 class QPDF_DLL_CLASS QPDFCryptoImpl 35 class QPDF_DLL_CLASS QPDFCryptoImpl
37 { 36 {
38 public: 37 public:
39 - QPDF_DLL  
40 QPDFCryptoImpl() = default; 38 QPDFCryptoImpl() = default;
41 39
42 - QPDF_DLL  
43 virtual ~QPDFCryptoImpl() = default; 40 virtual ~QPDFCryptoImpl() = default;
44 41
45 // Random Number Generation 42 // Random Number Generation
46 43
47 - QPDF_DLL  
48 virtual void provideRandomData(unsigned char* data, size_t len) = 0; 44 virtual void provideRandomData(unsigned char* data, size_t len) = 0;
49 45
50 // Hashing 46 // Hashing
51 47
52 typedef unsigned char MD5_Digest[16]; 48 typedef unsigned char MD5_Digest[16];
53 - QPDF_DLL  
54 virtual void MD5_init() = 0; 49 virtual void MD5_init() = 0;
55 - QPDF_DLL  
56 virtual void MD5_update(unsigned char const* data, size_t len) = 0; 50 virtual void MD5_update(unsigned char const* data, size_t len) = 0;
57 - QPDF_DLL  
58 virtual void MD5_finalize() = 0; 51 virtual void MD5_finalize() = 0;
59 - QPDF_DLL  
60 virtual void MD5_digest(MD5_Digest) = 0; 52 virtual void MD5_digest(MD5_Digest) = 0;
61 53
62 - QPDF_DLL  
63 virtual void SHA2_init(int bits) = 0; 54 virtual void SHA2_init(int bits) = 0;
64 - QPDF_DLL  
65 virtual void SHA2_update(unsigned char const* data, size_t len) = 0; 55 virtual void SHA2_update(unsigned char const* data, size_t len) = 0;
66 - QPDF_DLL  
67 virtual void SHA2_finalize() = 0; 56 virtual void SHA2_finalize() = 0;
68 - QPDF_DLL  
69 virtual std::string SHA2_digest() = 0; 57 virtual std::string SHA2_digest() = 0;
70 58
71 // Encryption/Decryption 59 // Encryption/Decryption
@@ -74,26 +62,20 @@ class QPDF_DLL_CLASS QPDFCryptoImpl @@ -74,26 +62,20 @@ class QPDF_DLL_CLASS QPDFCryptoImpl
74 // and readers. Search for RC4 in README.md 62 // and readers. Search for RC4 in README.md
75 63
76 // key_len of -1 means treat key_data as a null-terminated string 64 // key_len of -1 means treat key_data as a null-terminated string
77 - QPDF_DLL  
78 virtual void RC4_init(unsigned char const* key_data, int key_len = -1) = 0; 65 virtual void RC4_init(unsigned char const* key_data, int key_len = -1) = 0;
79 // out_data = 0 means to encrypt/decrypt in place 66 // out_data = 0 means to encrypt/decrypt in place
80 - QPDF_DLL  
81 virtual void 67 virtual void
82 RC4_process(unsigned char const* in_data, size_t len, unsigned char* out_data = nullptr) = 0; 68 RC4_process(unsigned char const* in_data, size_t len, unsigned char* out_data = nullptr) = 0;
83 - QPDF_DLL  
84 virtual void RC4_finalize() = 0; 69 virtual void RC4_finalize() = 0;
85 70
86 static size_t constexpr rijndael_buf_size = 16; 71 static size_t constexpr rijndael_buf_size = 16;
87 - QPDF_DLL  
88 virtual void rijndael_init( 72 virtual void rijndael_init(
89 bool encrypt, 73 bool encrypt,
90 unsigned char const* key_data, 74 unsigned char const* key_data,
91 size_t key_len, 75 size_t key_len,
92 bool cbc_mode, 76 bool cbc_mode,
93 unsigned char* cbc_block) = 0; 77 unsigned char* cbc_block) = 0;
94 - QPDF_DLL  
95 virtual void rijndael_process(unsigned char* in_data, unsigned char* out_data) = 0; 78 virtual void rijndael_process(unsigned char* in_data, unsigned char* out_data) = 0;
96 - QPDF_DLL  
97 virtual void rijndael_finalize() = 0; 79 virtual void rijndael_finalize() = 0;
98 }; 80 };
99 81
include/qpdf/QPDFCryptoProvider.hh
@@ -31,7 +31,6 @@ @@ -31,7 +31,6 @@
31 // This class is part of qpdf's pluggable crypto provider support. Most users won't need to know or 31 // This class is part of qpdf's pluggable crypto provider support. Most users won't need to know or
32 // care about this class, but you can use it if you want to supply your own crypto implementation. 32 // care about this class, but you can use it if you want to supply your own crypto implementation.
33 // See also comments in QPDFCryptoImpl.hh. 33 // See also comments in QPDFCryptoImpl.hh.
34 -  
35 class QPDFCryptoProvider 34 class QPDFCryptoProvider
36 { 35 {
37 public: 36 public:
@@ -92,7 +91,6 @@ class QPDFCryptoProvider @@ -92,7 +91,6 @@ class QPDFCryptoProvider
92 91
93 public: 92 public:
94 Members() = default; 93 Members() = default;
95 - QPDF_DLL  
96 ~Members() = default; 94 ~Members() = default;
97 95
98 private: 96 private:
include/qpdf/QPDFDocumentHelper.hh
@@ -30,28 +30,24 @@ @@ -30,28 +30,24 @@
30 // the underlying QPDF object unless there is a specific comment in a specific helper method that 30 // the underlying QPDF object unless there is a specific comment in a specific helper method that
31 // says otherwise. The pattern of using helper objects was introduced to allow creation of higher 31 // says otherwise. The pattern of using helper objects was introduced to allow creation of higher
32 // level helper functions without polluting the public interface of QPDF. 32 // level helper functions without polluting the public interface of QPDF.
33 -  
34 class QPDF_DLL_CLASS QPDFDocumentHelper 33 class QPDF_DLL_CLASS QPDFDocumentHelper
35 { 34 {
36 public: 35 public:
37 - QPDF_DLL  
38 QPDFDocumentHelper(QPDF& qpdf) : 36 QPDFDocumentHelper(QPDF& qpdf) :
39 qpdf(qpdf) 37 qpdf(qpdf)
40 { 38 {
41 } 39 }
42 QPDF_DLL 40 QPDF_DLL
43 virtual ~QPDFDocumentHelper(); 41 virtual ~QPDFDocumentHelper();
44 - QPDF_DLL  
45 QPDF& 42 QPDF&
46 getQPDF() 43 getQPDF()
47 { 44 {
48 - return this->qpdf; 45 + return qpdf;
49 } 46 }
50 - QPDF_DLL  
51 QPDF const& 47 QPDF const&
52 getQPDF() const 48 getQPDF() const
53 { 49 {
54 - return this->qpdf; 50 + return qpdf;
55 } 51 }
56 52
57 protected: 53 protected:
include/qpdf/QPDFEFStreamObjectHelper.hh
@@ -29,13 +29,12 @@ @@ -29,13 +29,12 @@
29 29
30 // This class provides a higher level interface around Embedded File Streams, which are discussed in 30 // This class provides a higher level interface around Embedded File Streams, which are discussed in
31 // section 7.11.4 of the ISO-32000 PDF specification. 31 // section 7.11.4 of the ISO-32000 PDF specification.
32 -  
33 class QPDFEFStreamObjectHelper: public QPDFObjectHelper 32 class QPDFEFStreamObjectHelper: public QPDFObjectHelper
34 { 33 {
35 public: 34 public:
36 QPDF_DLL 35 QPDF_DLL
37 QPDFEFStreamObjectHelper(QPDFObjectHandle); 36 QPDFEFStreamObjectHelper(QPDFObjectHandle);
38 - QPDF_DLL 37 +
39 ~QPDFEFStreamObjectHelper() override = default; 38 ~QPDFEFStreamObjectHelper() override = default;
40 39
41 // Date parameters are strings that conform to the PDF spec for date/time strings, which is 40 // Date parameters are strings that conform to the PDF spec for date/time strings, which is
@@ -98,7 +97,6 @@ class QPDFEFStreamObjectHelper: public QPDFObjectHelper @@ -98,7 +97,6 @@ class QPDFEFStreamObjectHelper: public QPDFObjectHelper
98 friend class QPDFEFStreamObjectHelper; 97 friend class QPDFEFStreamObjectHelper;
99 98
100 public: 99 public:
101 - QPDF_DLL  
102 ~Members() = default; 100 ~Members() = default;
103 101
104 private: 102 private:
include/qpdf/QPDFEmbeddedFileDocumentHelper.hh
@@ -33,13 +33,12 @@ @@ -33,13 +33,12 @@
33 // This class provides a higher level interface around document-level file attachments, also known 33 // This class provides a higher level interface around document-level file attachments, also known
34 // as embedded files. These are discussed in sections 7.7.4 and 7.11 of the ISO-32000 PDF 34 // as embedded files. These are discussed in sections 7.7.4 and 7.11 of the ISO-32000 PDF
35 // specification. 35 // specification.
36 -  
37 class QPDFEmbeddedFileDocumentHelper: public QPDFDocumentHelper 36 class QPDFEmbeddedFileDocumentHelper: public QPDFDocumentHelper
38 { 37 {
39 public: 38 public:
40 QPDF_DLL 39 QPDF_DLL
41 QPDFEmbeddedFileDocumentHelper(QPDF&); 40 QPDFEmbeddedFileDocumentHelper(QPDF&);
42 - QPDF_DLL 41 +
43 ~QPDFEmbeddedFileDocumentHelper() override = default; 42 ~QPDFEmbeddedFileDocumentHelper() override = default;
44 43
45 QPDF_DLL 44 QPDF_DLL
@@ -73,7 +72,6 @@ class QPDFEmbeddedFileDocumentHelper: public QPDFDocumentHelper @@ -73,7 +72,6 @@ class QPDFEmbeddedFileDocumentHelper: public QPDFDocumentHelper
73 friend class QPDFEmbeddedFileDocumentHelper; 72 friend class QPDFEmbeddedFileDocumentHelper;
74 73
75 public: 74 public:
76 - QPDF_DLL  
77 ~Members() = default; 75 ~Members() = default;
78 76
79 private: 77 private:
include/qpdf/QPDFExc.hh
@@ -37,7 +37,7 @@ class QPDF_DLL_CLASS QPDFExc: public std::runtime_error @@ -37,7 +37,7 @@ class QPDF_DLL_CLASS QPDFExc: public std::runtime_error
37 std::string const& object, 37 std::string const& object,
38 qpdf_offset_t offset, 38 qpdf_offset_t offset,
39 std::string const& message); 39 std::string const& message);
40 - QPDF_DLL 40 +
41 ~QPDFExc() noexcept override = default; 41 ~QPDFExc() noexcept override = default;
42 42
43 // To get a complete error string, call what(), provided by std::exception. The accessors below 43 // To get a complete error string, call what(), provided by std::exception. The accessors below
include/qpdf/QPDFFileSpecObjectHelper.hh
@@ -29,13 +29,12 @@ @@ -29,13 +29,12 @@
29 29
30 // This class provides a higher level interface around File Specification dictionaries, which are 30 // This class provides a higher level interface around File Specification dictionaries, which are
31 // discussed in section 7.11 of the ISO-32000 PDF specification. 31 // discussed in section 7.11 of the ISO-32000 PDF specification.
32 -  
33 class QPDFFileSpecObjectHelper: public QPDFObjectHelper 32 class QPDFFileSpecObjectHelper: public QPDFObjectHelper
34 { 33 {
35 public: 34 public:
36 QPDF_DLL 35 QPDF_DLL
37 QPDFFileSpecObjectHelper(QPDFObjectHandle); 36 QPDFFileSpecObjectHelper(QPDFObjectHandle);
38 - QPDF_DLL 37 +
39 ~QPDFFileSpecObjectHelper() override = default; 38 ~QPDFFileSpecObjectHelper() override = default;
40 39
41 QPDF_DLL 40 QPDF_DLL
@@ -93,7 +92,6 @@ class QPDFFileSpecObjectHelper: public QPDFObjectHelper @@ -93,7 +92,6 @@ class QPDFFileSpecObjectHelper: public QPDFObjectHelper
93 friend class QPDFFileSpecObjectHelper; 92 friend class QPDFFileSpecObjectHelper;
94 93
95 public: 94 public:
96 - QPDF_DLL  
97 ~Members() = default; 95 ~Members() = default;
98 96
99 private: 97 private:
include/qpdf/QPDFFormFieldObjectHelper.hh
@@ -20,9 +20,6 @@ @@ -20,9 +20,6 @@
20 #ifndef QPDFFORMFIELDOBJECTHELPER_HH 20 #ifndef QPDFFORMFIELDOBJECTHELPER_HH
21 #define QPDFFORMFIELDOBJECTHELPER_HH 21 #define QPDFFORMFIELDOBJECTHELPER_HH
22 22
23 -// This object helper helps with form fields for interactive forms. Please see comments in  
24 -// QPDFAcroFormDocumentHelper.hh for additional details.  
25 -  
26 #include <qpdf/QPDFObjectHelper.hh> 23 #include <qpdf/QPDFObjectHelper.hh>
27 24
28 #include <qpdf/DLL.h> 25 #include <qpdf/DLL.h>
@@ -30,6 +27,8 @@ @@ -30,6 +27,8 @@
30 27
31 class QPDFAnnotationObjectHelper; 28 class QPDFAnnotationObjectHelper;
32 29
  30 +// This object helper helps with form fields for interactive forms. Please see comments in
  31 +// QPDFAcroFormDocumentHelper.hh for additional details.
33 class QPDFFormFieldObjectHelper: public QPDFObjectHelper 32 class QPDFFormFieldObjectHelper: public QPDFObjectHelper
34 { 33 {
35 public: 34 public:
@@ -37,7 +36,7 @@ class QPDFFormFieldObjectHelper: public QPDFObjectHelper @@ -37,7 +36,7 @@ class QPDFFormFieldObjectHelper: public QPDFObjectHelper
37 QPDFFormFieldObjectHelper(); 36 QPDFFormFieldObjectHelper();
38 QPDF_DLL 37 QPDF_DLL
39 QPDFFormFieldObjectHelper(QPDFObjectHandle); 38 QPDFFormFieldObjectHelper(QPDFObjectHandle);
40 - QPDF_DLL 39 +
41 ~QPDFFormFieldObjectHelper() override = default; 40 ~QPDFFormFieldObjectHelper() override = default;
42 41
43 QPDF_DLL 42 QPDF_DLL
@@ -199,7 +198,6 @@ class QPDFFormFieldObjectHelper: public QPDFObjectHelper @@ -199,7 +198,6 @@ class QPDFFormFieldObjectHelper: public QPDFObjectHelper
199 friend class QPDFFormFieldObjectHelper; 198 friend class QPDFFormFieldObjectHelper;
200 199
201 public: 200 public:
202 - QPDF_DLL  
203 ~Members() = default; 201 ~Members() = default;
204 202
205 private: 203 private:
include/qpdf/QPDFLogger.hh
@@ -143,7 +143,6 @@ class QPDFLogger @@ -143,7 +143,6 @@ class QPDFLogger
143 friend class QPDFLogger; 143 friend class QPDFLogger;
144 144
145 public: 145 public:
146 - QPDF_DLL  
147 ~Members(); 146 ~Members();
148 147
149 private: 148 private:
include/qpdf/QPDFMatrix.hh
@@ -31,7 +31,6 @@ @@ -31,7 +31,6 @@
31 // (a, b, c, d, e, f) = โ”‚ c d 0 โ”‚ 31 // (a, b, c, d, e, f) = โ”‚ c d 0 โ”‚
32 // โ”‚ e f 1 โ”‚ 32 // โ”‚ e f 1 โ”‚
33 // โ”” โ”˜ 33 // โ”” โ”˜
34 -  
35 class QPDFMatrix 34 class QPDFMatrix
36 { 35 {
37 public: 36 public:
@@ -79,12 +78,9 @@ class QPDFMatrix @@ -79,12 +78,9 @@ class QPDFMatrix
79 // operator== tests for exact equality, not considering deltas for floating point. 78 // operator== tests for exact equality, not considering deltas for floating point.
80 QPDF_DLL 79 QPDF_DLL
81 bool operator==(QPDFMatrix const& rhs) const; 80 bool operator==(QPDFMatrix const& rhs) const;
  81 +
82 QPDF_DLL 82 QPDF_DLL
83 - bool  
84 - operator!=(QPDFMatrix const& rhs) const  
85 - {  
86 - return !operator==(rhs);  
87 - } 83 + bool operator!=(QPDFMatrix const& rhs) const;
88 84
89 double a; 85 double a;
90 double b; 86 double b;
include/qpdf/QPDFNameTreeObjectHelper.hh
@@ -28,16 +28,15 @@ @@ -28,16 +28,15 @@
28 28
29 #include <qpdf/DLL.h> 29 #include <qpdf/DLL.h>
30 30
31 -// This is an object helper for name trees. See section 7.9.6 in the PDF spec (ISO 32000) for a  
32 -// description of name trees. When looking up items in the name tree, use UTF-8 strings. All names  
33 -// are normalized for lookup purposes.  
34 -  
35 -// See examples/pdf-name-number-tree.cc for a demonstration of using QPDFNameTreeObjectHelper.  
36 -  
37 class NNTreeImpl; 31 class NNTreeImpl;
38 class NNTreeIterator; 32 class NNTreeIterator;
39 class NNTreeDetails; 33 class NNTreeDetails;
40 34
  35 +// This is an object helper for name trees. See section 7.9.6 in the PDF spec (ISO 32000) for a
  36 +// description of name trees. When looking up items in the name tree, use UTF-8 strings. All names
  37 +// are normalized for lookup purposes.
  38 +//
  39 +// See examples/pdf-name-number-tree.cc for a demonstration of using QPDFNameTreeObjectHelper.
41 class QPDF_DLL_CLASS QPDFNameTreeObjectHelper: public QPDFObjectHelper 40 class QPDF_DLL_CLASS QPDFNameTreeObjectHelper: public QPDFObjectHelper
42 { 41 {
43 public: 42 public:
@@ -78,7 +77,6 @@ class QPDF_DLL_CLASS QPDFNameTreeObjectHelper: public QPDFObjectHelper @@ -78,7 +77,6 @@ class QPDF_DLL_CLASS QPDFNameTreeObjectHelper: public QPDFObjectHelper
78 bool valid() const; 77 bool valid() const;
79 QPDF_DLL 78 QPDF_DLL
80 iterator& operator++(); 79 iterator& operator++();
81 - QPDF_DLL  
82 iterator 80 iterator
83 operator++(int) 81 operator++(int)
84 { 82 {
@@ -88,7 +86,6 @@ class QPDF_DLL_CLASS QPDFNameTreeObjectHelper: public QPDFObjectHelper @@ -88,7 +86,6 @@ class QPDF_DLL_CLASS QPDFNameTreeObjectHelper: public QPDFObjectHelper
88 } 86 }
89 QPDF_DLL 87 QPDF_DLL
90 iterator& operator--(); 88 iterator& operator--();
91 - QPDF_DLL  
92 iterator 89 iterator
93 operator--(int) 90 operator--(int)
94 { 91 {
@@ -102,7 +99,6 @@ class QPDF_DLL_CLASS QPDFNameTreeObjectHelper: public QPDFObjectHelper @@ -102,7 +99,6 @@ class QPDF_DLL_CLASS QPDFNameTreeObjectHelper: public QPDFObjectHelper
102 pointer operator->(); 99 pointer operator->();
103 QPDF_DLL 100 QPDF_DLL
104 bool operator==(iterator const& other) const; 101 bool operator==(iterator const& other) const;
105 - QPDF_DLL  
106 bool 102 bool
107 operator!=(iterator const& other) const 103 operator!=(iterator const& other) const
108 { 104 {
@@ -172,7 +168,6 @@ class QPDF_DLL_CLASS QPDFNameTreeObjectHelper: public QPDFObjectHelper @@ -172,7 +168,6 @@ class QPDF_DLL_CLASS QPDFNameTreeObjectHelper: public QPDFObjectHelper
172 friend class QPDFNameTreeObjectHelper; 168 friend class QPDFNameTreeObjectHelper;
173 169
174 public: 170 public:
175 - QPDF_DLL  
176 ~Members() = default; 171 ~Members() = default;
177 172
178 private: 173 private:
include/qpdf/QPDFNumberTreeObjectHelper.hh
@@ -27,15 +27,14 @@ @@ -27,15 +27,14 @@
27 27
28 #include <qpdf/DLL.h> 28 #include <qpdf/DLL.h>
29 29
30 -// This is an object helper for number trees. See section 7.9.7 in the PDF spec (ISO 32000) for a  
31 -// description of number trees.  
32 -  
33 -// See examples/pdf-name-number-tree.cc for a demonstration of using QPDFNumberTreeObjectHelper.  
34 -  
35 class NNTreeImpl; 30 class NNTreeImpl;
36 class NNTreeIterator; 31 class NNTreeIterator;
37 class NNTreeDetails; 32 class NNTreeDetails;
38 33
  34 +// This is an object helper for number trees. See section 7.9.7 in the PDF spec (ISO 32000) for a
  35 +// description of number trees.
  36 +//
  37 +// See examples/pdf-name-number-tree.cc for a demonstration of using QPDFNumberTreeObjectHelper.
39 class QPDF_DLL_CLASS QPDFNumberTreeObjectHelper: public QPDFObjectHelper 38 class QPDF_DLL_CLASS QPDFNumberTreeObjectHelper: public QPDFObjectHelper
40 { 39 {
41 public: 40 public:
@@ -93,7 +92,6 @@ class QPDF_DLL_CLASS QPDFNumberTreeObjectHelper: public QPDFObjectHelper @@ -93,7 +92,6 @@ class QPDF_DLL_CLASS QPDFNumberTreeObjectHelper: public QPDFObjectHelper
93 bool valid() const; 92 bool valid() const;
94 QPDF_DLL 93 QPDF_DLL
95 iterator& operator++(); 94 iterator& operator++();
96 - QPDF_DLL  
97 iterator 95 iterator
98 operator++(int) 96 operator++(int)
99 { 97 {
@@ -103,7 +101,6 @@ class QPDF_DLL_CLASS QPDFNumberTreeObjectHelper: public QPDFObjectHelper @@ -103,7 +101,6 @@ class QPDF_DLL_CLASS QPDFNumberTreeObjectHelper: public QPDFObjectHelper
103 } 101 }
104 QPDF_DLL 102 QPDF_DLL
105 iterator& operator--(); 103 iterator& operator--();
106 - QPDF_DLL  
107 iterator 104 iterator
108 operator--(int) 105 operator--(int)
109 { 106 {
@@ -117,7 +114,6 @@ class QPDF_DLL_CLASS QPDFNumberTreeObjectHelper: public QPDFObjectHelper @@ -117,7 +114,6 @@ class QPDF_DLL_CLASS QPDFNumberTreeObjectHelper: public QPDFObjectHelper
117 pointer operator->(); 114 pointer operator->();
118 QPDF_DLL 115 QPDF_DLL
119 bool operator==(iterator const& other) const; 116 bool operator==(iterator const& other) const;
120 - QPDF_DLL  
121 bool 117 bool
122 operator!=(iterator const& other) const 118 operator!=(iterator const& other) const
123 { 119 {
@@ -189,7 +185,6 @@ class QPDF_DLL_CLASS QPDFNumberTreeObjectHelper: public QPDFObjectHelper @@ -189,7 +185,6 @@ class QPDF_DLL_CLASS QPDFNumberTreeObjectHelper: public QPDFObjectHelper
189 typedef QPDFNumberTreeObjectHelper::numtree_number numtree_number; 185 typedef QPDFNumberTreeObjectHelper::numtree_number numtree_number;
190 186
191 public: 187 public:
192 - QPDF_DLL  
193 ~Members() = default; 188 ~Members() = default;
194 189
195 private: 190 private:
include/qpdf/QPDFObjGen.hh
@@ -35,57 +35,47 @@ class QPDFObjectHelper; @@ -35,57 +35,47 @@ class QPDFObjectHelper;
35 class QPDFObjGen 35 class QPDFObjGen
36 { 36 {
37 public: 37 public:
38 - QPDF_DLL  
39 QPDFObjGen() = default; 38 QPDFObjGen() = default;
40 - QPDF_DLL  
41 QPDFObjGen(int obj, int gen) : 39 QPDFObjGen(int obj, int gen) :
42 obj(obj), 40 obj(obj),
43 gen(gen) 41 gen(gen)
44 { 42 {
45 } 43 }
46 - QPDF_DLL  
47 bool 44 bool
48 operator<(QPDFObjGen const& rhs) const 45 operator<(QPDFObjGen const& rhs) const
49 { 46 {
50 return (obj < rhs.obj) || (obj == rhs.obj && gen < rhs.gen); 47 return (obj < rhs.obj) || (obj == rhs.obj && gen < rhs.gen);
51 } 48 }
52 - QPDF_DLL  
53 bool 49 bool
54 operator==(QPDFObjGen const& rhs) const 50 operator==(QPDFObjGen const& rhs) const
55 { 51 {
56 return obj == rhs.obj && gen == rhs.gen; 52 return obj == rhs.obj && gen == rhs.gen;
57 } 53 }
58 - QPDF_DLL  
59 bool 54 bool
60 operator!=(QPDFObjGen const& rhs) const 55 operator!=(QPDFObjGen const& rhs) const
61 { 56 {
62 return !(*this == rhs); 57 return !(*this == rhs);
63 } 58 }
64 - QPDF_DLL  
65 int 59 int
66 getObj() const 60 getObj() const
67 { 61 {
68 return obj; 62 return obj;
69 } 63 }
70 - QPDF_DLL  
71 int 64 int
72 getGen() const 65 getGen() const
73 { 66 {
74 return gen; 67 return gen;
75 } 68 }
76 - QPDF_DLL  
77 bool 69 bool
78 isIndirect() const 70 isIndirect() const
79 { 71 {
80 return obj != 0; 72 return obj != 0;
81 } 73 }
82 - QPDF_DLL  
83 std::string 74 std::string
84 unparse(char separator = ',') const 75 unparse(char separator = ',') const
85 { 76 {
86 return std::to_string(obj) + separator + std::to_string(gen); 77 return std::to_string(obj) + separator + std::to_string(gen);
87 } 78 }
88 - QPDF_DLL  
89 friend std::ostream& 79 friend std::ostream&
90 operator<<(std::ostream& os, QPDFObjGen og) 80 operator<<(std::ostream& os, QPDFObjGen og)
91 { 81 {
@@ -116,7 +106,6 @@ class QPDFObjGen @@ -116,7 +106,6 @@ class QPDFObjGen
116 public: 106 public:
117 // Add 'og' to the set. Return false if 'og' is already present in the set. Attempts to 107 // Add 'og' to the set. Return false if 'og' is already present in the set. Attempts to
118 // insert QPDFObjGen(0, 0) are ignored. 108 // insert QPDFObjGen(0, 0) are ignored.
119 - QPDF_DLL  
120 bool 109 bool
121 add(QPDFObjGen og) 110 add(QPDFObjGen og)
122 { 111 {
@@ -129,7 +118,6 @@ class QPDFObjGen @@ -129,7 +118,6 @@ class QPDFObjGen
129 return true; 118 return true;
130 } 119 }
131 120
132 - QPDF_DLL  
133 void 121 void
134 erase(QPDFObjGen og) 122 erase(QPDFObjGen og)
135 { 123 {
include/qpdf/QPDFObjectHandle.hh
@@ -156,9 +156,7 @@ class QPDFObjectHandle final: public qpdf::BaseHandle @@ -156,9 +156,7 @@ class QPDFObjectHandle final: public qpdf::BaseHandle
156 class QPDF_DLL_CLASS TokenFilter 156 class QPDF_DLL_CLASS TokenFilter
157 { 157 {
158 public: 158 public:
159 - QPDF_DLL  
160 TokenFilter() = default; 159 TokenFilter() = default;
161 - QPDF_DLL  
162 virtual ~TokenFilter() = default; 160 virtual ~TokenFilter() = default;
163 virtual void handleToken(QPDFTokenizer::Token const&) = 0; 161 virtual void handleToken(QPDFTokenizer::Token const&) = 0;
164 QPDF_DLL 162 QPDF_DLL
@@ -196,7 +194,6 @@ class QPDFObjectHandle final: public qpdf::BaseHandle @@ -196,7 +194,6 @@ class QPDFObjectHandle final: public qpdf::BaseHandle
196 class StringDecrypter 194 class StringDecrypter
197 { 195 {
198 public: 196 public:
199 - QPDF_DLL  
200 virtual ~StringDecrypter() = default; 197 virtual ~StringDecrypter() = default;
201 virtual void decryptString(std::string& val) = 0; 198 virtual void decryptString(std::string& val) = 0;
202 }; 199 };
@@ -206,7 +203,6 @@ class QPDFObjectHandle final: public qpdf::BaseHandle @@ -206,7 +203,6 @@ class QPDFObjectHandle final: public qpdf::BaseHandle
206 class QPDF_DLL_CLASS ParserCallbacks 203 class QPDF_DLL_CLASS ParserCallbacks
207 { 204 {
208 public: 205 public:
209 - QPDF_DLL  
210 virtual ~ParserCallbacks() = default; 206 virtual ~ParserCallbacks() = default;
211 // One of the handleObject methods must be overridden. 207 // One of the handleObject methods must be overridden.
212 QPDF_DLL 208 QPDF_DLL
@@ -286,18 +282,13 @@ class QPDFObjectHandle final: public qpdf::BaseHandle @@ -286,18 +282,13 @@ class QPDFObjectHandle final: public qpdf::BaseHandle
286 double f; 282 double f;
287 }; 283 };
288 284
289 - QPDF_DLL  
290 QPDFObjectHandle() = default; 285 QPDFObjectHandle() = default;
291 - QPDF_DLL  
292 QPDFObjectHandle(QPDFObjectHandle const&) = default; 286 QPDFObjectHandle(QPDFObjectHandle const&) = default;
293 - QPDF_DLL  
294 QPDFObjectHandle& operator=(QPDFObjectHandle const&) = default; 287 QPDFObjectHandle& operator=(QPDFObjectHandle const&) = default;
295 - QPDF_DLL  
296 QPDFObjectHandle(QPDFObjectHandle&&) = default; 288 QPDFObjectHandle(QPDFObjectHandle&&) = default;
297 - QPDF_DLL  
298 QPDFObjectHandle& operator=(QPDFObjectHandle&&) = default; 289 QPDFObjectHandle& operator=(QPDFObjectHandle&&) = default;
299 290
300 - [[deprecated("use operator bool()")]] QPDF_DLL inline bool isInitialized() const; 291 + [[deprecated("use operator bool()")]] inline bool isInitialized() const;
301 292
302 // This method returns true if the QPDFObjectHandle objects point to exactly the same underlying 293 // This method returns true if the QPDFObjectHandle objects point to exactly the same underlying
303 // object, meaning that changes to one are reflected in the other, or "if you paint one, the 294 // object, meaning that changes to one are reflected in the other, or "if you paint one, the
@@ -348,7 +339,7 @@ class QPDFObjectHandle final: public qpdf::BaseHandle @@ -348,7 +339,7 @@ class QPDFObjectHandle final: public qpdf::BaseHandle
348 339
349 // This returns true in addition to the query for the specific type for indirect objects. 340 // This returns true in addition to the query for the specific type for indirect objects.
350 QPDF_DLL 341 QPDF_DLL
351 - inline bool isIndirect() const; 342 + bool isIndirect() const;
352 343
353 // This returns true for indirect objects from a QPDF that has been destroyed. Trying unparse 344 // This returns true for indirect objects from a QPDF that has been destroyed. Trying unparse
354 // such an object will throw a logic_error. 345 // such an object will throw a logic_error.
@@ -1145,9 +1136,9 @@ class QPDFObjectHandle final: public qpdf::BaseHandle @@ -1145,9 +1136,9 @@ class QPDFObjectHandle final: public qpdf::BaseHandle
1145 QPDF_DLL 1136 QPDF_DLL
1146 QPDFObjGen getObjGen() const; 1137 QPDFObjGen getObjGen() const;
1147 QPDF_DLL 1138 QPDF_DLL
1148 - inline int getObjectID() const; 1139 + int getObjectID() const;
1149 QPDF_DLL 1140 QPDF_DLL
1150 - inline int getGeneration() const; 1141 + int getGeneration() const;
1151 1142
1152 QPDF_DLL 1143 QPDF_DLL
1153 std::string unparse() const; 1144 std::string unparse() const;
@@ -1424,11 +1415,9 @@ class QPDFObjectHandle::QPDFDictItems @@ -1424,11 +1415,9 @@ class QPDFObjectHandle::QPDFDictItems
1424 using pointer = T*; 1415 using pointer = T*;
1425 using reference = T&; 1416 using reference = T&;
1426 1417
1427 - QPDF_DLL  
1428 virtual ~iterator() = default; 1418 virtual ~iterator() = default;
1429 QPDF_DLL 1419 QPDF_DLL
1430 iterator& operator++(); 1420 iterator& operator++();
1431 - QPDF_DLL  
1432 iterator 1421 iterator
1433 operator++(int) 1422 operator++(int)
1434 { 1423 {
@@ -1438,7 +1427,6 @@ class QPDFObjectHandle::QPDFDictItems @@ -1438,7 +1427,6 @@ class QPDFObjectHandle::QPDFDictItems
1438 } 1427 }
1439 QPDF_DLL 1428 QPDF_DLL
1440 iterator& operator--(); 1429 iterator& operator--();
1441 - QPDF_DLL  
1442 iterator 1430 iterator
1443 operator--(int) 1431 operator--(int)
1444 { 1432 {
@@ -1452,7 +1440,6 @@ class QPDFObjectHandle::QPDFDictItems @@ -1452,7 +1440,6 @@ class QPDFObjectHandle::QPDFDictItems
1452 pointer operator->(); 1440 pointer operator->();
1453 QPDF_DLL 1441 QPDF_DLL
1454 bool operator==(iterator const& other) const; 1442 bool operator==(iterator const& other) const;
1455 - QPDF_DLL  
1456 bool 1443 bool
1457 operator!=(iterator const& other) const 1444 operator!=(iterator const& other) const
1458 { 1445 {
@@ -1468,7 +1455,6 @@ class QPDFObjectHandle::QPDFDictItems @@ -1468,7 +1455,6 @@ class QPDFObjectHandle::QPDFDictItems
1468 friend class QPDFDictItems::iterator; 1455 friend class QPDFDictItems::iterator;
1469 1456
1470 public: 1457 public:
1471 - QPDF_DLL  
1472 ~Members() = default; 1458 ~Members() = default;
1473 1459
1474 private: 1460 private:
@@ -1522,11 +1508,9 @@ class QPDFObjectHandle::QPDFArrayItems @@ -1522,11 +1508,9 @@ class QPDFObjectHandle::QPDFArrayItems
1522 using pointer = T*; 1508 using pointer = T*;
1523 using reference = T&; 1509 using reference = T&;
1524 1510
1525 - QPDF_DLL  
1526 virtual ~iterator() = default; 1511 virtual ~iterator() = default;
1527 QPDF_DLL 1512 QPDF_DLL
1528 iterator& operator++(); 1513 iterator& operator++();
1529 - QPDF_DLL  
1530 iterator 1514 iterator
1531 operator++(int) 1515 operator++(int)
1532 { 1516 {
@@ -1536,7 +1520,6 @@ class QPDFObjectHandle::QPDFArrayItems @@ -1536,7 +1520,6 @@ class QPDFObjectHandle::QPDFArrayItems
1536 } 1520 }
1537 QPDF_DLL 1521 QPDF_DLL
1538 iterator& operator--(); 1522 iterator& operator--();
1539 - QPDF_DLL  
1540 iterator 1523 iterator
1541 operator--(int) 1524 operator--(int)
1542 { 1525 {
@@ -1550,7 +1533,6 @@ class QPDFObjectHandle::QPDFArrayItems @@ -1550,7 +1533,6 @@ class QPDFObjectHandle::QPDFArrayItems
1550 pointer operator->(); 1533 pointer operator->();
1551 QPDF_DLL 1534 QPDF_DLL
1552 bool operator==(iterator const& other) const; 1535 bool operator==(iterator const& other) const;
1553 - QPDF_DLL  
1554 bool 1536 bool
1555 operator!=(iterator const& other) const 1537 operator!=(iterator const& other) const
1556 { 1538 {
@@ -1566,7 +1548,6 @@ class QPDFObjectHandle::QPDFArrayItems @@ -1566,7 +1548,6 @@ class QPDFObjectHandle::QPDFArrayItems
1566 friend class QPDFArrayItems::iterator; 1548 friend class QPDFArrayItems::iterator;
1567 1549
1568 public: 1550 public:
1569 - QPDF_DLL  
1570 ~Members() = default; 1551 ~Members() = default;
1571 1552
1572 private: 1553 private:
@@ -1607,24 +1588,6 @@ namespace qpdf @@ -1607,24 +1588,6 @@ namespace qpdf
1607 1588
1608 } // namespace qpdf 1589 } // namespace qpdf
1609 1590
1610 -inline int  
1611 -QPDFObjectHandle::getObjectID() const  
1612 -{  
1613 - return getObjGen().getObj();  
1614 -}  
1615 -  
1616 -inline int  
1617 -QPDFObjectHandle::getGeneration() const  
1618 -{  
1619 - return getObjGen().getGen();  
1620 -}  
1621 -  
1622 -inline bool  
1623 -QPDFObjectHandle::isIndirect() const  
1624 -{  
1625 - return (obj != nullptr) && (getObjectID() != 0);  
1626 -}  
1627 -  
1628 inline bool 1591 inline bool
1629 QPDFObjectHandle::isInitialized() const 1592 QPDFObjectHandle::isInitialized() const
1630 { 1593 {
include/qpdf/QPDFObjectHelper.hh
@@ -34,20 +34,17 @@ @@ -34,20 +34,17 @@
34 class QPDF_DLL_CLASS QPDFObjectHelper: public qpdf::BaseHandle 34 class QPDF_DLL_CLASS QPDFObjectHelper: public qpdf::BaseHandle
35 { 35 {
36 public: 36 public:
37 - QPDF_DLL  
38 QPDFObjectHelper(QPDFObjectHandle oh) : 37 QPDFObjectHelper(QPDFObjectHandle oh) :
39 qpdf::BaseHandle(oh.getObj()) 38 qpdf::BaseHandle(oh.getObj())
40 { 39 {
41 } 40 }
42 QPDF_DLL 41 QPDF_DLL
43 virtual ~QPDFObjectHelper(); 42 virtual ~QPDFObjectHelper();
44 - QPDF_DLL  
45 QPDFObjectHandle 43 QPDFObjectHandle
46 getObjectHandle() 44 getObjectHandle()
47 { 45 {
48 return {obj}; 46 return {obj};
49 } 47 }
50 - QPDF_DLL  
51 QPDFObjectHandle const 48 QPDFObjectHandle const
52 getObjectHandle() const 49 getObjectHandle() const
53 { 50 {
include/qpdf/QPDFOutlineDocumentHelper.hh
@@ -35,13 +35,12 @@ @@ -35,13 +35,12 @@
35 // section 12.3.3 of the PDF spec (ISO-32000). With the help of QPDFOutlineObjectHelper, the 35 // section 12.3.3 of the PDF spec (ISO-32000). With the help of QPDFOutlineObjectHelper, the
36 // outlines tree is traversed, and a bidirectional map is made between pages and outlines. See also 36 // outlines tree is traversed, and a bidirectional map is made between pages and outlines. See also
37 // QPDFOutlineObjectHelper. 37 // QPDFOutlineObjectHelper.
38 -  
39 class QPDFOutlineDocumentHelper: public QPDFDocumentHelper 38 class QPDFOutlineDocumentHelper: public QPDFDocumentHelper
40 { 39 {
41 public: 40 public:
42 QPDF_DLL 41 QPDF_DLL
43 QPDFOutlineDocumentHelper(QPDF&); 42 QPDFOutlineDocumentHelper(QPDF&);
44 - QPDF_DLL 43 +
45 ~QPDFOutlineDocumentHelper() override = default; 44 ~QPDFOutlineDocumentHelper() override = default;
46 45
47 QPDF_DLL 46 QPDF_DLL
@@ -79,7 +78,6 @@ class QPDFOutlineDocumentHelper: public QPDFDocumentHelper @@ -79,7 +78,6 @@ class QPDFOutlineDocumentHelper: public QPDFDocumentHelper
79 friend class QPDFOutlineDocumentHelper; 78 friend class QPDFOutlineDocumentHelper;
80 79
81 public: 80 public:
82 - QPDF_DLL  
83 ~Members() = default; 81 ~Members() = default;
84 82
85 private: 83 private:
include/qpdf/QPDFOutlineObjectHelper.hh
@@ -30,11 +30,9 @@ class QPDFOutlineDocumentHelper; @@ -30,11 +30,9 @@ class QPDFOutlineDocumentHelper;
30 30
31 // This is an object helper for outline items. Outlines, also known as bookmarks, are described in 31 // This is an object helper for outline items. Outlines, also known as bookmarks, are described in
32 // section 12.3.3 of the PDF spec (ISO-32000). See comments below for details. 32 // section 12.3.3 of the PDF spec (ISO-32000). See comments below for details.
33 -  
34 class QPDFOutlineObjectHelper: public QPDFObjectHelper 33 class QPDFOutlineObjectHelper: public QPDFObjectHelper
35 { 34 {
36 public: 35 public:
37 - QPDF_DLL  
38 ~QPDFOutlineObjectHelper() override 36 ~QPDFOutlineObjectHelper() override
39 { 37 {
40 // This must be cleared explicitly to avoid circular references that prevent cleanup of 38 // This must be cleared explicitly to avoid circular references that prevent cleanup of
@@ -87,7 +85,6 @@ class QPDFOutlineObjectHelper: public QPDFObjectHelper @@ -87,7 +85,6 @@ class QPDFOutlineObjectHelper: public QPDFObjectHelper
87 }; 85 };
88 86
89 private: 87 private:
90 - QPDF_DLL  
91 QPDFOutlineObjectHelper(QPDFObjectHandle, QPDFOutlineDocumentHelper&, int); 88 QPDFOutlineObjectHelper(QPDFObjectHandle, QPDFOutlineDocumentHelper&, int);
92 89
93 class Members 90 class Members
@@ -95,7 +92,6 @@ class QPDFOutlineObjectHelper: public QPDFObjectHelper @@ -95,7 +92,6 @@ class QPDFOutlineObjectHelper: public QPDFObjectHelper
95 friend class QPDFOutlineObjectHelper; 92 friend class QPDFOutlineObjectHelper;
96 93
97 public: 94 public:
98 - QPDF_DLL  
99 ~Members() = default; 95 ~Members() = default;
100 96
101 private: 97 private:
include/qpdf/QPDFPageDocumentHelper.hh
@@ -37,7 +37,7 @@ class QPDFPageDocumentHelper: public QPDFDocumentHelper @@ -37,7 +37,7 @@ class QPDFPageDocumentHelper: public QPDFDocumentHelper
37 public: 37 public:
38 QPDF_DLL 38 QPDF_DLL
39 QPDFPageDocumentHelper(QPDF&); 39 QPDFPageDocumentHelper(QPDF&);
40 - QPDF_DLL 40 +
41 ~QPDFPageDocumentHelper() override = default; 41 ~QPDFPageDocumentHelper() override = default;
42 42
43 // Traverse page tree, and return all /Page objects wrapped in QPDFPageObjectHelper objects. 43 // Traverse page tree, and return all /Page objects wrapped in QPDFPageObjectHelper objects.
@@ -117,7 +117,6 @@ class QPDFPageDocumentHelper: public QPDFDocumentHelper @@ -117,7 +117,6 @@ class QPDFPageDocumentHelper: public QPDFDocumentHelper
117 friend class QPDFPageDocumentHelper; 117 friend class QPDFPageDocumentHelper;
118 118
119 public: 119 public:
120 - QPDF_DLL  
121 ~Members() = default; 120 ~Members() = default;
122 121
123 private: 122 private:
include/qpdf/QPDFPageLabelDocumentHelper.hh
@@ -44,7 +44,7 @@ class QPDFPageLabelDocumentHelper: public QPDFDocumentHelper @@ -44,7 +44,7 @@ class QPDFPageLabelDocumentHelper: public QPDFDocumentHelper
44 public: 44 public:
45 QPDF_DLL 45 QPDF_DLL
46 QPDFPageLabelDocumentHelper(QPDF&); 46 QPDFPageLabelDocumentHelper(QPDF&);
47 - QPDF_DLL 47 +
48 ~QPDFPageLabelDocumentHelper() override = default; 48 ~QPDFPageLabelDocumentHelper() override = default;
49 49
50 QPDF_DLL 50 QPDF_DLL
@@ -82,7 +82,6 @@ class QPDFPageLabelDocumentHelper: public QPDFDocumentHelper @@ -82,7 +82,6 @@ class QPDFPageLabelDocumentHelper: public QPDFDocumentHelper
82 friend class QPDFPageLabelDocumentHelper; 82 friend class QPDFPageLabelDocumentHelper;
83 83
84 public: 84 public:
85 - QPDF_DLL  
86 ~Members() = default; 85 ~Members() = default;
87 86
88 private: 87 private:
include/qpdf/QPDFPageObjectHelper.hh
@@ -31,15 +31,14 @@ @@ -31,15 +31,14 @@
31 31
32 class QPDFAcroFormDocumentHelper; 32 class QPDFAcroFormDocumentHelper;
33 33
  34 +// This is a helper class for page objects, but as of qpdf 10.1, many of the methods also work
  35 +// for form XObjects. When this is the case, it is noted in the comment.
34 class QPDFPageObjectHelper: public QPDFObjectHelper 36 class QPDFPageObjectHelper: public QPDFObjectHelper
35 { 37 {
36 - // This is a helper class for page objects, but as of qpdf 10.1, many of the methods also work  
37 - // for form XObjects. When this is the case, it is noted in the comment.  
38 -  
39 public: 38 public:
40 QPDF_DLL 39 QPDF_DLL
41 QPDFPageObjectHelper(QPDFObjectHandle); 40 QPDFPageObjectHelper(QPDFObjectHandle);
42 - QPDF_DLL 41 +
43 ~QPDFPageObjectHelper() override = default; 42 ~QPDFPageObjectHelper() override = default;
44 43
45 // PAGE ATTRIBUTES 44 // PAGE ATTRIBUTES
@@ -411,7 +410,6 @@ class QPDFPageObjectHelper: public QPDFObjectHelper @@ -411,7 +410,6 @@ class QPDFPageObjectHelper: public QPDFObjectHelper
411 friend class QPDFPageObjectHelper; 410 friend class QPDFPageObjectHelper;
412 411
413 public: 412 public:
414 - QPDF_DLL  
415 ~Members() = default; 413 ~Members() = default;
416 414
417 private: 415 private:
include/qpdf/QPDFStreamFilter.hh
@@ -27,10 +27,8 @@ @@ -27,10 +27,8 @@
27 class QPDF_DLL_CLASS QPDFStreamFilter 27 class QPDF_DLL_CLASS QPDFStreamFilter
28 { 28 {
29 public: 29 public:
30 - QPDF_DLL  
31 QPDFStreamFilter() = default; 30 QPDFStreamFilter() = default;
32 31
33 - QPDF_DLL  
34 virtual ~QPDFStreamFilter() = default; 32 virtual ~QPDFStreamFilter() = default;
35 33
36 // A QPDFStreamFilter class must implement, at a minimum, setDecodeParms() and 34 // A QPDFStreamFilter class must implement, at a minimum, setDecodeParms() and
include/qpdf/QPDFSystemError.hh
@@ -32,7 +32,7 @@ class QPDF_DLL_CLASS QPDFSystemError: public std::runtime_error @@ -32,7 +32,7 @@ class QPDF_DLL_CLASS QPDFSystemError: public std::runtime_error
32 public: 32 public:
33 QPDF_DLL 33 QPDF_DLL
34 QPDFSystemError(std::string const& description, int system_errno); 34 QPDFSystemError(std::string const& description, int system_errno);
35 - QPDF_DLL 35 +
36 ~QPDFSystemError() noexcept override = default; 36 ~QPDFSystemError() noexcept override = default;
37 37
38 // To get a complete error string, call what(), provided by std::exception. The accessors below 38 // To get a complete error string, call what(), provided by std::exception. The accessors below
include/qpdf/QPDFUsage.hh
@@ -30,7 +30,6 @@ class QPDF_DLL_CLASS QPDFUsage: public std::runtime_error @@ -30,7 +30,6 @@ class QPDF_DLL_CLASS QPDFUsage: public std::runtime_error
30 public: 30 public:
31 QPDF_DLL 31 QPDF_DLL
32 QPDFUsage(std::string const& msg); 32 QPDFUsage(std::string const& msg);
33 - QPDF_DLL  
34 ~QPDFUsage() noexcept override = default; 33 ~QPDFUsage() noexcept override = default;
35 }; 34 };
36 35
include/qpdf/QPDFWriter.hh
@@ -17,9 +17,6 @@ @@ -17,9 +17,6 @@
17 // License. At your option, you may continue to consider qpdf to be licensed under those terms. 17 // License. At your option, you may continue to consider qpdf to be licensed under those terms.
18 // Please see the manual for additional information. 18 // Please see the manual for additional information.
19 19
20 -// This class implements a simple writer for saving QPDF objects to new PDF files. See comments  
21 -// through the header file for additional details.  
22 -  
23 #ifndef QPDFWRITER_HH 20 #ifndef QPDFWRITER_HH
24 #define QPDFWRITER_HH 21 #define QPDFWRITER_HH
25 22
@@ -51,6 +48,8 @@ class QPDF; @@ -51,6 +48,8 @@ class QPDF;
51 class Pl_Count; 48 class Pl_Count;
52 class Pl_MD5; 49 class Pl_MD5;
53 50
  51 +// This class implements a simple writer for saving QPDF objects to new PDF files. See comments
  52 +// through the header file for additional details.
54 class QPDFWriter 53 class QPDFWriter
55 { 54 {
56 public: 55 public:
@@ -71,7 +70,6 @@ class QPDFWriter @@ -71,7 +70,6 @@ class QPDFWriter
71 QPDF_DLL 70 QPDF_DLL
72 QPDFWriter(QPDF& pdf, char const* description, FILE* file, bool close_file); 71 QPDFWriter(QPDF& pdf, char const* description, FILE* file, bool close_file);
73 72
74 - QPDF_DLL  
75 ~QPDFWriter() = default; 73 ~QPDFWriter() = default;
76 74
77 class QPDF_DLL_CLASS ProgressReporter 75 class QPDF_DLL_CLASS ProgressReporter
include/qpdf/QPDFXRefEntry.hh
@@ -37,14 +37,12 @@ class QPDFXRefEntry @@ -37,14 +37,12 @@ class QPDFXRefEntry
37 QPDF_DLL 37 QPDF_DLL
38 QPDFXRefEntry(int type, qpdf_offset_t field1, int field2); 38 QPDFXRefEntry(int type, qpdf_offset_t field1, int field2);
39 // Create a type 1 "uncompressed" entry. 39 // Create a type 1 "uncompressed" entry.
40 - QPDF_DLL  
41 QPDFXRefEntry(qpdf_offset_t offset) : 40 QPDFXRefEntry(qpdf_offset_t offset) :
42 type(1), 41 type(1),
43 field1(offset) 42 field1(offset)
44 { 43 {
45 } 44 }
46 // Create a type 2 "compressed" entry. 45 // Create a type 2 "compressed" entry.
47 - QPDF_DLL  
48 QPDFXRefEntry(int stream_number, int index) : 46 QPDFXRefEntry(int stream_number, int index) :
49 type(2), 47 type(2),
50 field1(stream_number), 48 field1(stream_number),
libqpdf/FileInputSource.cc
@@ -5,12 +5,6 @@ @@ -5,12 +5,6 @@
5 #include <algorithm> 5 #include <algorithm>
6 #include <cstring> 6 #include <cstring>
7 7
8 -FileInputSource::FileInputSource() :  
9 - close_file(false),  
10 - file(nullptr)  
11 -{  
12 -}  
13 -  
14 FileInputSource::FileInputSource(char const* filename) : 8 FileInputSource::FileInputSource(char const* filename) :
15 close_file(true), 9 close_file(true),
16 filename(filename), 10 filename(filename),
libqpdf/PDFVersion.cc
@@ -2,11 +2,6 @@ @@ -2,11 +2,6 @@
2 2
3 #include <qpdf/QUtil.hh> 3 #include <qpdf/QUtil.hh>
4 4
5 -PDFVersion::PDFVersion() :  
6 - PDFVersion(0, 0, 0)  
7 -{  
8 -}  
9 -  
10 PDFVersion::PDFVersion(int major_version, int minor_version, int extension_level) : 5 PDFVersion::PDFVersion(int major_version, int minor_version, int extension_level) :
11 major_version(major_version), 6 major_version(major_version),
12 minor_version(minor_version), 7 minor_version(minor_version),
libqpdf/Pl_Buffer.cc
@@ -5,16 +5,24 @@ @@ -5,16 +5,24 @@
5 #include <cstring> 5 #include <cstring>
6 #include <stdexcept> 6 #include <stdexcept>
7 7
  8 +class Pl_Buffer::Members
  9 +{
  10 + public:
  11 + Members() = default;
  12 + Members(Members const&) = delete;
  13 +
  14 + bool ready{true};
  15 + std::string data;
  16 +};
  17 +
8 Pl_Buffer::Pl_Buffer(char const* identifier, Pipeline* next) : 18 Pl_Buffer::Pl_Buffer(char const* identifier, Pipeline* next) :
9 Pipeline(identifier, next), 19 Pipeline(identifier, next),
10 - m(new Members()) 20 + m(std::make_unique<Members>())
11 { 21 {
12 } 22 }
13 23
14 -Pl_Buffer::~Pl_Buffer() // NOLINT (modernize-use-equals-default)  
15 -{  
16 - // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer  
17 -} 24 +// Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
  25 +Pl_Buffer::~Pl_Buffer() = default;
18 26
19 void 27 void
20 Pl_Buffer::write(unsigned char const* buf, size_t len) 28 Pl_Buffer::write(unsigned char const* buf, size_t len)
libqpdf/Pl_Concatenate.cc
@@ -10,10 +10,8 @@ Pl_Concatenate::Pl_Concatenate(char const* identifier, Pipeline* next) : @@ -10,10 +10,8 @@ Pl_Concatenate::Pl_Concatenate(char const* identifier, Pipeline* next) :
10 } 10 }
11 } 11 }
12 12
13 -Pl_Concatenate::~Pl_Concatenate() // NOLINT (modernize-use-equals-default)  
14 -{  
15 - // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer  
16 -} 13 +// Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
  14 +Pl_Concatenate::~Pl_Concatenate() = default;
17 15
18 void 16 void
19 Pl_Concatenate::write(unsigned char const* data, size_t len) 17 Pl_Concatenate::write(unsigned char const* data, size_t len)
libqpdf/Pl_Count.cc
@@ -2,13 +2,21 @@ @@ -2,13 +2,21 @@
2 2
3 #include <qpdf/QIntC.hh> 3 #include <qpdf/QIntC.hh>
4 4
5 -Pl_Count::Members::Members() 5 +class Pl_Count::Members
6 { 6 {
7 -} 7 + public:
  8 + Members() = default;
  9 + Members(Members const&) = delete;
  10 + ~Members() = default;
  11 +
  12 + // Must be qpdf_offset_t, not size_t, to handle writing more than size_t can handle.
  13 + qpdf_offset_t count{0};
  14 + unsigned char last_char{'\0'};
  15 +};
8 16
9 Pl_Count::Pl_Count(char const* identifier, Pipeline* next) : 17 Pl_Count::Pl_Count(char const* identifier, Pipeline* next) :
10 Pipeline(identifier, next), 18 Pipeline(identifier, next),
11 - m(new Members()) 19 + m(std::make_unique<Members>())
12 { 20 {
13 if (!next) { 21 if (!next) {
14 throw std::logic_error("Attempt to create Pl_Count with nullptr as next"); 22 throw std::logic_error("Attempt to create Pl_Count with nullptr as next");
libqpdf/Pl_DCT.cc
@@ -57,31 +57,52 @@ progress_monitor(j_common_ptr cinfo) @@ -57,31 +57,52 @@ progress_monitor(j_common_ptr cinfo)
57 } 57 }
58 } 58 }
59 59
60 -Pl_DCT::Members::Members() :  
61 - action(a_decompress),  
62 - buf("DCT compressed image") 60 +class Pl_DCT::Members
63 { 61 {
64 -} 62 + public:
  63 + // For compression
  64 + Members(
  65 + JDIMENSION image_width,
  66 + JDIMENSION image_height,
  67 + int components,
  68 + J_COLOR_SPACE color_space,
  69 + CompressConfig* config_callback) :
  70 + action(a_compress),
  71 + buf("DCT uncompressed image"),
  72 + image_width(image_width),
  73 + image_height(image_height),
  74 + components(components),
  75 + color_space(color_space),
  76 + config_callback(config_callback)
  77 + {
  78 + }
65 79
66 -Pl_DCT::Members::Members(  
67 - JDIMENSION image_width,  
68 - JDIMENSION image_height,  
69 - int components,  
70 - J_COLOR_SPACE color_space,  
71 - CompressConfig* config_callback) :  
72 - action(a_compress),  
73 - buf("DCT uncompressed image"),  
74 - image_width(image_width),  
75 - image_height(image_height),  
76 - components(components),  
77 - color_space(color_space),  
78 - config_callback(config_callback)  
79 -{  
80 -} 80 + // For decompression
  81 + Members() :
  82 + action(a_decompress),
  83 + buf("DCT compressed image")
  84 + {
  85 + }
  86 +
  87 + Members(Members const&) = delete;
  88 +
  89 + ~Members() = default;
  90 +
  91 + action_e action;
  92 + Pl_Buffer buf;
  93 +
  94 + // Used for compression
  95 + JDIMENSION image_width{0};
  96 + JDIMENSION image_height{0};
  97 + int components{1};
  98 + J_COLOR_SPACE color_space{JCS_GRAYSCALE};
  99 +
  100 + CompressConfig* config_callback{nullptr};
  101 +};
81 102
82 Pl_DCT::Pl_DCT(char const* identifier, Pipeline* next) : 103 Pl_DCT::Pl_DCT(char const* identifier, Pipeline* next) :
83 Pipeline(identifier, next), 104 Pipeline(identifier, next),
84 - m(new Members()) 105 + m(std::make_unique<Members>())
85 { 106 {
86 if (!next) { 107 if (!next) {
87 throw std::logic_error("Attempt to create Pl_DCT with nullptr as next"); 108 throw std::logic_error("Attempt to create Pl_DCT with nullptr as next");
@@ -115,14 +136,13 @@ Pl_DCT::Pl_DCT( @@ -115,14 +136,13 @@ Pl_DCT::Pl_DCT(
115 J_COLOR_SPACE color_space, 136 J_COLOR_SPACE color_space,
116 CompressConfig* compress_callback) : 137 CompressConfig* compress_callback) :
117 Pipeline(identifier, next), 138 Pipeline(identifier, next),
118 - m(new Members(image_width, image_height, components, color_space, compress_callback)) 139 + m(std::make_unique<Members>(
  140 + image_width, image_height, components, color_space, compress_callback))
119 { 141 {
120 } 142 }
121 143
122 -Pl_DCT::~Pl_DCT() // NOLINT (modernize-use-equals-default)  
123 -{  
124 - // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer  
125 -} 144 +// Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
  145 +Pl_DCT::~Pl_DCT() = default;
126 146
127 void 147 void
128 Pl_DCT::write(unsigned char const* data, size_t len) 148 Pl_DCT::write(unsigned char const* data, size_t len)
libqpdf/Pl_Discard.cc
@@ -2,15 +2,16 @@ @@ -2,15 +2,16 @@
2 2
3 // Exercised in md5 test suite 3 // Exercised in md5 test suite
4 4
  5 +// Pl_Discard does not use the member pattern as thee is no prospect of it ever requiring data
  6 +// members.
  7 +
5 Pl_Discard::Pl_Discard() : 8 Pl_Discard::Pl_Discard() :
6 Pipeline("discard", nullptr) 9 Pipeline("discard", nullptr)
7 { 10 {
8 } 11 }
9 12
10 -Pl_Discard::~Pl_Discard() // NOLINT (modernize-use-equals-default)  
11 -{  
12 - // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer  
13 -} 13 +// Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
  14 +Pl_Discard::~Pl_Discard() = default;
14 15
15 void 16 void
16 Pl_Discard::write(unsigned char const* buf, size_t len) 17 Pl_Discard::write(unsigned char const* buf, size_t len)
libqpdf/Pl_Flate.cc
@@ -68,17 +68,15 @@ Pl_Flate::Members::~Members() @@ -68,17 +68,15 @@ Pl_Flate::Members::~Members()
68 Pl_Flate::Pl_Flate( 68 Pl_Flate::Pl_Flate(
69 char const* identifier, Pipeline* next, action_e action, unsigned int out_bufsize_int) : 69 char const* identifier, Pipeline* next, action_e action, unsigned int out_bufsize_int) :
70 Pipeline(identifier, next), 70 Pipeline(identifier, next),
71 - m(std::shared_ptr<Members>(new Members(QIntC::to_size(out_bufsize_int), action))) 71 + m(std::make_unique<Members>(QIntC::to_size(out_bufsize_int), action))
72 { 72 {
73 if (!next) { 73 if (!next) {
74 throw std::logic_error("Attempt to create Pl_Flate with nullptr as next"); 74 throw std::logic_error("Attempt to create Pl_Flate with nullptr as next");
75 } 75 }
76 } 76 }
77 77
78 -Pl_Flate::~Pl_Flate() // NOLINT (modernize-use-equals-default)  
79 -{  
80 - // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer  
81 -} 78 +// Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
  79 +Pl_Flate::~Pl_Flate() = default;
82 80
83 unsigned long long 81 unsigned long long
84 Pl_Flate::memory_limit() 82 Pl_Flate::memory_limit()
libqpdf/Pl_Function.cc
@@ -2,20 +2,28 @@ @@ -2,20 +2,28 @@
2 2
3 #include <stdexcept> 3 #include <stdexcept>
4 4
5 -Pl_Function::Members::Members(writer_t fn) :  
6 - fn(fn) 5 +class Pl_Function::Members
7 { 6 {
8 -} 7 + public:
  8 + Members(writer_t fn) :
  9 + fn(fn)
  10 + {
  11 + }
  12 + Members(Members const&) = delete;
  13 + ~Members() = default;
  14 +
  15 + writer_t fn;
  16 +};
9 17
10 Pl_Function::Pl_Function(char const* identifier, Pipeline* next, writer_t fn) : 18 Pl_Function::Pl_Function(char const* identifier, Pipeline* next, writer_t fn) :
11 Pipeline(identifier, next), 19 Pipeline(identifier, next),
12 - m(new Members(fn)) 20 + m(std::make_unique<Members>(fn))
13 { 21 {
14 } 22 }
15 23
16 Pl_Function::Pl_Function(char const* identifier, Pipeline* next, writer_c_t fn, void* udata) : 24 Pl_Function::Pl_Function(char const* identifier, Pipeline* next, writer_c_t fn, void* udata) :
17 Pipeline(identifier, next), 25 Pipeline(identifier, next),
18 - m(new Members(nullptr)) 26 + m(std::make_unique<Members>(nullptr))
19 { 27 {
20 m->fn = [identifier, fn, udata](unsigned char const* data, size_t len) { 28 m->fn = [identifier, fn, udata](unsigned char const* data, size_t len) {
21 int code = fn(data, len, udata); 29 int code = fn(data, len, udata);
libqpdf/Pl_OStream.cc
@@ -2,21 +2,27 @@ @@ -2,21 +2,27 @@
2 2
3 #include <stdexcept> 3 #include <stdexcept>
4 4
5 -Pl_OStream::Members::Members(std::ostream& os) :  
6 - os(os) 5 +class Pl_OStream::Members
7 { 6 {
8 -} 7 + public:
  8 + Members(std::ostream& os) :
  9 + os(os)
  10 + {
  11 + }
  12 + Members(Members const&) = delete;
  13 + ~Members() = default;
  14 +
  15 + std::ostream& os;
  16 +};
9 17
10 Pl_OStream::Pl_OStream(char const* identifier, std::ostream& os) : 18 Pl_OStream::Pl_OStream(char const* identifier, std::ostream& os) :
11 Pipeline(identifier, nullptr), 19 Pipeline(identifier, nullptr),
12 - m(new Members(os)) 20 + m(std::make_unique<Members>(os))
13 { 21 {
14 } 22 }
15 23
16 -Pl_OStream::~Pl_OStream() // NOLINT (modernize-use-equals-default)  
17 -{  
18 - // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer  
19 -} 24 +// Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
  25 +Pl_OStream::~Pl_OStream() = default;
20 26
21 void 27 void
22 Pl_OStream::write(unsigned char const* buf, size_t len) 28 Pl_OStream::write(unsigned char const* buf, size_t len)
libqpdf/Pl_QPDFTokenizer.cc
@@ -4,15 +4,22 @@ @@ -4,15 +4,22 @@
4 #include <qpdf/QTC.hh> 4 #include <qpdf/QTC.hh>
5 #include <stdexcept> 5 #include <stdexcept>
6 6
7 -Pl_QPDFTokenizer::Members::Members() :  
8 - buf("tokenizer buffer") 7 +class Pl_QPDFTokenizer::Members
9 { 8 {
10 -} 9 + public:
  10 + Members() = default;
  11 + Members(Members const&) = delete;
  12 + ~Members() = default;
  13 +
  14 + QPDFObjectHandle::TokenFilter* filter{nullptr};
  15 + QPDFTokenizer tokenizer;
  16 + Pl_Buffer buf{"tokenizer buffer"};
  17 +};
11 18
12 Pl_QPDFTokenizer::Pl_QPDFTokenizer( 19 Pl_QPDFTokenizer::Pl_QPDFTokenizer(
13 char const* identifier, QPDFObjectHandle::TokenFilter* filter, Pipeline* next) : 20 char const* identifier, QPDFObjectHandle::TokenFilter* filter, Pipeline* next) :
14 Pipeline(identifier, next), 21 Pipeline(identifier, next),
15 - m(new Members) 22 + m(std::make_unique<Members>())
16 { 23 {
17 m->filter = filter; 24 m->filter = filter;
18 QPDFObjectHandle::TokenFilter::PipelineAccessor::setPipeline(m->filter, next); 25 QPDFObjectHandle::TokenFilter::PipelineAccessor::setPipeline(m->filter, next);
@@ -20,10 +27,8 @@ Pl_QPDFTokenizer::Pl_QPDFTokenizer( @@ -20,10 +27,8 @@ Pl_QPDFTokenizer::Pl_QPDFTokenizer(
20 m->tokenizer.includeIgnorable(); 27 m->tokenizer.includeIgnorable();
21 } 28 }
22 29
23 -Pl_QPDFTokenizer::~Pl_QPDFTokenizer() // NOLINT (modernize-use-equals-default)  
24 -{  
25 - // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer  
26 -} 30 +// Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
  31 +Pl_QPDFTokenizer::~Pl_QPDFTokenizer() = default;
27 32
28 void 33 void
29 Pl_QPDFTokenizer::write(unsigned char const* data, size_t len) 34 Pl_QPDFTokenizer::write(unsigned char const* data, size_t len)
libqpdf/Pl_RunLength.cc
@@ -8,14 +8,26 @@ namespace @@ -8,14 +8,26 @@ namespace
8 unsigned long long memory_limit{0}; 8 unsigned long long memory_limit{0};
9 } // namespace 9 } // namespace
10 10
11 -Pl_RunLength::Members::Members(action_e action) :  
12 - action(action) 11 +class Pl_RunLength::Members
13 { 12 {
14 -} 13 + public:
  14 + Members(action_e action) :
  15 + action(action)
  16 + {
  17 + }
  18 + Members(Members const&) = delete;
  19 + ~Members() = default;
  20 +
  21 + action_e action;
  22 + state_e state{st_top};
  23 + unsigned char buf[128];
  24 + unsigned int length{0};
  25 + std::string out;
  26 +};
15 27
16 Pl_RunLength::Pl_RunLength(char const* identifier, Pipeline* next, action_e action) : 28 Pl_RunLength::Pl_RunLength(char const* identifier, Pipeline* next, action_e action) :
17 Pipeline(identifier, next), 29 Pipeline(identifier, next),
18 - m(new Members(action)) 30 + m(std::make_unique<Members>(action))
19 { 31 {
20 if (!next) { 32 if (!next) {
21 throw std::logic_error("Attempt to create Pl_RunLength with nullptr as next"); 33 throw std::logic_error("Attempt to create Pl_RunLength with nullptr as next");
libqpdf/Pl_StdioFile.cc
@@ -6,21 +6,27 @@ @@ -6,21 +6,27 @@
6 #include <cerrno> 6 #include <cerrno>
7 #include <stdexcept> 7 #include <stdexcept>
8 8
9 -Pl_StdioFile::Members::Members(FILE* f) :  
10 - file(f) 9 +class Pl_StdioFile::Members
11 { 10 {
12 -} 11 + public:
  12 + Members(FILE* f) :
  13 + file(f)
  14 + {
  15 + }
  16 + Members(Members const&) = delete;
  17 + ~Members() = default;
  18 +
  19 + FILE* file;
  20 +};
13 21
14 Pl_StdioFile::Pl_StdioFile(char const* identifier, FILE* f) : 22 Pl_StdioFile::Pl_StdioFile(char const* identifier, FILE* f) :
15 Pipeline(identifier, nullptr), 23 Pipeline(identifier, nullptr),
16 - m(new Members(f)) 24 + m(std::make_unique<Members>(f))
17 { 25 {
18 } 26 }
19 27
20 -Pl_StdioFile::~Pl_StdioFile() // NOLINT (modernize-use-equals-default)  
21 -{  
22 - // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer  
23 -} 28 +// Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
  29 +Pl_StdioFile::~Pl_StdioFile() = default;
24 30
25 void 31 void
26 Pl_StdioFile::write(unsigned char const* buf, size_t len) 32 Pl_StdioFile::write(unsigned char const* buf, size_t len)
libqpdf/Pl_String.cc
@@ -2,21 +2,27 @@ @@ -2,21 +2,27 @@
2 2
3 #include <stdexcept> 3 #include <stdexcept>
4 4
5 -Pl_String::Members::Members(std::string& s) :  
6 - s(s) 5 +class Pl_String::Members
7 { 6 {
8 -} 7 + public:
  8 + Members(std::string& s) :
  9 + s(s)
  10 + {
  11 + }
  12 + Members(Members const&) = delete;
  13 + ~Members() = default;
  14 +
  15 + std::string& s;
  16 +};
9 17
10 Pl_String::Pl_String(char const* identifier, Pipeline* next, std::string& s) : 18 Pl_String::Pl_String(char const* identifier, Pipeline* next, std::string& s) :
11 Pipeline(identifier, next), 19 Pipeline(identifier, next),
12 - m(new Members(s)) 20 + m(std::make_unique<Members>(s))
13 { 21 {
14 } 22 }
15 23
16 -Pl_String::~Pl_String() // NOLINT (modernize-use-equals-default)  
17 -{  
18 - // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer  
19 -} 24 +// Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
  25 +Pl_String::~Pl_String() = default;
20 26
21 void 27 void
22 Pl_String::write(unsigned char const* buf, size_t len) 28 Pl_String::write(unsigned char const* buf, size_t len)
libqpdf/QPDF.cc
@@ -200,7 +200,7 @@ QPDF::Members::Members() : @@ -200,7 +200,7 @@ QPDF::Members::Members() :
200 } 200 }
201 201
202 QPDF::QPDF() : 202 QPDF::QPDF() :
203 - m(new Members()) 203 + m(std::make_unique<Members>())
204 { 204 {
205 m->tokenizer.allowEOF(); 205 m->tokenizer.allowEOF();
206 // Generate a unique ID. It just has to be unique among all QPDF objects allocated throughout 206 // Generate a unique ID. It just has to be unique among all QPDF objects allocated throughout
libqpdf/QPDFMatrix.cc
@@ -138,3 +138,9 @@ QPDFMatrix::operator==(QPDFMatrix const&amp; rhs) const @@ -138,3 +138,9 @@ QPDFMatrix::operator==(QPDFMatrix const&amp; rhs) const
138 (this->a == rhs.a) && (this->b == rhs.b) && (this->c == rhs.c) && (this->d == rhs.d) && 138 (this->a == rhs.a) && (this->b == rhs.b) && (this->c == rhs.c) && (this->d == rhs.d) &&
139 (this->e == rhs.e) && (this->f == rhs.f)); 139 (this->e == rhs.e) && (this->f == rhs.f));
140 } 140 }
  141 +
  142 +bool
  143 +QPDFMatrix::operator!=(QPDFMatrix const& rhs) const
  144 +{
  145 + return !operator==(rhs);
  146 +}
libqpdf/QPDFObjectHandle.cc
@@ -2369,6 +2369,24 @@ QPDFObjectHandle::getObjGen() const @@ -2369,6 +2369,24 @@ QPDFObjectHandle::getObjGen() const
2369 return obj ? obj->getObjGen() : QPDFObjGen(); 2369 return obj ? obj->getObjGen() : QPDFObjGen();
2370 } 2370 }
2371 2371
  2372 +int
  2373 +QPDFObjectHandle::getObjectID() const
  2374 +{
  2375 + return getObjGen().getObj();
  2376 +}
  2377 +
  2378 +int
  2379 +QPDFObjectHandle::getGeneration() const
  2380 +{
  2381 + return getObjGen().getGen();
  2382 +}
  2383 +
  2384 +bool
  2385 +QPDFObjectHandle::isIndirect() const
  2386 +{
  2387 + return getObjectID() != 0;
  2388 +}
  2389 +
2372 // Indirect object accessors 2390 // Indirect object accessors
2373 QPDF* 2391 QPDF*
2374 QPDFObjectHandle::getOwningQPDF() const 2392 QPDFObjectHandle::getOwningQPDF() const
libqpdf/QPDFObjectHelper.cc
1 #include <qpdf/QPDFObjectHelper.hh> 1 #include <qpdf/QPDFObjectHelper.hh>
2 2
3 -QPDFObjectHelper::~QPDFObjectHelper() // NOLINT (modernize-use-equals-default)  
4 -{  
5 - // Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer  
6 -} 3 +// Must be explicit and not inline -- see QPDF_DLL_CLASS in README-maintainer
  4 +QPDFObjectHelper::~QPDFObjectHelper() = default;
qpdf/sizes.cc
@@ -108,7 +108,6 @@ main() @@ -108,7 +108,6 @@ main()
108 print_size(QPDFNameTreeObjectHelper::iterator); 108 print_size(QPDFNameTreeObjectHelper::iterator);
109 print_size(QPDFNumberTreeObjectHelper); 109 print_size(QPDFNumberTreeObjectHelper);
110 print_size(QPDFNumberTreeObjectHelper::iterator); 110 print_size(QPDFNumberTreeObjectHelper::iterator);
111 - print_size(QPDFObjGen);  
112 print_size(QPDFObjectHandle); 111 print_size(QPDFObjectHandle);
113 print_size(QPDFObjectHandle::ParserCallbacks); 112 print_size(QPDFObjectHandle::ParserCallbacks);
114 print_size(QPDFObjectHandle::QPDFArrayItems); 113 print_size(QPDFObjectHandle::QPDFArrayItems);
@@ -117,6 +116,7 @@ main() @@ -117,6 +116,7 @@ main()
117 print_size(QPDFObjectHandle::QPDFDictItems::iterator); 116 print_size(QPDFObjectHandle::QPDFDictItems::iterator);
118 print_size(QPDFObjectHandle::StreamDataProvider); 117 print_size(QPDFObjectHandle::StreamDataProvider);
119 print_size(QPDFObjectHandle::TokenFilter); 118 print_size(QPDFObjectHandle::TokenFilter);
  119 + print_size(QPDFObjectHelper);
120 print_size(QPDFOutlineDocumentHelper); 120 print_size(QPDFOutlineDocumentHelper);
121 print_size(QPDFOutlineObjectHelper); 121 print_size(QPDFOutlineObjectHelper);
122 print_size(QPDFPageDocumentHelper); 122 print_size(QPDFPageDocumentHelper);