PoDoFo  1.0.0-dev
PdfBaseDataTypes.h
1 
7 #ifndef PDF_BASE_DATA_TYPES_H
8 #define PDF_BASE_DATA_TYPES_H
9 
10 #include "PdfDeclarations.h"
11 #include <podofo/auxiliary/StreamDevice.h>
12 
13 namespace PoDoFo {
14 
15 class OutputStream;
16 class PdfStatefulEncrypt;
17 
20 class PODOFO_API PdfDataMember
21 {
22  friend class PdfString;
23  friend class PdfName;
24  friend class PdfReference;
25 public:
27 public:
28  inline PdfDataType GetDataType() const { return m_DataType; }
29 private:
30  PdfDataType m_DataType;
31 };
32 
38 template <typename T>
40 {
41  friend class PdfDataContainer;
42  friend class PdfData;
43  friend class PdfString;
44  friend class PdfName;
45  friend class PdfReference;
46 
47 private:
48  PdfDataProvider() { }
49 
50 public:
55  std::string ToString(PdfWriteFlags flags = PdfWriteFlags::None) const
56  {
57  std::string ret;
58  ToString(ret, flags);
59  return ret;
60  }
61 
62  void ToString(std::string& str, PdfWriteFlags flags = PdfWriteFlags::None) const
63  {
64  str.clear();
65  StringStreamDevice device(str);
66  charbuff buffer;
67  static_cast<const T&>(*this).Write(device, flags, nullptr, buffer);
68  }
69 };
70 
71 }
72 
73 #endif // PDF_BASE_DATA_TYPES_H
SPDX-FileCopyrightText: (C) 2005 Dominik Seichter domseichter@web.de SPDX-FileCopyrightText: (C) 2020...
A PdfDataProvider object with a PdfObject owner, specialized in holding objects.
Definition: PdfDataContainer.h:22
A class to inherit for classes that are stored as union members in a PdfVariant.
Definition: PdfBaseDataTypes.h:21
An helper class to inherit to provide common serialization methods.
Definition: PdfBaseDataTypes.h:40
std::string ToString(PdfWriteFlags flags=PdfWriteFlags::None) const
Converts the current object into a string representation which can be written directly to a PDF file ...
Definition: PdfBaseDataTypes.h:55
A datatype that allows to write arbitrary data to a PDF file.
Definition: PdfData.h:23
This class represents a PdfName.
Definition: PdfName.h:24
A reference is a pointer to a object in the PDF file of the form "4 0 R", where 4 is the object numbe...
Definition: PdfReference.h:24
A string that can be written to a PDF document.
Definition: PdfString.h:24
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
PdfDataType
Every PDF datatype that can occur in a PDF file is referenced by an own enum (e.g.
Definition: PdfDeclarations.h:155
PdfWriteFlags
Specify additional options for writing the PDF.
Definition: PdfDeclarations.h:137