8#include "PdfReference.h"
30 friend class PdfObject;
31 friend class PdfArray;
32 friend class PdfDictionary;
33 friend class PdfTokenizer;
34 friend class PdfParser;
35 PODOFO_PRIVATE_FRIEND(
class PdfParserObject);
147 bool TryGetBool(
bool& value)
const;
154 bool TryGetNumberLenient(int64_t& value)
const;
161 bool TryGetNumber(int64_t& value)
const;
168 bool TryGetReal(
double& value)
const;
175 bool TryGetRealStrict(
double& value)
const;
180 bool TryGetString(
const PdfString*& str)
const;
184 bool TryGetName(
PdfName& name)
const;
185 bool TryGetName(
const PdfName*& name)
const;
196 bool TryGetArray(
const PdfArray*& arr)
const;
197 bool TryGetArray(PdfArray*& arr);
203 bool TryGetDictionary(
const PdfDictionary*& dict)
const;
204 bool TryGetDictionary(PdfDictionary*& dict);
249 const PdfStatefulEncrypt* encrypt, charbuff& buffer)
const;
281 const PdfDictionary& GetDictionaryUnsafe()
const;
282 const PdfArray& GetArrayUnsafe()
const;
283 PdfDictionary& GetDictionaryUnsafe();
284 PdfArray& GetArrayUnsafe();
288 bool tryGetDictionary(PdfDictionary*& dict)
const;
289 bool tryGetArray(PdfArray*& arr)
const;
290 bool tryGetName(
const PdfName*& name)
const;
291 bool tryGetString(
const PdfString*& str)
const;
323 template <
typename T>
327 PrimitiveMember(T value)
332 if (std::is_same_v<T, int64_t>)
334 else if (std::is_same_v<T, double>)
336 else if (std::is_same_v<T, bool>)
338 else if (std::is_same_v<T, PdfDictionary*>)
340 else if (std::is_same_v<T, PdfArray*>)
342 else if (std::is_same_v<T, PdfData*>)
368 PrimitiveMember<int64_t> m_Number;
369 PrimitiveMember<double> m_Real;
370 PrimitiveMember<bool> m_Bool;
371 PrimitiveMember<PdfDictionary*> m_Dictionary;
372 PrimitiveMember<PdfArray*> m_Array;
373 PrimitiveMember<PdfData*> m_Data;
An interface for writing blocks of data to a data source.
Definition OutputStream.h:15
This class represents a PdfArray Use it for all arrays that are written to a PDF file.
Definition PdfArray.h:77
A PdfDataProvider object with a PdfObject owner, specialized in holding objects.
Definition PdfDataContainer.h:18
A class to inherit for classes that are stored as union members in a PdfVariant.
Definition PdfBaseDataTypes.h:18
A datatype that allows to write arbitrary data to a PDF file.
Definition PdfData.h:20
The PDF dictionary data type of PoDoFo (inherits from PdfDataContainer, the base class for such repre...
Definition PdfDictionary.h:77
This class represents a PdfName.
Definition PdfName.h:22
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:20
A string that can be written to a PDF document.
Definition PdfString.h:22
std::string ToString(PdfWriteFlags writeFlags=PdfWriteFlags::None) const
Converts the current object into a string representation which can be written directly to a PDF file ...
Definition PdfVariant.cpp:202
bool IsRawData() const
Definition PdfVariant.cpp:988
PdfString m_String
Holds references, strings, names, dictionaries and arrays.
Definition PdfVariant.h:365
PdfReference GetReference() const
Get the reference values of this object.
Definition PdfVariant.cpp:778
bool IsNumber() const
Definition PdfVariant.cpp:952
int64_t GetNumber() const
Get the value of the object as int64_t.
Definition PdfVariant.cpp:629
void SetBool(bool value)
Set the value of this object as bool.
Definition PdfVariant.cpp:899
const PdfString & GetString() const
Definition PdfVariant.cpp:700
double GetRealStrict() const
Get the value of the object as floating point number.
Definition PdfVariant.cpp:679
bool operator!=(const PdfVariant &rhs) const
Definition PdfVariant.cpp:492
bool IsString() const
Definition PdfVariant.cpp:968
double GetReal() const
Get the value of the object as a floating point.
Definition PdfVariant.cpp:650
bool IsBool() const
Definition PdfVariant.cpp:947
PdfVariant & operator=(const PdfVariant &rhs)
Assign the values of another PdfVariant to this one.
Definition PdfVariant.cpp:232
void SetReal(double value)
Set the value of this object as double.
Definition PdfVariant.cpp:915
bool IsArray() const
Definition PdfVariant.cpp:978
void Write(OutputStream &stream, PdfWriteFlags writeMode, const PdfStatefulEncrypt *encrypt, charbuff &buffer) const
Write the complete variant to an output device.
Definition PdfVariant.cpp:121
const PdfArray & GetArray() const
Returns the value of the object as array.
Definition PdfVariant.cpp:799
bool IsReference() const
Definition PdfVariant.cpp:998
std::string_view GetDataTypeString() const
Definition PdfVariant.cpp:379
bool IsNull() const
Definition PdfVariant.cpp:993
bool GetBool() const
Get the value if this object is a bool.
Definition PdfVariant.cpp:579
void SetString(const PdfString &str)
Set the string value of this object.
Definition PdfVariant.cpp:931
bool operator==(const PdfVariant &rhs) const
Test to see if the value contained by this variant is the same as the value of the other variant.
Definition PdfVariant.cpp:410
int64_t GetNumberLenient() const
Get the value of the object as int64_t.
Definition PdfVariant.cpp:600
const PdfName & GetName() const
Definition PdfVariant.cpp:739
const PdfDictionary & GetDictionary() const
Returns the dictionary value of this object.
Definition PdfVariant.cpp:827
bool IsNumberOrReal() const
Definition PdfVariant.cpp:962
void SetName(const PdfName &name)
Set the name value of this object.
Definition PdfVariant.cpp:923
void SetNumber(int64_t value)
Set the value of this object as int64_t.
Definition PdfVariant.cpp:907
bool IsDictionary() const
Definition PdfVariant.cpp:983
PdfVariant()
Construct an empty variant type IsNull() will return true.
Definition PdfVariant.cpp:22
bool IsName() const
Definition PdfVariant.cpp:973
bool IsRealStrict() const
Definition PdfVariant.cpp:957
All classes, functions, types and enums of PoDoFo are members of these namespace.
Definition basetypes.h:13
PdfDataType
Every PDF datatype that can occur in a PDF file is referenced by an own enum (e.g.
Definition PdfDeclarations.h:152
@ Dictionary
A dictionary associates keys with values. A key can have another dictionary as value.
Definition PdfDeclarations.h:160
@ Array
An array of other PDF data types.
Definition PdfDeclarations.h:159
@ Real
Real datatype for floating point numbers.
Definition PdfDeclarations.h:156
@ Unknown
The Datatype is unknown. The value is chosen to enable value storage in 8-bit unsigned integer.
Definition PdfDeclarations.h:153
@ Number
Number datatype for integer values.
Definition PdfDeclarations.h:155
@ Bool
Boolean datatype: Accepts the values "true" and "false".
Definition PdfDeclarations.h:154
@ RawData
Raw PDF data.
Definition PdfDeclarations.h:163
PdfWriteFlags
Specify additional options for writing the PDF.
Definition PdfDeclarations.h:136