2018-08-12 18:07:22 +00:00
|
|
|
#ifndef QPDF_OFFSETINPUTSOURCE_HH
|
|
|
|
#define QPDF_OFFSETINPUTSOURCE_HH
|
2012-12-25 19:38:18 +00:00
|
|
|
|
|
|
|
// This class implements an InputSource that proxies for an underlying input source but offset a
|
|
|
|
// specific number of bytes.
|
|
|
|
|
|
|
|
#include <qpdf/InputSource.hh>
|
|
|
|
|
|
|
|
class OffsetInputSource: public InputSource
|
|
|
|
{
|
|
|
|
public:
|
2022-04-09 18:35:56 +00:00
|
|
|
OffsetInputSource(std::shared_ptr<InputSource>, qpdf_offset_t global_offset);
|
2023-05-20 13:25:46 +00:00
|
|
|
~OffsetInputSource() override = default;
|
2012-12-25 19:38:18 +00:00
|
|
|
|
2023-05-20 13:25:46 +00:00
|
|
|
qpdf_offset_t findAndSkipNextEOL() override;
|
|
|
|
std::string const& getName() const override;
|
|
|
|
qpdf_offset_t tell() override;
|
|
|
|
void seek(qpdf_offset_t offset, int whence) override;
|
|
|
|
void rewind() override;
|
|
|
|
size_t read(char* buffer, size_t length) override;
|
|
|
|
void unreadCh(char ch) override;
|
2012-12-25 19:38:18 +00:00
|
|
|
|
|
|
|
private:
|
2022-04-09 18:35:56 +00:00
|
|
|
std::shared_ptr<InputSource> proxied;
|
2012-12-25 19:38:18 +00:00
|
|
|
qpdf_offset_t global_offset;
|
2019-08-27 14:58:20 +00:00
|
|
|
qpdf_offset_t max_safe_offset;
|
2012-12-25 19:38:18 +00:00
|
|
|
};
|
|
|
|
|
2018-08-12 18:07:22 +00:00
|
|
|
#endif // QPDF_OFFSETINPUTSOURCE_HH
|