|
PoDoFo 1.1.0
|
A variant data type which supports all data types supported by the PDF standard. More...
#include <PdfVariant.h>
Public Member Functions | |
| PdfVariant () | |
| Construct an empty variant type IsNull() will return true. | |
| PdfVariant (bool value) | |
| Construct a PdfVariant that is a bool. | |
| PdfVariant (int64_t value) | |
| Construct a PdfVariant that is a number. | |
| PdfVariant (double value) | |
| Construct a PdfVariant that is a real number. | |
| PdfVariant (const PdfString &str) | |
| Construct a PdfVariant that is a string. | |
| PdfVariant (const PdfName &name) | |
| Construct a PdfVariant that is a name. | |
| PdfVariant (const PdfReference &ref) | |
| Construct a PdfVariant that is a name. | |
| PdfVariant (const PdfArray &arr) | |
| Construct a PdfVariant object with array data. | |
| PdfVariant (PdfArray &&arr) noexcept | |
| PdfVariant (const PdfDictionary &dict) | |
| Construct a PdfVariant that is a dictionary. | |
| PdfVariant (PdfDictionary &&dict) noexcept | |
| PdfVariant (const PdfData &data) | |
| Construct a PdfVariant that contains raw PDF data. | |
| PdfVariant (PdfData &&data) noexcept | |
| PdfVariant (const PdfVariant &rhs) | |
| Constructs a new PdfVariant which has the same contents as rhs. | |
| PdfVariant (PdfVariant &&rhs) noexcept | |
| std::string_view | GetDataTypeString () const |
| bool | IsBool () const |
| bool | IsNumber () const |
| bool | IsRealStrict () const |
| bool | IsNumberOrReal () const |
| bool | IsString () const |
| bool | IsName () const |
| bool | IsArray () const |
| bool | IsDictionary () const |
| bool | IsRawData () const |
| bool | IsNull () const |
| bool | IsReference () const |
| 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 on disc. | |
| void | ToString (std::string &str, PdfWriteFlags writeFlags=PdfWriteFlags::None) const |
| bool | GetBool () const |
| Get the value if this object is a bool. | |
| bool | TryGetBool (bool &value) const |
| int64_t | GetNumberLenient () const |
| Get the value of the object as int64_t. | |
| bool | TryGetNumberLenient (int64_t &value) const |
| int64_t | GetNumber () const |
| Get the value of the object as int64_t. | |
| bool | TryGetNumber (int64_t &value) const |
| double | GetReal () const |
| Get the value of the object as a floating point. | |
| bool | TryGetReal (double &value) const |
| double | GetRealStrict () const |
| Get the value of the object as floating point number. | |
| bool | TryGetRealStrict (double &value) const |
| const PdfString & | GetString () const |
| bool | TryGetString (PdfString &str) const |
| bool | TryGetString (const PdfString *&str) const |
| const PdfName & | GetName () const |
| bool | TryGetName (PdfName &name) const |
| bool | TryGetName (const PdfName *&name) const |
| PdfReference | GetReference () const |
| Get the reference values of this object. | |
| bool | TryGetReference (PdfReference &ref) const |
| const PdfArray & | GetArray () const |
| Returns the value of the object as array. | |
| PdfArray & | GetArray () |
| bool | TryGetArray (const PdfArray *&arr) const |
| bool | TryGetArray (PdfArray *&arr) |
| const PdfDictionary & | GetDictionary () const |
| Returns the dictionary value of this object. | |
| PdfDictionary & | GetDictionary () |
| bool | TryGetDictionary (const PdfDictionary *&dict) const |
| bool | TryGetDictionary (PdfDictionary *&dict) |
| void | SetBool (bool value) |
| Set the value of this object as bool. | |
| void | SetNumber (int64_t value) |
| Set the value of this object as int64_t. | |
| void | SetReal (double value) |
| Set the value of this object as double. | |
| void | SetName (const PdfName &name) |
| Set the name value of this object. | |
| void | SetString (const PdfString &str) |
| Set the string value of this object. | |
| void | SetReference (const PdfReference &ref) |
| void | Write (OutputStream &stream, PdfWriteFlags writeMode, const PdfStatefulEncrypt *encrypt, charbuff &buffer) const |
| Write the complete variant to an output device. | |
| PdfVariant & | operator= (const PdfVariant &rhs) |
| Assign the values of another PdfVariant to this one. | |
| PdfVariant & | operator= (PdfVariant &&rhs) noexcept |
| 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. | |
| bool | operator!= (const PdfVariant &rhs) const |
| PdfDataType | GetDataType () const |
Static Public Attributes | |
| static const PdfVariant | Null |
Friends | |
| class | PdfObject |
| class | PdfArray |
| class | PdfDictionary |
| class | PdfTokenizer |
| class | PdfParser |
A variant data type which supports all data types supported by the PDF standard.
The data can be parsed directly from a string or set by one of the members. One can also convert the variant back to a string after setting the values.
| PdfVariant::PdfVariant | ( | bool | value | ) |
Construct a PdfVariant that is a bool.
| value | the boolean value of this PdfVariant |
| PdfVariant::PdfVariant | ( | int64_t | value | ) |
Construct a PdfVariant that is a number.
| value | the value of the number. |
| PdfVariant::PdfVariant | ( | double | value | ) |
Construct a PdfVariant that is a real number.
| value | the value of the real number. |
Construct a PdfVariant that is a string.
The argument string will be escaped where necessary, so it should be passed in unescaped form.
| str | the value of the string |
Construct a PdfVariant that is a name.
| name | the value of the name |
| PdfVariant::PdfVariant | ( | const PdfReference & | ref | ) |
Construct a PdfVariant that is a name.
| ref | the value of the name |
Construct a PdfVariant object with array data.
The variant will automatically get the datatype PdfDataType::Array. This constructor is the fastest way to create a new PdfVariant that is an array.
| arr | a list of variants |
| PdfVariant::PdfVariant | ( | const PdfDictionary & | dict | ) |
Construct a PdfVariant that is a dictionary.
| dict | the value of the dictionary. |
Construct a PdfVariant that contains raw PDF data.
| data | raw and valid PDF data. |
| PdfVariant::PdfVariant | ( | const PdfVariant & | rhs | ) |
Constructs a new PdfVariant which has the same contents as rhs.
| rhs | an existing variant which is copied. |
Returns the value of the object as array.
| bool PdfVariant::GetBool | ( | ) | const |
Get the value if this object is a bool.
| string_view PdfVariant::GetDataTypeString | ( | ) | const |
| const PdfDictionary & PdfVariant::GetDictionary | ( | ) | const |
Returns the dictionary value of this object.
| int64_t PdfVariant::GetNumber | ( | ) | const |
Get the value of the object as int64_t.
This method throws if the number is a floating point number
| int64_t PdfVariant::GetNumberLenient | ( | ) | const |
Get the value of the object as int64_t.
This method is lenient and narrows floating point numbers
| double PdfVariant::GetReal | ( | ) | const |
Get the value of the object as a floating point.
This method is lenient and returns also strictly integral numbers
| double PdfVariant::GetRealStrict | ( | ) | const |
Get the value of the object as floating point number.
This method throws if the number is integer
| PdfReference PdfVariant::GetReference | ( | ) | const |
Get the reference values of this object.
| bool PdfVariant::IsArray | ( | ) | const |
| bool PdfVariant::IsBool | ( | ) | const |
| bool PdfVariant::IsDictionary | ( | ) | const |
| bool PdfVariant::IsName | ( | ) | const |
| bool PdfVariant::IsNull | ( | ) | const |
| bool PdfVariant::IsNumber | ( | ) | const |
| bool PdfVariant::IsNumberOrReal | ( | ) | const |
| bool PdfVariant::IsRawData | ( | ) | const |
| bool PdfVariant::IsRealStrict | ( | ) | const |
This method strictly check for a floating point number and return false on integer
| bool PdfVariant::IsReference | ( | ) | const |
| bool PdfVariant::IsString | ( | ) | const |
| bool PdfVariant::operator!= | ( | const PdfVariant & | rhs | ) | const |
| PdfVariant & PdfVariant::operator= | ( | const PdfVariant & | rhs | ) |
Assign the values of another PdfVariant to this one.
| rhs | an existing variant which is copied. |
This will set the dirty flag of this object.
Set the value of this object as bool.
| b | the value as bool. |
This will set the dirty flag of this object.
Set the name value of this object.
| d | the name value |
This will set the dirty flag of this object.
Set the value of this object as int64_t.
| l | the value as int64_t. |
This will set the dirty flag of this object.
Set the value of this object as double.
| d | the value as double. |
This will set the dirty flag of this object.
Set the string value of this object.
| str | the string value |
This will set the dirty flag of this object.
| string PdfVariant::ToString | ( | PdfWriteFlags | writeFlags = PdfWriteFlags::None | ) | const |
Converts the current object into a string representation which can be written directly to a PDF file on disc.
| str | the object string is returned in this object. |
| void PdfVariant::Write | ( | OutputStream & | stream, |
| PdfWriteFlags | writeMode, | ||
| const PdfStatefulEncrypt * | encrypt, | ||
| charbuff & | buffer | ||
| ) | const |
Write the complete variant to an output device.
| stream | write the object to this stream |
| writeMode | additional options for writing this object |
| encrypt | an encryption object which is used to encrypt this object or nullptr to not encrypt this object |