PoDoFo  1.0.0-dev
PdfCanvasInputDevice.h
1 
7 #ifndef PDF_CANVAS_INPUT_DEVICE_H
8 #define PDF_CANVAS_INPUT_DEVICE_H
9 
10 #include <podofo/auxiliary/InputDevice.h>
11 
12 #include <list>
13 
14 namespace PoDoFo {
15 
16 class PdfCanvas;
17 class PdfObject;
18 
24 class PODOFO_API PdfCanvasInputDevice final : public InputStreamDevice
25 {
26 public:
27  PdfCanvasInputDevice(const PdfCanvas& canvas);
28 public:
29  size_t GetLength() const override;
30  size_t GetPosition() const override;
31  bool Eof() const override { return m_eof; }
32 private:
33  bool tryGetNextDevice(InputStreamDevice*& device);
34  bool tryPopNextDevice();
35  void setEOF();
36 protected:
37  size_t readBuffer(char* buffer, size_t size, bool& eof) override;
38  bool readChar(char& ch) override;
39  bool peek(char& ch) const override;
40 private:
41  bool m_eof;
42  std::list<const PdfObject*> m_contents;
43  charbuff m_buffer;
44  std::unique_ptr<InputStreamDevice> m_currDevice;
45  bool m_deviceSwitchOccurred;
46 };
47 
48 }
49 
50 #endif // PDF_CANVAS_INPUT_DEVICE_H
This class represents an input device It optionally supports peeking.
Definition: InputDevice.h:22
There are Pdfs spanning delimiters or begin/end tags into contents streams.
Definition: PdfCanvasInputDevice.h:25
A interface that provides the necessary features for a painter to draw onto a PdfObject.
Definition: PdfCanvas.h:28
Convenient type for char array storage and/or buffer with std::string compatibility.
Definition: basetypes.h:38
SPDX-FileCopyrightText: (C) 2022 Francesco Pretto ceztko@gmail.com SPDX-License-Identifier: LGPL-2....
Definition: basetypes.h:16