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 46 QPDF_DLL
47 47 Buffer(std::string& content);
48 48  
  49 + Buffer(Buffer const&) = delete;
  50 + Buffer& operator=(Buffer const&) = delete;
  51 +
49 52 QPDF_DLL
50 53 Buffer(Buffer&&) noexcept;
51 54 QPDF_DLL
... ...
include/qpdf/ClosedFileInputSource.hh
... ... @@ -20,22 +20,25 @@
20 20 #ifndef QPDF_CLOSEDFILEINPUTSOURCE_HH
21 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 23 #include <qpdf/InputSource.hh>
29 24  
30 25 #include <memory>
31 26  
32 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 33 class QPDF_DLL_CLASS ClosedFileInputSource: public InputSource
35 34 {
36 35 public:
37 36 QPDF_DLL
38 37 ClosedFileInputSource(char const* filename);
  38 +
  39 + ClosedFileInputSource(ClosedFileInputSource const&) = delete;
  40 + ClosedFileInputSource& operator=(ClosedFileInputSource const&) = delete;
  41 +
39 42 QPDF_DLL
40 43 ~ClosedFileInputSource() override;
41 44 QPDF_DLL
... ... @@ -60,9 +63,6 @@ class QPDF_DLL_CLASS ClosedFileInputSource: public InputSource
60 63 void stayOpen(bool);
61 64  
62 65 private:
63   - ClosedFileInputSource(ClosedFileInputSource const&) = delete;
64   - ClosedFileInputSource& operator=(ClosedFileInputSource const&) = delete;
65   -
66 66 QPDF_DLL_PRIVATE
67 67 void before();
68 68 QPDF_DLL_PRIVATE
... ...
include/qpdf/FileInputSource.hh
... ... @@ -25,8 +25,7 @@
25 25 class QPDF_DLL_CLASS FileInputSource: public InputSource
26 26 {
27 27 public:
28   - QPDF_DLL
29   - FileInputSource();
  28 + FileInputSource() = default;
30 29 QPDF_DLL
31 30 FileInputSource(char const* filename);
32 31 QPDF_DLL
... ... @@ -35,6 +34,10 @@ class QPDF_DLL_CLASS FileInputSource: public InputSource
35 34 void setFilename(char const* filename);
36 35 QPDF_DLL
37 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 41 QPDF_DLL
39 42 ~FileInputSource() override;
40 43 QPDF_DLL
... ... @@ -53,12 +56,9 @@ class QPDF_DLL_CLASS FileInputSource: public InputSource
53 56 void unreadCh(char ch) override;
54 57  
55 58 private:
56   - FileInputSource(FileInputSource const&) = delete;
57   - FileInputSource& operator=(FileInputSource const&) = delete;
58   -
59   - bool close_file;
  59 + bool close_file{false};
60 60 std::string filename;
61   - FILE* file;
  61 + FILE* file{nullptr};
62 62 };
63 63  
64 64 #endif // QPDF_FILEINPUTSOURCE_HH
... ...
include/qpdf/InputSource.hh
... ... @@ -32,11 +32,8 @@
32 32 class QPDF_DLL_CLASS InputSource
33 33 {
34 34 public:
35   - QPDF_DLL
36   - InputSource()
37   - {
38   - }
39   - QPDF_DLL
  35 + InputSource() = default;
  36 +
40 37 virtual ~InputSource() = default;
41 38  
42 39 class QPDF_DLL_CLASS Finder
... ...
include/qpdf/JSON.hh
... ... @@ -20,15 +20,6 @@
20 20 #ifndef JSON_HH
21 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 23 #include <qpdf/DLL.h>
33 24 #include <qpdf/Types.h>
34 25  
... ... @@ -43,12 +34,19 @@
43 34 class Pipeline;
44 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 45 class JSON
47 46 {
48 47 public:
49 48 static int constexpr LATEST = 2;
50 49  
51   - QPDF_DLL
52 50 JSON() = default;
53 51  
54 52 QPDF_DLL
... ... @@ -147,6 +145,7 @@ class JSON
147 145 //
148 146 // - If argument is wrong type, including null, return false
149 147 // - If argument is right type, return true and initialize the value
  148 +
150 149 QPDF_DLL
151 150 bool getString(std::string& utf8) const;
152 151 QPDF_DLL
... ... @@ -210,7 +209,6 @@ class JSON
210 209 class QPDF_DLL_CLASS Reactor
211 210 {
212 211 public:
213   - QPDF_DLL
214 212 virtual ~Reactor() = default;
215 213  
216 214 // The start/end methods are called when parsing of a dictionary or array is started or
... ... @@ -377,7 +375,6 @@ class JSON
377 375 friend class JSON;
378 376  
379 377 public:
380   - QPDF_DLL
381 378 ~Members() = default;
382 379  
383 380 private:
... ...
include/qpdf/PDFVersion.hh
... ... @@ -23,18 +23,16 @@
23 23 #include <qpdf/DLL.h>
24 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 29 class PDFVersion
27 30 {
28 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 33 PDFVersion(PDFVersion const&) = default;
36   - QPDF_DLL
37 34 PDFVersion& operator=(PDFVersion const&) = default;
  35 +
38 36 QPDF_DLL
39 37 PDFVersion(int major, int minor, int extension = 0);
40 38 QPDF_DLL
... ... @@ -59,9 +57,9 @@ class PDFVersion
59 57 int getExtensionLevel() const;
60 58  
61 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 65 #endif // PDFVERSION_HH
... ...
include/qpdf/Pipeline.hh
... ... @@ -17,6 +17,14 @@
17 17 // License. At your option, you may continue to consider qpdf to be licensed under those terms.
18 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 28 // Generalized Pipeline interface. By convention, subclasses of Pipeline are called Pl_Something.
21 29 //
22 30 // When an instance of Pipeline is created with a pointer to a next pipeline, that pipeline writes
... ... @@ -32,15 +40,7 @@
32 40 // Some pipelines are reusable (i.e., you can call write() after calling finish() and can call
33 41 // finish() multiple times) while others are not. It is up to the caller to use a pipeline
34 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 44 // Remember to use QPDF_DLL_CLASS on anything derived from Pipeline so it will work with
45 45 // dynamic_cast across the shared object boundary.
46 46 class QPDF_DLL_CLASS Pipeline
... ... @@ -49,7 +49,6 @@ class QPDF_DLL_CLASS Pipeline
49 49 QPDF_DLL
50 50 Pipeline(char const* identifier, Pipeline* next);
51 51  
52   - QPDF_DLL
53 52 virtual ~Pipeline() = default;
54 53  
55 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 97 protected:
99 98 QPDF_DLL
100 99 Pipeline* getNext(bool allow_null = false);
101   - QPDF_DLL
  100 +
102 101 Pipeline*
103 102 next() const noexcept
104 103 {
... ...
include/qpdf/Pl_Buffer.hh
... ... @@ -20,6 +20,12 @@
20 20 #ifndef PL_BUFFER_HH
21 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 29 // This pipeline accumulates the data passed to it into a memory buffer. Each subsequent use of
24 30 // this buffer appends to the data accumulated so far. getBuffer() may be called only after calling
25 31 // finish() and before calling any subsequent write(). At that point, a dynamically allocated
... ... @@ -28,13 +34,6 @@
28 34 //
29 35 // For this pipeline, "next" may be null. If a next pointer is provided, this pipeline will also
30 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 37 class QPDF_DLL_CLASS Pl_Buffer: public Pipeline
39 38 {
40 39 public:
... ... @@ -69,23 +68,9 @@ class QPDF_DLL_CLASS Pl_Buffer: public Pipeline
69 68 std::string getString();
70 69  
71 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 76 #endif // PL_BUFFER_HH
... ...
include/qpdf/Pl_Concatenate.hh
... ... @@ -20,18 +20,18 @@
20 20 #ifndef PL_CONCATENATE_HH
21 21 #define PL_CONCATENATE_HH
22 22  
  23 +#include <qpdf/Pipeline.hh>
  24 +
23 25 // This pipeline will drop all regular finish calls rather than passing them onto next. To finish
24 26 // downstream streams, call manualFinish. This makes it possible to pipe multiple streams (e.g.
25 27 // with QPDFObjectHandle::pipeStreamData) to a downstream like Pl_Flate that can't handle multiple
26 28 // calls to finish().
27   -
28   -#include <qpdf/Pipeline.hh>
29   -
30 29 class QPDF_DLL_CLASS Pl_Concatenate: public Pipeline
31 30 {
32 31 public:
33 32 QPDF_DLL
34 33 Pl_Concatenate(char const* identifier, Pipeline* next);
  34 +
35 35 QPDF_DLL
36 36 ~Pl_Concatenate() override;
37 37  
... ... @@ -51,7 +51,6 @@ class QPDF_DLL_CLASS Pl_Concatenate: public Pipeline
51 51 friend class Pl_Concatenate;
52 52  
53 53 public:
54   - QPDF_DLL
55 54 ~Members() = default;
56 55  
57 56 private:
... ... @@ -59,7 +58,7 @@ class QPDF_DLL_CLASS Pl_Concatenate: public Pipeline
59 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 64 #endif // PL_CONCATENATE_HH
... ...
include/qpdf/Pl_Count.hh
... ... @@ -20,11 +20,10 @@
20 20 #ifndef PL_COUNT_HH
21 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 23 #include <qpdf/Pipeline.hh>
26 24 #include <qpdf/Types.h>
27 25  
  26 +// This pipeline is reusable; i.e., it is safe to call write() after calling finish().
28 27 class QPDF_DLL_CLASS Pl_Count: public Pipeline
29 28 {
30 29 public:
... ... @@ -45,24 +44,9 @@ class QPDF_DLL_CLASS Pl_Count: public Pipeline
45 44 unsigned char getLastChar() const;
46 45  
47 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 52 #endif // PL_COUNT_HH
... ...
include/qpdf/Pl_DCT.hh
... ... @@ -89,39 +89,9 @@ class QPDF_DLL_CLASS Pl_DCT: public Pipeline
89 89  
90 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 97 #endif // PL_DCT_HH
... ...
include/qpdf/Pl_Discard.hh
... ... @@ -20,12 +20,11 @@
20 20 #ifndef PL_DISCARD_HH
21 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 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 28 class QPDF_DLL_CLASS Pl_Discard: public Pipeline
30 29 {
31 30 public:
... ... @@ -37,22 +36,6 @@ class QPDF_DLL_CLASS Pl_Discard: public Pipeline
37 36 void write(unsigned char const*, size_t) override;
38 37 QPDF_DLL
39 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 41 #endif // PL_DISCARD_HH
... ...
include/qpdf/Pl_Flate.hh
... ... @@ -104,11 +104,10 @@ class QPDF_DLL_CLASS Pl_Flate: public Pipeline
104 104 friend class Pl_Flate;
105 105  
106 106 public:
107   - QPDF_DLL
  107 + Members(size_t out_bufsize, action_e action);
108 108 ~Members();
109 109  
110 110 private:
111   - Members(size_t out_bufsize, action_e action);
112 111 Members(Members const&) = delete;
113 112  
114 113 std::shared_ptr<unsigned char> outbuf;
... ... @@ -121,7 +120,7 @@ class QPDF_DLL_CLASS Pl_Flate: public Pipeline
121 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 126 #endif // PL_FLATE_HH
... ...
include/qpdf/Pl_Function.hh
... ... @@ -62,22 +62,9 @@ class QPDF_DLL_CLASS Pl_Function: public Pipeline
62 62 void finish() override;
63 63  
64 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 70 #endif // PL_FUNCTION_HH
... ...
include/qpdf/Pl_OStream.hh
... ... @@ -17,8 +17,6 @@
17 17 // License. At your option, you may continue to consider qpdf to be licensed under those terms.
18 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 20 #ifndef PL_OSTREAM_HH
23 21 #define PL_OSTREAM_HH
24 22  
... ... @@ -26,10 +24,9 @@
26 24  
27 25 #include <iostream>
28 26  
  27 +// End-of-line pipeline that simply writes its data to a stdio FILE* object.
29 28 //
30 29 // This pipeline is reusable.
31   -//
32   -
33 30 class QPDF_DLL_CLASS Pl_OStream: public Pipeline
34 31 {
35 32 public:
... ... @@ -45,22 +42,9 @@ class QPDF_DLL_CLASS Pl_OStream: public Pipeline
45 42 void finish() override;
46 43  
47 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 50 #endif // PL_OSTREAM_HH
... ...
include/qpdf/Pl_QPDFTokenizer.hh
... ... @@ -31,11 +31,10 @@
31 31 // Tokenize the incoming text using QPDFTokenizer and pass the tokens in turn to a
32 32 // QPDFObjectHandle::TokenFilter object. All bytes of incoming content will be included in exactly
33 33 // one token and passed downstream.
34   -
  34 +//
35 35 // This is a very low-level interface for working with token filters. Most code will want to use
36 36 // QPDFObjectHandle::filterPageContents or QPDFObjectHandle::addTokenFilter. See QPDFObjectHandle.hh
37 37 // for details.
38   -
39 38 class QPDF_DLL_CLASS Pl_QPDFTokenizer: public Pipeline
40 39 {
41 40 public:
... ... @@ -52,23 +51,9 @@ class QPDF_DLL_CLASS Pl_QPDFTokenizer: public Pipeline
52 51 void finish() override;
53 52  
54 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 59 #endif // PL_QPDFTOKENIZER_HH
... ...
include/qpdf/Pl_RunLength.hh
... ... @@ -52,26 +52,9 @@ class QPDF_DLL_CLASS Pl_RunLength: public Pipeline
52 52  
53 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 60 #endif // PL_RUNLENGTH_HH
... ...
include/qpdf/Pl_StdioFile.hh
... ... @@ -29,7 +29,6 @@
29 29 //
30 30 // This pipeline is reusable.
31 31 //
32   -
33 32 class QPDF_DLL_CLASS Pl_StdioFile: public Pipeline
34 33 {
35 34 public:
... ... @@ -45,22 +44,10 @@ class QPDF_DLL_CLASS Pl_StdioFile: public Pipeline
45 44 void finish() override;
46 45  
47 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 53 #endif // PL_STDIOFILE_HH
... ...
include/qpdf/Pl_String.hh
... ... @@ -20,6 +20,10 @@
20 20 #ifndef PL_STRING_HH
21 21 #define PL_STRING_HH
22 22  
  23 +#include <qpdf/Pipeline.hh>
  24 +
  25 +#include <string>
  26 +
23 27 // This pipeline accumulates the data passed to it into a std::string, a reference to which is
24 28 // passed in at construction. Each subsequent use of this pipeline appends to the data accumulated
25 29 // so far.
... ... @@ -31,11 +35,6 @@
31 35 // this in front of another pipeline to capture data that is written to the other pipeline without
32 36 // interfering with when finish is called on the other pipeline and without having to put a
33 37 // Pl_Concatenate after it.
34   -
35   -#include <qpdf/Pipeline.hh>
36   -
37   -#include <string>
38   -
39 38 class QPDF_DLL_CLASS Pl_String: public Pipeline
40 39 {
41 40 public:
... ... @@ -50,22 +49,9 @@ class QPDF_DLL_CLASS Pl_String: public Pipeline
50 49 void finish() override;
51 50  
52 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 57 #endif // PL_STRING_HH
... ...
include/qpdf/QPDF.hh
... ... @@ -1496,13 +1496,11 @@ class QPDF
1496 1496 friend class ResolveRecorder;
1497 1497  
1498 1498 public:
1499   - QPDF_DLL
1500   - ~Members() = default;
1501   -
1502   - private:
1503 1499 Members();
1504 1500 Members(Members const&) = delete;
  1501 + ~Members() = default;
1505 1502  
  1503 + private:
1506 1504 std::shared_ptr<QPDFLogger> log;
1507 1505 unsigned long long unique_id{0};
1508 1506 QPDFTokenizer tokenizer;
... ... @@ -1577,7 +1575,7 @@ class QPDF
1577 1575  
1578 1576 // Keep all member variables inside the Members object, which we dynamically allocate. This
1579 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 1581 #endif // QPDF_HH
... ...
include/qpdf/QPDFAcroFormDocumentHelper.hh
... ... @@ -20,6 +20,18 @@
20 20 #ifndef QPDFACROFORMDOCUMENTHELPER_HH
21 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 35 // This document helper is intended to help with operations on interactive forms. Here are the key
24 36 // things to know:
25 37  
... ... @@ -53,25 +65,12 @@
53 65 // under "/Fields" in the "/AcroForm" dictionary. In a more complex case, you may have to trace
54 66 // through various "/Kids" elements in the "/AcroForm" field entry until you find the annotation
55 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 68 class QPDFAcroFormDocumentHelper: public QPDFDocumentHelper
70 69 {
71 70 public:
72 71 QPDF_DLL
73 72 QPDFAcroFormDocumentHelper(QPDF&);
74   - QPDF_DLL
  73 +
75 74 ~QPDFAcroFormDocumentHelper() override = default;
76 75  
77 76 // This class lazily creates an internal cache of the mapping among form fields, annotations,
... ... @@ -232,7 +231,6 @@ class QPDFAcroFormDocumentHelper: public QPDFDocumentHelper
232 231 friend class QPDFAcroFormDocumentHelper;
233 232  
234 233 public:
235   - QPDF_DLL
236 234 ~Members() = default;
237 235  
238 236 private:
... ...
include/qpdf/QPDFAnnotationObjectHelper.hh
... ... @@ -30,7 +30,7 @@ class QPDFAnnotationObjectHelper: public QPDFObjectHelper
30 30 public:
31 31 QPDF_DLL
32 32 QPDFAnnotationObjectHelper(QPDFObjectHandle);
33   - QPDF_DLL
  33 +
34 34 ~QPDFAnnotationObjectHelper() override = default;
35 35  
36 36 // This class provides helper methods for annotations. More functionality will likely be added
... ... @@ -92,7 +92,6 @@ class QPDFAnnotationObjectHelper: public QPDFObjectHelper
92 92 friend class QPDFAnnotationObjectHelper;
93 93  
94 94 public:
95   - QPDF_DLL
96 95 ~Members() = default;
97 96  
98 97 private:
... ...
include/qpdf/QPDFCryptoImpl.hh
... ... @@ -32,40 +32,28 @@
32 32 // so, provide an implementation of QPDFCryptoImpl, ensure that you
33 33 // register it by calling QPDFCryptoProvider::registerImpl, and make
34 34 // it the default by calling QPDFCryptoProvider::setDefaultProvider.
35   -
36 35 class QPDF_DLL_CLASS QPDFCryptoImpl
37 36 {
38 37 public:
39   - QPDF_DLL
40 38 QPDFCryptoImpl() = default;
41 39  
42   - QPDF_DLL
43 40 virtual ~QPDFCryptoImpl() = default;
44 41  
45 42 // Random Number Generation
46 43  
47   - QPDF_DLL
48 44 virtual void provideRandomData(unsigned char* data, size_t len) = 0;
49 45  
50 46 // Hashing
51 47  
52 48 typedef unsigned char MD5_Digest[16];
53   - QPDF_DLL
54 49 virtual void MD5_init() = 0;
55   - QPDF_DLL
56 50 virtual void MD5_update(unsigned char const* data, size_t len) = 0;
57   - QPDF_DLL
58 51 virtual void MD5_finalize() = 0;
59   - QPDF_DLL
60 52 virtual void MD5_digest(MD5_Digest) = 0;
61 53  
62   - QPDF_DLL
63 54 virtual void SHA2_init(int bits) = 0;
64   - QPDF_DLL
65 55 virtual void SHA2_update(unsigned char const* data, size_t len) = 0;
66   - QPDF_DLL
67 56 virtual void SHA2_finalize() = 0;
68   - QPDF_DLL
69 57 virtual std::string SHA2_digest() = 0;
70 58  
71 59 // Encryption/Decryption
... ... @@ -74,26 +62,20 @@ class QPDF_DLL_CLASS QPDFCryptoImpl
74 62 // and readers. Search for RC4 in README.md
75 63  
76 64 // key_len of -1 means treat key_data as a null-terminated string
77   - QPDF_DLL
78 65 virtual void RC4_init(unsigned char const* key_data, int key_len = -1) = 0;
79 66 // out_data = 0 means to encrypt/decrypt in place
80   - QPDF_DLL
81 67 virtual void
82 68 RC4_process(unsigned char const* in_data, size_t len, unsigned char* out_data = nullptr) = 0;
83   - QPDF_DLL
84 69 virtual void RC4_finalize() = 0;
85 70  
86 71 static size_t constexpr rijndael_buf_size = 16;
87   - QPDF_DLL
88 72 virtual void rijndael_init(
89 73 bool encrypt,
90 74 unsigned char const* key_data,
91 75 size_t key_len,
92 76 bool cbc_mode,
93 77 unsigned char* cbc_block) = 0;
94   - QPDF_DLL
95 78 virtual void rijndael_process(unsigned char* in_data, unsigned char* out_data) = 0;
96   - QPDF_DLL
97 79 virtual void rijndael_finalize() = 0;
98 80 };
99 81  
... ...
include/qpdf/QPDFCryptoProvider.hh
... ... @@ -31,7 +31,6 @@
31 31 // This class is part of qpdf's pluggable crypto provider support. Most users won't need to know or
32 32 // care about this class, but you can use it if you want to supply your own crypto implementation.
33 33 // See also comments in QPDFCryptoImpl.hh.
34   -
35 34 class QPDFCryptoProvider
36 35 {
37 36 public:
... ... @@ -92,7 +91,6 @@ class QPDFCryptoProvider
92 91  
93 92 public:
94 93 Members() = default;
95   - QPDF_DLL
96 94 ~Members() = default;
97 95  
98 96 private:
... ...
include/qpdf/QPDFDocumentHelper.hh
... ... @@ -30,28 +30,24 @@
30 30 // the underlying QPDF object unless there is a specific comment in a specific helper method that
31 31 // says otherwise. The pattern of using helper objects was introduced to allow creation of higher
32 32 // level helper functions without polluting the public interface of QPDF.
33   -
34 33 class QPDF_DLL_CLASS QPDFDocumentHelper
35 34 {
36 35 public:
37   - QPDF_DLL
38 36 QPDFDocumentHelper(QPDF& qpdf) :
39 37 qpdf(qpdf)
40 38 {
41 39 }
42 40 QPDF_DLL
43 41 virtual ~QPDFDocumentHelper();
44   - QPDF_DLL
45 42 QPDF&
46 43 getQPDF()
47 44 {
48   - return this->qpdf;
  45 + return qpdf;
49 46 }
50   - QPDF_DLL
51 47 QPDF const&
52 48 getQPDF() const
53 49 {
54   - return this->qpdf;
  50 + return qpdf;
55 51 }
56 52  
57 53 protected:
... ...
include/qpdf/QPDFEFStreamObjectHelper.hh
... ... @@ -29,13 +29,12 @@
29 29  
30 30 // This class provides a higher level interface around Embedded File Streams, which are discussed in
31 31 // section 7.11.4 of the ISO-32000 PDF specification.
32   -
33 32 class QPDFEFStreamObjectHelper: public QPDFObjectHelper
34 33 {
35 34 public:
36 35 QPDF_DLL
37 36 QPDFEFStreamObjectHelper(QPDFObjectHandle);
38   - QPDF_DLL
  37 +
39 38 ~QPDFEFStreamObjectHelper() override = default;
40 39  
41 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 97 friend class QPDFEFStreamObjectHelper;
99 98  
100 99 public:
101   - QPDF_DLL
102 100 ~Members() = default;
103 101  
104 102 private:
... ...
include/qpdf/QPDFEmbeddedFileDocumentHelper.hh
... ... @@ -33,13 +33,12 @@
33 33 // This class provides a higher level interface around document-level file attachments, also known
34 34 // as embedded files. These are discussed in sections 7.7.4 and 7.11 of the ISO-32000 PDF
35 35 // specification.
36   -
37 36 class QPDFEmbeddedFileDocumentHelper: public QPDFDocumentHelper
38 37 {
39 38 public:
40 39 QPDF_DLL
41 40 QPDFEmbeddedFileDocumentHelper(QPDF&);
42   - QPDF_DLL
  41 +
43 42 ~QPDFEmbeddedFileDocumentHelper() override = default;
44 43  
45 44 QPDF_DLL
... ... @@ -73,7 +72,6 @@ class QPDFEmbeddedFileDocumentHelper: public QPDFDocumentHelper
73 72 friend class QPDFEmbeddedFileDocumentHelper;
74 73  
75 74 public:
76   - QPDF_DLL
77 75 ~Members() = default;
78 76  
79 77 private:
... ...
include/qpdf/QPDFExc.hh
... ... @@ -37,7 +37,7 @@ class QPDF_DLL_CLASS QPDFExc: public std::runtime_error
37 37 std::string const& object,
38 38 qpdf_offset_t offset,
39 39 std::string const& message);
40   - QPDF_DLL
  40 +
41 41 ~QPDFExc() noexcept override = default;
42 42  
43 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 29  
30 30 // This class provides a higher level interface around File Specification dictionaries, which are
31 31 // discussed in section 7.11 of the ISO-32000 PDF specification.
32   -
33 32 class QPDFFileSpecObjectHelper: public QPDFObjectHelper
34 33 {
35 34 public:
36 35 QPDF_DLL
37 36 QPDFFileSpecObjectHelper(QPDFObjectHandle);
38   - QPDF_DLL
  37 +
39 38 ~QPDFFileSpecObjectHelper() override = default;
40 39  
41 40 QPDF_DLL
... ... @@ -93,7 +92,6 @@ class QPDFFileSpecObjectHelper: public QPDFObjectHelper
93 92 friend class QPDFFileSpecObjectHelper;
94 93  
95 94 public:
96   - QPDF_DLL
97 95 ~Members() = default;
98 96  
99 97 private:
... ...
include/qpdf/QPDFFormFieldObjectHelper.hh
... ... @@ -20,9 +20,6 @@
20 20 #ifndef QPDFFORMFIELDOBJECTHELPER_HH
21 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 23 #include <qpdf/QPDFObjectHelper.hh>
27 24  
28 25 #include <qpdf/DLL.h>
... ... @@ -30,6 +27,8 @@
30 27  
31 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 32 class QPDFFormFieldObjectHelper: public QPDFObjectHelper
34 33 {
35 34 public:
... ... @@ -37,7 +36,7 @@ class QPDFFormFieldObjectHelper: public QPDFObjectHelper
37 36 QPDFFormFieldObjectHelper();
38 37 QPDF_DLL
39 38 QPDFFormFieldObjectHelper(QPDFObjectHandle);
40   - QPDF_DLL
  39 +
41 40 ~QPDFFormFieldObjectHelper() override = default;
42 41  
43 42 QPDF_DLL
... ... @@ -199,7 +198,6 @@ class QPDFFormFieldObjectHelper: public QPDFObjectHelper
199 198 friend class QPDFFormFieldObjectHelper;
200 199  
201 200 public:
202   - QPDF_DLL
203 201 ~Members() = default;
204 202  
205 203 private:
... ...
include/qpdf/QPDFLogger.hh
... ... @@ -143,7 +143,6 @@ class QPDFLogger
143 143 friend class QPDFLogger;
144 144  
145 145 public:
146   - QPDF_DLL
147 146 ~Members();
148 147  
149 148 private:
... ...
include/qpdf/QPDFMatrix.hh
... ... @@ -31,7 +31,6 @@
31 31 // (a, b, c, d, e, f) = โ”‚ c d 0 โ”‚
32 32 // โ”‚ e f 1 โ”‚
33 33 // โ”” โ”˜
34   -
35 34 class QPDFMatrix
36 35 {
37 36 public:
... ... @@ -79,12 +78,9 @@ class QPDFMatrix
79 78 // operator== tests for exact equality, not considering deltas for floating point.
80 79 QPDF_DLL
81 80 bool operator==(QPDFMatrix const& rhs) const;
  81 +
82 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 85 double a;
90 86 double b;
... ...
include/qpdf/QPDFNameTreeObjectHelper.hh
... ... @@ -28,16 +28,15 @@
28 28  
29 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 31 class NNTreeImpl;
38 32 class NNTreeIterator;
39 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 40 class QPDF_DLL_CLASS QPDFNameTreeObjectHelper: public QPDFObjectHelper
42 41 {
43 42 public:
... ... @@ -78,7 +77,6 @@ class QPDF_DLL_CLASS QPDFNameTreeObjectHelper: public QPDFObjectHelper
78 77 bool valid() const;
79 78 QPDF_DLL
80 79 iterator& operator++();
81   - QPDF_DLL
82 80 iterator
83 81 operator++(int)
84 82 {
... ... @@ -88,7 +86,6 @@ class QPDF_DLL_CLASS QPDFNameTreeObjectHelper: public QPDFObjectHelper
88 86 }
89 87 QPDF_DLL
90 88 iterator& operator--();
91   - QPDF_DLL
92 89 iterator
93 90 operator--(int)
94 91 {
... ... @@ -102,7 +99,6 @@ class QPDF_DLL_CLASS QPDFNameTreeObjectHelper: public QPDFObjectHelper
102 99 pointer operator->();
103 100 QPDF_DLL
104 101 bool operator==(iterator const& other) const;
105   - QPDF_DLL
106 102 bool
107 103 operator!=(iterator const& other) const
108 104 {
... ... @@ -172,7 +168,6 @@ class QPDF_DLL_CLASS QPDFNameTreeObjectHelper: public QPDFObjectHelper
172 168 friend class QPDFNameTreeObjectHelper;
173 169  
174 170 public:
175   - QPDF_DLL
176 171 ~Members() = default;
177 172  
178 173 private:
... ...
include/qpdf/QPDFNumberTreeObjectHelper.hh
... ... @@ -27,15 +27,14 @@
27 27  
28 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 30 class NNTreeImpl;
36 31 class NNTreeIterator;
37 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 38 class QPDF_DLL_CLASS QPDFNumberTreeObjectHelper: public QPDFObjectHelper
40 39 {
41 40 public:
... ... @@ -93,7 +92,6 @@ class QPDF_DLL_CLASS QPDFNumberTreeObjectHelper: public QPDFObjectHelper
93 92 bool valid() const;
94 93 QPDF_DLL
95 94 iterator& operator++();
96   - QPDF_DLL
97 95 iterator
98 96 operator++(int)
99 97 {
... ... @@ -103,7 +101,6 @@ class QPDF_DLL_CLASS QPDFNumberTreeObjectHelper: public QPDFObjectHelper
103 101 }
104 102 QPDF_DLL
105 103 iterator& operator--();
106   - QPDF_DLL
107 104 iterator
108 105 operator--(int)
109 106 {
... ... @@ -117,7 +114,6 @@ class QPDF_DLL_CLASS QPDFNumberTreeObjectHelper: public QPDFObjectHelper
117 114 pointer operator->();
118 115 QPDF_DLL
119 116 bool operator==(iterator const& other) const;
120   - QPDF_DLL
121 117 bool
122 118 operator!=(iterator const& other) const
123 119 {
... ... @@ -189,7 +185,6 @@ class QPDF_DLL_CLASS QPDFNumberTreeObjectHelper: public QPDFObjectHelper
189 185 typedef QPDFNumberTreeObjectHelper::numtree_number numtree_number;
190 186  
191 187 public:
192   - QPDF_DLL
193 188 ~Members() = default;
194 189  
195 190 private:
... ...
include/qpdf/QPDFObjGen.hh
... ... @@ -35,57 +35,47 @@ class QPDFObjectHelper;
35 35 class QPDFObjGen
36 36 {
37 37 public:
38   - QPDF_DLL
39 38 QPDFObjGen() = default;
40   - QPDF_DLL
41 39 QPDFObjGen(int obj, int gen) :
42 40 obj(obj),
43 41 gen(gen)
44 42 {
45 43 }
46   - QPDF_DLL
47 44 bool
48 45 operator<(QPDFObjGen const& rhs) const
49 46 {
50 47 return (obj < rhs.obj) || (obj == rhs.obj && gen < rhs.gen);
51 48 }
52   - QPDF_DLL
53 49 bool
54 50 operator==(QPDFObjGen const& rhs) const
55 51 {
56 52 return obj == rhs.obj && gen == rhs.gen;
57 53 }
58   - QPDF_DLL
59 54 bool
60 55 operator!=(QPDFObjGen const& rhs) const
61 56 {
62 57 return !(*this == rhs);
63 58 }
64   - QPDF_DLL
65 59 int
66 60 getObj() const
67 61 {
68 62 return obj;
69 63 }
70   - QPDF_DLL
71 64 int
72 65 getGen() const
73 66 {
74 67 return gen;
75 68 }
76   - QPDF_DLL
77 69 bool
78 70 isIndirect() const
79 71 {
80 72 return obj != 0;
81 73 }
82   - QPDF_DLL
83 74 std::string
84 75 unparse(char separator = ',') const
85 76 {
86 77 return std::to_string(obj) + separator + std::to_string(gen);
87 78 }
88   - QPDF_DLL
89 79 friend std::ostream&
90 80 operator<<(std::ostream& os, QPDFObjGen og)
91 81 {
... ... @@ -116,7 +106,6 @@ class QPDFObjGen
116 106 public:
117 107 // Add 'og' to the set. Return false if 'og' is already present in the set. Attempts to
118 108 // insert QPDFObjGen(0, 0) are ignored.
119   - QPDF_DLL
120 109 bool
121 110 add(QPDFObjGen og)
122 111 {
... ... @@ -129,7 +118,6 @@ class QPDFObjGen
129 118 return true;
130 119 }
131 120  
132   - QPDF_DLL
133 121 void
134 122 erase(QPDFObjGen og)
135 123 {
... ...
include/qpdf/QPDFObjectHandle.hh
... ... @@ -156,9 +156,7 @@ class QPDFObjectHandle final: public qpdf::BaseHandle
156 156 class QPDF_DLL_CLASS TokenFilter
157 157 {
158 158 public:
159   - QPDF_DLL
160 159 TokenFilter() = default;
161   - QPDF_DLL
162 160 virtual ~TokenFilter() = default;
163 161 virtual void handleToken(QPDFTokenizer::Token const&) = 0;
164 162 QPDF_DLL
... ... @@ -196,7 +194,6 @@ class QPDFObjectHandle final: public qpdf::BaseHandle
196 194 class StringDecrypter
197 195 {
198 196 public:
199   - QPDF_DLL
200 197 virtual ~StringDecrypter() = default;
201 198 virtual void decryptString(std::string& val) = 0;
202 199 };
... ... @@ -206,7 +203,6 @@ class QPDFObjectHandle final: public qpdf::BaseHandle
206 203 class QPDF_DLL_CLASS ParserCallbacks
207 204 {
208 205 public:
209   - QPDF_DLL
210 206 virtual ~ParserCallbacks() = default;
211 207 // One of the handleObject methods must be overridden.
212 208 QPDF_DLL
... ... @@ -286,18 +282,13 @@ class QPDFObjectHandle final: public qpdf::BaseHandle
286 282 double f;
287 283 };
288 284  
289   - QPDF_DLL
290 285 QPDFObjectHandle() = default;
291   - QPDF_DLL
292 286 QPDFObjectHandle(QPDFObjectHandle const&) = default;
293   - QPDF_DLL
294 287 QPDFObjectHandle& operator=(QPDFObjectHandle const&) = default;
295   - QPDF_DLL
296 288 QPDFObjectHandle(QPDFObjectHandle&&) = default;
297   - QPDF_DLL
298 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 293 // This method returns true if the QPDFObjectHandle objects point to exactly the same underlying
303 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 339  
349 340 // This returns true in addition to the query for the specific type for indirect objects.
350 341 QPDF_DLL
351   - inline bool isIndirect() const;
  342 + bool isIndirect() const;
352 343  
353 344 // This returns true for indirect objects from a QPDF that has been destroyed. Trying unparse
354 345 // such an object will throw a logic_error.
... ... @@ -1145,9 +1136,9 @@ class QPDFObjectHandle final: public qpdf::BaseHandle
1145 1136 QPDF_DLL
1146 1137 QPDFObjGen getObjGen() const;
1147 1138 QPDF_DLL
1148   - inline int getObjectID() const;
  1139 + int getObjectID() const;
1149 1140 QPDF_DLL
1150   - inline int getGeneration() const;
  1141 + int getGeneration() const;
1151 1142  
1152 1143 QPDF_DLL
1153 1144 std::string unparse() const;
... ... @@ -1424,11 +1415,9 @@ class QPDFObjectHandle::QPDFDictItems
1424 1415 using pointer = T*;
1425 1416 using reference = T&;
1426 1417  
1427   - QPDF_DLL
1428 1418 virtual ~iterator() = default;
1429 1419 QPDF_DLL
1430 1420 iterator& operator++();
1431   - QPDF_DLL
1432 1421 iterator
1433 1422 operator++(int)
1434 1423 {
... ... @@ -1438,7 +1427,6 @@ class QPDFObjectHandle::QPDFDictItems
1438 1427 }
1439 1428 QPDF_DLL
1440 1429 iterator& operator--();
1441   - QPDF_DLL
1442 1430 iterator
1443 1431 operator--(int)
1444 1432 {
... ... @@ -1452,7 +1440,6 @@ class QPDFObjectHandle::QPDFDictItems
1452 1440 pointer operator->();
1453 1441 QPDF_DLL
1454 1442 bool operator==(iterator const& other) const;
1455   - QPDF_DLL
1456 1443 bool
1457 1444 operator!=(iterator const& other) const
1458 1445 {
... ... @@ -1468,7 +1455,6 @@ class QPDFObjectHandle::QPDFDictItems
1468 1455 friend class QPDFDictItems::iterator;
1469 1456  
1470 1457 public:
1471   - QPDF_DLL
1472 1458 ~Members() = default;
1473 1459  
1474 1460 private:
... ... @@ -1522,11 +1508,9 @@ class QPDFObjectHandle::QPDFArrayItems
1522 1508 using pointer = T*;
1523 1509 using reference = T&;
1524 1510  
1525   - QPDF_DLL
1526 1511 virtual ~iterator() = default;
1527 1512 QPDF_DLL
1528 1513 iterator& operator++();
1529   - QPDF_DLL
1530 1514 iterator
1531 1515 operator++(int)
1532 1516 {
... ... @@ -1536,7 +1520,6 @@ class QPDFObjectHandle::QPDFArrayItems
1536 1520 }
1537 1521 QPDF_DLL
1538 1522 iterator& operator--();
1539   - QPDF_DLL
1540 1523 iterator
1541 1524 operator--(int)
1542 1525 {
... ... @@ -1550,7 +1533,6 @@ class QPDFObjectHandle::QPDFArrayItems
1550 1533 pointer operator->();
1551 1534 QPDF_DLL
1552 1535 bool operator==(iterator const& other) const;
1553   - QPDF_DLL
1554 1536 bool
1555 1537 operator!=(iterator const& other) const
1556 1538 {
... ... @@ -1566,7 +1548,6 @@ class QPDFObjectHandle::QPDFArrayItems
1566 1548 friend class QPDFArrayItems::iterator;
1567 1549  
1568 1550 public:
1569   - QPDF_DLL
1570 1551 ~Members() = default;
1571 1552  
1572 1553 private:
... ... @@ -1607,24 +1588,6 @@ namespace qpdf
1607 1588  
1608 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 1591 inline bool
1629 1592 QPDFObjectHandle::isInitialized() const
1630 1593 {
... ...
include/qpdf/QPDFObjectHelper.hh
... ... @@ -34,20 +34,17 @@
34 34 class QPDF_DLL_CLASS QPDFObjectHelper: public qpdf::BaseHandle
35 35 {
36 36 public:
37   - QPDF_DLL
38 37 QPDFObjectHelper(QPDFObjectHandle oh) :
39 38 qpdf::BaseHandle(oh.getObj())
40 39 {
41 40 }
42 41 QPDF_DLL
43 42 virtual ~QPDFObjectHelper();
44   - QPDF_DLL
45 43 QPDFObjectHandle
46 44 getObjectHandle()
47 45 {
48 46 return {obj};
49 47 }
50   - QPDF_DLL
51 48 QPDFObjectHandle const
52 49 getObjectHandle() const
53 50 {
... ...
include/qpdf/QPDFOutlineDocumentHelper.hh
... ... @@ -35,13 +35,12 @@
35 35 // section 12.3.3 of the PDF spec (ISO-32000). With the help of QPDFOutlineObjectHelper, the
36 36 // outlines tree is traversed, and a bidirectional map is made between pages and outlines. See also
37 37 // QPDFOutlineObjectHelper.
38   -
39 38 class QPDFOutlineDocumentHelper: public QPDFDocumentHelper
40 39 {
41 40 public:
42 41 QPDF_DLL
43 42 QPDFOutlineDocumentHelper(QPDF&);
44   - QPDF_DLL
  43 +
45 44 ~QPDFOutlineDocumentHelper() override = default;
46 45  
47 46 QPDF_DLL
... ... @@ -79,7 +78,6 @@ class QPDFOutlineDocumentHelper: public QPDFDocumentHelper
79 78 friend class QPDFOutlineDocumentHelper;
80 79  
81 80 public:
82   - QPDF_DLL
83 81 ~Members() = default;
84 82  
85 83 private:
... ...
include/qpdf/QPDFOutlineObjectHelper.hh
... ... @@ -30,11 +30,9 @@ class QPDFOutlineDocumentHelper;
30 30  
31 31 // This is an object helper for outline items. Outlines, also known as bookmarks, are described in
32 32 // section 12.3.3 of the PDF spec (ISO-32000). See comments below for details.
33   -
34 33 class QPDFOutlineObjectHelper: public QPDFObjectHelper
35 34 {
36 35 public:
37   - QPDF_DLL
38 36 ~QPDFOutlineObjectHelper() override
39 37 {
40 38 // This must be cleared explicitly to avoid circular references that prevent cleanup of
... ... @@ -87,7 +85,6 @@ class QPDFOutlineObjectHelper: public QPDFObjectHelper
87 85 };
88 86  
89 87 private:
90   - QPDF_DLL
91 88 QPDFOutlineObjectHelper(QPDFObjectHandle, QPDFOutlineDocumentHelper&, int);
92 89  
93 90 class Members
... ... @@ -95,7 +92,6 @@ class QPDFOutlineObjectHelper: public QPDFObjectHelper
95 92 friend class QPDFOutlineObjectHelper;
96 93  
97 94 public:
98   - QPDF_DLL
99 95 ~Members() = default;
100 96  
101 97 private:
... ...
include/qpdf/QPDFPageDocumentHelper.hh
... ... @@ -37,7 +37,7 @@ class QPDFPageDocumentHelper: public QPDFDocumentHelper
37 37 public:
38 38 QPDF_DLL
39 39 QPDFPageDocumentHelper(QPDF&);
40   - QPDF_DLL
  40 +
41 41 ~QPDFPageDocumentHelper() override = default;
42 42  
43 43 // Traverse page tree, and return all /Page objects wrapped in QPDFPageObjectHelper objects.
... ... @@ -117,7 +117,6 @@ class QPDFPageDocumentHelper: public QPDFDocumentHelper
117 117 friend class QPDFPageDocumentHelper;
118 118  
119 119 public:
120   - QPDF_DLL
121 120 ~Members() = default;
122 121  
123 122 private:
... ...
include/qpdf/QPDFPageLabelDocumentHelper.hh
... ... @@ -44,7 +44,7 @@ class QPDFPageLabelDocumentHelper: public QPDFDocumentHelper
44 44 public:
45 45 QPDF_DLL
46 46 QPDFPageLabelDocumentHelper(QPDF&);
47   - QPDF_DLL
  47 +
48 48 ~QPDFPageLabelDocumentHelper() override = default;
49 49  
50 50 QPDF_DLL
... ... @@ -82,7 +82,6 @@ class QPDFPageLabelDocumentHelper: public QPDFDocumentHelper
82 82 friend class QPDFPageLabelDocumentHelper;
83 83  
84 84 public:
85   - QPDF_DLL
86 85 ~Members() = default;
87 86  
88 87 private:
... ...
include/qpdf/QPDFPageObjectHelper.hh
... ... @@ -31,15 +31,14 @@
31 31  
32 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 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 38 public:
40 39 QPDF_DLL
41 40 QPDFPageObjectHelper(QPDFObjectHandle);
42   - QPDF_DLL
  41 +
43 42 ~QPDFPageObjectHelper() override = default;
44 43  
45 44 // PAGE ATTRIBUTES
... ... @@ -411,7 +410,6 @@ class QPDFPageObjectHelper: public QPDFObjectHelper
411 410 friend class QPDFPageObjectHelper;
412 411  
413 412 public:
414   - QPDF_DLL
415 413 ~Members() = default;
416 414  
417 415 private:
... ...
include/qpdf/QPDFStreamFilter.hh
... ... @@ -27,10 +27,8 @@
27 27 class QPDF_DLL_CLASS QPDFStreamFilter
28 28 {
29 29 public:
30   - QPDF_DLL
31 30 QPDFStreamFilter() = default;
32 31  
33   - QPDF_DLL
34 32 virtual ~QPDFStreamFilter() = default;
35 33  
36 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 32 public:
33 33 QPDF_DLL
34 34 QPDFSystemError(std::string const& description, int system_errno);
35   - QPDF_DLL
  35 +
36 36 ~QPDFSystemError() noexcept override = default;
37 37  
38 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 30 public:
31 31 QPDF_DLL
32 32 QPDFUsage(std::string const& msg);
33   - QPDF_DLL
34 33 ~QPDFUsage() noexcept override = default;
35 34 };
36 35  
... ...
include/qpdf/QPDFWriter.hh
... ... @@ -17,9 +17,6 @@
17 17 // License. At your option, you may continue to consider qpdf to be licensed under those terms.
18 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 20 #ifndef QPDFWRITER_HH
24 21 #define QPDFWRITER_HH
25 22  
... ... @@ -51,6 +48,8 @@ class QPDF;
51 48 class Pl_Count;
52 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 53 class QPDFWriter
55 54 {
56 55 public:
... ... @@ -71,7 +70,6 @@ class QPDFWriter
71 70 QPDF_DLL
72 71 QPDFWriter(QPDF& pdf, char const* description, FILE* file, bool close_file);
73 72  
74   - QPDF_DLL
75 73 ~QPDFWriter() = default;
76 74  
77 75 class QPDF_DLL_CLASS ProgressReporter
... ...
include/qpdf/QPDFXRefEntry.hh
... ... @@ -37,14 +37,12 @@ class QPDFXRefEntry
37 37 QPDF_DLL
38 38 QPDFXRefEntry(int type, qpdf_offset_t field1, int field2);
39 39 // Create a type 1 "uncompressed" entry.
40   - QPDF_DLL
41 40 QPDFXRefEntry(qpdf_offset_t offset) :
42 41 type(1),
43 42 field1(offset)
44 43 {
45 44 }
46 45 // Create a type 2 "compressed" entry.
47   - QPDF_DLL
48 46 QPDFXRefEntry(int stream_number, int index) :
49 47 type(2),
50 48 field1(stream_number),
... ...
libqpdf/FileInputSource.cc
... ... @@ -5,12 +5,6 @@
5 5 #include <algorithm>
6 6 #include <cstring>
7 7  
8   -FileInputSource::FileInputSource() :
9   - close_file(false),
10   - file(nullptr)
11   -{
12   -}
13   -
14 8 FileInputSource::FileInputSource(char const* filename) :
15 9 close_file(true),
16 10 filename(filename),
... ...
libqpdf/PDFVersion.cc
... ... @@ -2,11 +2,6 @@
2 2  
3 3 #include <qpdf/QUtil.hh>
4 4  
5   -PDFVersion::PDFVersion() :
6   - PDFVersion(0, 0, 0)
7   -{
8   -}
9   -
10 5 PDFVersion::PDFVersion(int major_version, int minor_version, int extension_level) :
11 6 major_version(major_version),
12 7 minor_version(minor_version),
... ...
libqpdf/Pl_Buffer.cc
... ... @@ -5,16 +5,24 @@
5 5 #include <cstring>
6 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 18 Pl_Buffer::Pl_Buffer(char const* identifier, Pipeline* next) :
9 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 27 void
20 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 }
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 16 void
19 17 Pl_Concatenate::write(unsigned char const* data, size_t len)
... ...
libqpdf/Pl_Count.cc
... ... @@ -2,13 +2,21 @@
2 2  
3 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 17 Pl_Count::Pl_Count(char const* identifier, Pipeline* next) :
10 18 Pipeline(identifier, next),
11   - m(new Members())
  19 + m(std::make_unique<Members>())
12 20 {
13 21 if (!next) {
14 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 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 103 Pl_DCT::Pl_DCT(char const* identifier, Pipeline* next) :
83 104 Pipeline(identifier, next),
84   - m(new Members())
  105 + m(std::make_unique<Members>())
85 106 {
86 107 if (!next) {
87 108 throw std::logic_error("Attempt to create Pl_DCT with nullptr as next");
... ... @@ -115,14 +136,13 @@ Pl_DCT::Pl_DCT(
115 136 J_COLOR_SPACE color_space,
116 137 CompressConfig* compress_callback) :
117 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 147 void
128 148 Pl_DCT::write(unsigned char const* data, size_t len)
... ...
libqpdf/Pl_Discard.cc
... ... @@ -2,15 +2,16 @@
2 2  
3 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 8 Pl_Discard::Pl_Discard() :
6 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 16 void
16 17 Pl_Discard::write(unsigned char const* buf, size_t len)
... ...
libqpdf/Pl_Flate.cc
... ... @@ -68,17 +68,15 @@ Pl_Flate::Members::~Members()
68 68 Pl_Flate::Pl_Flate(
69 69 char const* identifier, Pipeline* next, action_e action, unsigned int out_bufsize_int) :
70 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 73 if (!next) {
74 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 81 unsigned long long
84 82 Pl_Flate::memory_limit()
... ...
libqpdf/Pl_Function.cc
... ... @@ -2,20 +2,28 @@
2 2  
3 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 18 Pl_Function::Pl_Function(char const* identifier, Pipeline* next, writer_t fn) :
11 19 Pipeline(identifier, next),
12   - m(new Members(fn))
  20 + m(std::make_unique<Members>(fn))
13 21 {
14 22 }
15 23  
16 24 Pl_Function::Pl_Function(char const* identifier, Pipeline* next, writer_c_t fn, void* udata) :
17 25 Pipeline(identifier, next),
18   - m(new Members(nullptr))
  26 + m(std::make_unique<Members>(nullptr))
19 27 {
20 28 m->fn = [identifier, fn, udata](unsigned char const* data, size_t len) {
21 29 int code = fn(data, len, udata);
... ...
libqpdf/Pl_OStream.cc
... ... @@ -2,21 +2,27 @@
2 2  
3 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 18 Pl_OStream::Pl_OStream(char const* identifier, std::ostream& os) :
11 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 27 void
22 28 Pl_OStream::write(unsigned char const* buf, size_t len)
... ...
libqpdf/Pl_QPDFTokenizer.cc
... ... @@ -4,15 +4,22 @@
4 4 #include <qpdf/QTC.hh>
5 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 19 Pl_QPDFTokenizer::Pl_QPDFTokenizer(
13 20 char const* identifier, QPDFObjectHandle::TokenFilter* filter, Pipeline* next) :
14 21 Pipeline(identifier, next),
15   - m(new Members)
  22 + m(std::make_unique<Members>())
16 23 {
17 24 m->filter = filter;
18 25 QPDFObjectHandle::TokenFilter::PipelineAccessor::setPipeline(m->filter, next);
... ... @@ -20,10 +27,8 @@ Pl_QPDFTokenizer::Pl_QPDFTokenizer(
20 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 33 void
29 34 Pl_QPDFTokenizer::write(unsigned char const* data, size_t len)
... ...
libqpdf/Pl_RunLength.cc
... ... @@ -8,14 +8,26 @@ namespace
8 8 unsigned long long memory_limit{0};
9 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 28 Pl_RunLength::Pl_RunLength(char const* identifier, Pipeline* next, action_e action) :
17 29 Pipeline(identifier, next),
18   - m(new Members(action))
  30 + m(std::make_unique<Members>(action))
19 31 {
20 32 if (!next) {
21 33 throw std::logic_error("Attempt to create Pl_RunLength with nullptr as next");
... ...
libqpdf/Pl_StdioFile.cc
... ... @@ -6,21 +6,27 @@
6 6 #include <cerrno>
7 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 22 Pl_StdioFile::Pl_StdioFile(char const* identifier, FILE* f) :
15 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 31 void
26 32 Pl_StdioFile::write(unsigned char const* buf, size_t len)
... ...
libqpdf/Pl_String.cc
... ... @@ -2,21 +2,27 @@
2 2  
3 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 18 Pl_String::Pl_String(char const* identifier, Pipeline* next, std::string& s) :
11 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 27 void
22 28 Pl_String::write(unsigned char const* buf, size_t len)
... ...
libqpdf/QPDF.cc
... ... @@ -200,7 +200,7 @@ QPDF::Members::Members() :
200 200 }
201 201  
202 202 QPDF::QPDF() :
203   - m(new Members())
  203 + m(std::make_unique<Members>())
204 204 {
205 205 m->tokenizer.allowEOF();
206 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 138 (this->a == rhs.a) && (this->b == rhs.b) && (this->c == rhs.c) && (this->d == rhs.d) &&
139 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 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 2390 // Indirect object accessors
2373 2391 QPDF*
2374 2392 QPDFObjectHandle::getOwningQPDF() const
... ...
libqpdf/QPDFObjectHelper.cc
1 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 108 print_size(QPDFNameTreeObjectHelper::iterator);
109 109 print_size(QPDFNumberTreeObjectHelper);
110 110 print_size(QPDFNumberTreeObjectHelper::iterator);
111   - print_size(QPDFObjGen);
112 111 print_size(QPDFObjectHandle);
113 112 print_size(QPDFObjectHandle::ParserCallbacks);
114 113 print_size(QPDFObjectHandle::QPDFArrayItems);
... ... @@ -117,6 +116,7 @@ main()
117 116 print_size(QPDFObjectHandle::QPDFDictItems::iterator);
118 117 print_size(QPDFObjectHandle::StreamDataProvider);
119 118 print_size(QPDFObjectHandle::TokenFilter);
  119 + print_size(QPDFObjectHelper);
120 120 print_size(QPDFOutlineDocumentHelper);
121 121 print_size(QPDFOutlineObjectHelper);
122 122 print_size(QPDFPageDocumentHelper);
... ...