PoDoFo  1.0.0-dev
PdfData.h
1 
7 #ifndef PDF_DATA_H
8 #define PDF_DATA_H
9 
10 #include "PdfDeclarations.h"
11 
12 #include "PdfBaseDataTypes.h"
13 
14 namespace PoDoFo {
15 
22 class PODOFO_API PdfData final : public PdfDataProvider<PdfData>
23 {
24 public:
25  PdfData();
26  PdfData(const PdfData&) = default;
27  PdfData(PdfData&&) noexcept = default;
28 
39  PdfData(charbuff&& data, const std::shared_ptr<size_t>& writeBeacon = { });
40 
51  explicit PdfData(const bufferview& data, const std::shared_ptr<size_t>& writeBeacon = { });
52 
53  void Write(OutputStream& stream, PdfWriteFlags writeMode,
54  const PdfStatefulEncrypt* encrypt, charbuff& buffer) const;
55 
56  PdfData& operator=(const PdfData& rhs) = default;
57  PdfData& operator=(PdfData&& rhs) = default;
58  PdfData& operator=(const bufferview& data);
59 
64  inline const charbuff& GetBuffer() const { return m_data; }
65 
66 private:
67  charbuff m_data;
68  std::shared_ptr<size_t> m_writeBeacon;
69 };
70 
71 }
72 
73 #endif // PDF_DATA_H
74 
SPDX-FileCopyrightText: (C) 2005 Dominik Seichter domseichter@web.de SPDX-FileCopyrightText: (C) 2020...
An interface for writing blocks of data to a data source.
Definition: OutputStream.h:18
An helper class to inherit to provide common serialization methods.
Definition: PdfBaseDataTypes.h:40
A datatype that allows to write arbitrary data to a PDF file.
Definition: PdfData.h:23
PdfData(const bufferview &data, const std::shared_ptr< size_t > &writeBeacon={ })
Create a new PdfData object with valid PdfData.
const charbuff & GetBuffer() const
Access the data as a std::string.
Definition: PdfData.h:64
PdfData(charbuff &&data, const std::shared_ptr< size_t > &writeBeacon={ })
Create a new PdfData object with valid PdfData.
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
PdfWriteFlags
Specify additional options for writing the PDF.
Definition: PdfDeclarations.h:137
cspan< char > bufferview
Convenient read-only char buffer span.
Definition: basetypes.h:19