Commit 09d758b088df2fa37287ce8bfe71d58136f4fba5

Authored by m-holger
1 parent 5e292cff

Move `Pipe` to `QPDF::Doc::Streams` and update references

Relocate `Pipe` functionality to `QPDF::Doc::Streams` for improved encapsulation of stream-related logic. Adjust all references to use the new placement.
include/qpdf/QPDF.hh
... ... @@ -792,7 +792,6 @@ class QPDF
792 792 class Doc;
793 793 class Writer;
794 794 class StreamCopier;
795   - class Pipe;
796 795 class JobSetter;
797 796  
798 797 inline bool reconstructed_xref() const;
... ...
libqpdf/QPDF_Stream.cc
... ... @@ -26,6 +26,27 @@
26 26 using namespace std::literals;
27 27 using namespace qpdf;
28 28  
  29 +// Pipe class is restricted to QPDF_Stream.
  30 +class QPDF::Doc::Streams
  31 +{
  32 + public:
  33 + static bool
  34 + pipeStreamData(
  35 + QPDF* qpdf,
  36 + QPDFObjGen og,
  37 + qpdf_offset_t offset,
  38 + size_t length,
  39 + QPDFObjectHandle dict,
  40 + bool is_root_metadata,
  41 + Pipeline* pipeline,
  42 + bool suppress_warnings,
  43 + bool will_retry)
  44 + {
  45 + return qpdf->pipeStreamData(
  46 + og, offset, length, dict, is_root_metadata, pipeline, suppress_warnings, will_retry);
  47 + }
  48 +};
  49 +
29 50 namespace
30 51 {
31 52 class SF_Crypt final: public QPDFStreamFilter
... ... @@ -563,7 +584,7 @@ Stream::pipeStreamData(
563 584 throw std::logic_error("pipeStreamData called for stream with no data");
564 585 }
565 586 QTC::TC("qpdf", "QPDF_Stream pipe original stream data");
566   - if (!QPDF::Pipe::pipeStreamData(
  587 + if (!QPDF::Doc::Streams::pipeStreamData(
567 588 obj->getQPDF(),
568 589 obj->getObjGen(),
569 590 obj->getParsedOffset(),
... ...
libqpdf/qpdf/QPDF_private.hh
... ... @@ -26,29 +26,6 @@ class QPDF::StreamCopier
26 26 }
27 27 };
28 28  
29   -// Pipe class is restricted to QPDF_Stream.
30   -class QPDF::Pipe
31   -{
32   - friend class qpdf::Stream;
33   -
34   - private:
35   - static bool
36   - pipeStreamData(
37   - QPDF* qpdf,
38   - QPDFObjGen og,
39   - qpdf_offset_t offset,
40   - size_t length,
41   - QPDFObjectHandle dict,
42   - bool is_root_metadata,
43   - Pipeline* pipeline,
44   - bool suppress_warnings,
45   - bool will_retry)
46   - {
47   - return qpdf->pipeStreamData(
48   - og, offset, length, dict, is_root_metadata, pipeline, suppress_warnings, will_retry);
49   - }
50   -};
51   -
52 29 class QPDF::ObjCache
53 30 {
54 31 public:
... ... @@ -369,6 +346,7 @@ class QPDF::Doc
369 346 public:
370 347 class ParseGuard;
371 348 class Resolver;
  349 + class Streams;
372 350  
373 351 Doc() = delete;
374 352 Doc(Doc const&) = delete;
... ...