/src/qpdf/libqpdf/qpdf/OffsetInputSource.hh
Line | Count | Source |
1 | | #ifndef QPDF_OFFSETINPUTSOURCE_HH |
2 | | #define QPDF_OFFSETINPUTSOURCE_HH |
3 | | |
4 | | // This class implements an InputSource that proxies for an underlying input source but offset a |
5 | | // specific number of bytes. |
6 | | |
7 | | #include <qpdf/InputSource.hh> |
8 | | |
9 | | class OffsetInputSource: public InputSource |
10 | | { |
11 | | public: |
12 | | OffsetInputSource(std::shared_ptr<InputSource>, qpdf_offset_t global_offset); |
13 | 1.72k | ~OffsetInputSource() override = default; |
14 | | |
15 | | qpdf_offset_t findAndSkipNextEOL() override; |
16 | | std::string const& getName() const override; |
17 | | qpdf_offset_t tell() override; |
18 | | void seek(qpdf_offset_t offset, int whence) override; |
19 | | void rewind() override; |
20 | | size_t read(char* buffer, size_t length) override; |
21 | | void unreadCh(char ch) override; |
22 | | |
23 | | private: |
24 | | std::shared_ptr<InputSource> proxied; |
25 | | qpdf_offset_t global_offset; |
26 | | qpdf_offset_t max_safe_offset; |
27 | | }; |
28 | | |
29 | | #endif // QPDF_OFFSETINPUTSOURCE_HH |