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,7 +792,6 @@ class QPDF
792 class Doc; 792 class Doc;
793 class Writer; 793 class Writer;
794 class StreamCopier; 794 class StreamCopier;
795 - class Pipe;  
796 class JobSetter; 795 class JobSetter;
797 796
798 inline bool reconstructed_xref() const; 797 inline bool reconstructed_xref() const;
libqpdf/QPDF_Stream.cc
@@ -26,6 +26,27 @@ @@ -26,6 +26,27 @@
26 using namespace std::literals; 26 using namespace std::literals;
27 using namespace qpdf; 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 namespace 50 namespace
30 { 51 {
31 class SF_Crypt final: public QPDFStreamFilter 52 class SF_Crypt final: public QPDFStreamFilter
@@ -563,7 +584,7 @@ Stream::pipeStreamData( @@ -563,7 +584,7 @@ Stream::pipeStreamData(
563 throw std::logic_error("pipeStreamData called for stream with no data"); 584 throw std::logic_error("pipeStreamData called for stream with no data");
564 } 585 }
565 QTC::TC("qpdf", "QPDF_Stream pipe original stream data"); 586 QTC::TC("qpdf", "QPDF_Stream pipe original stream data");
566 - if (!QPDF::Pipe::pipeStreamData( 587 + if (!QPDF::Doc::Streams::pipeStreamData(
567 obj->getQPDF(), 588 obj->getQPDF(),
568 obj->getObjGen(), 589 obj->getObjGen(),
569 obj->getParsedOffset(), 590 obj->getParsedOffset(),
libqpdf/qpdf/QPDF_private.hh
@@ -26,29 +26,6 @@ class QPDF::StreamCopier @@ -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 class QPDF::ObjCache 29 class QPDF::ObjCache
53 { 30 {
54 public: 31 public:
@@ -369,6 +346,7 @@ class QPDF::Doc @@ -369,6 +346,7 @@ class QPDF::Doc
369 public: 346 public:
370 class ParseGuard; 347 class ParseGuard;
371 class Resolver; 348 class Resolver;
  349 + class Streams;
372 350
373 Doc() = delete; 351 Doc() = delete;
374 Doc(Doc const&) = delete; 352 Doc(Doc const&) = delete;