2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-05-30 17:00:51 +00:00
qpdf/libqpdf/qpdf/OffsetInputSource.hh
Jay Berkenbilt a68703b07e Replace PointerHolder with std::shared_ptr in library sources only
(patrepl and cleanpatch are my own utilities)

patrepl s/PointerHolder/std::shared_ptr/g {include,libqpdf}/qpdf/*.hh
patrepl s/PointerHolder/std::shared_ptr/g libqpdf/*.cc
patrepl s/make_pointer_holder/std::make_shared/g libqpdf/*.cc
patrepl s/make_array_pointer_holder/QUtil::make_shared_array/g libqpdf/*.cc
patrepl s,qpdf/std::shared_ptr,qpdf/PointerHolder, **/*.cc **/*.hh
git restore include/qpdf/PointerHolder.hh
cleanpatch
./format-code
2022-04-09 17:33:29 -04:00

32 lines
909 B
C++

#ifndef QPDF_OFFSETINPUTSOURCE_HH
#define QPDF_OFFSETINPUTSOURCE_HH
// This class implements an InputSource that proxies for an underlying
// input source but offset a specific number of bytes.
#include <qpdf/InputSource.hh>
#include <qpdf/PointerHolder.hh>
class OffsetInputSource: public InputSource
{
public:
OffsetInputSource(
std::shared_ptr<InputSource>, qpdf_offset_t global_offset);
virtual ~OffsetInputSource();
virtual qpdf_offset_t findAndSkipNextEOL();
virtual std::string const& getName() const;
virtual qpdf_offset_t tell();
virtual void seek(qpdf_offset_t offset, int whence);
virtual void rewind();
virtual size_t read(char* buffer, size_t length);
virtual void unreadCh(char ch);
private:
std::shared_ptr<InputSource> proxied;
qpdf_offset_t global_offset;
qpdf_offset_t max_safe_offset;
};
#endif // QPDF_OFFSETINPUTSOURCE_HH