PoDoFo 0.7.0
|
#include <PdfVariant.h>
Public Member Functions | |
PdfVariant () | |
PdfVariant (bool b) | |
PdfVariant (pdf_int64 l) | |
PdfVariant (double d) | |
PdfVariant (const PdfString &rsString) | |
PdfVariant (const PdfName &rName) | |
PdfVariant (const PdfReference &rRef) | |
PdfVariant (const PdfArray &tList) | |
PdfVariant (const PdfDictionary &rDict) | |
PdfVariant (const PdfData &rData) | |
PdfVariant (const PdfVariant &rhs) | |
bool | IsEmpty () const |
void | Clear () |
EPdfDataType | GetDataType () const |
const char * | GetDataTypeString () const |
bool | IsBool () const |
bool | IsNumber () const |
bool | IsReal () const |
bool | IsString () const |
bool | IsHexString () const |
bool | IsName () const |
bool | IsArray () const |
bool | IsDictionary () const |
bool | IsRawData () const |
bool | IsNull () const |
bool | IsReference () const |
void | Write (PdfOutputDevice *pDevice, EPdfWriteMode eWriteMode, const PdfEncrypt *pEncrypt=NULL) const |
virtual void | Write (PdfOutputDevice *pDevice, EPdfWriteMode eWriteMode, const PdfEncrypt *pEncrypt, const PdfName &keyStop) const |
void | ToString (std::string &rsData, EPdfWriteMode eWriteMode=ePdfWriteMode_Clean) const |
void | SetBool (bool b) |
bool | GetBool () const |
void | SetNumber (long l) |
pdf_int64 | GetNumber () const |
void | SetReal (double d) |
double | GetReal () const |
const PdfString & | GetString () const |
const PdfName & | GetName () const |
const PdfArray & | GetArray () const |
PdfArray & | GetArray () |
const PdfDictionary & | GetDictionary () const |
PdfDictionary & | GetDictionary () |
const PdfReference & | GetReference () const |
const PdfData & | GetRawData () const |
PdfData & | GetRawData () |
const PdfVariant & | operator= (const PdfVariant &rhs) |
bool | operator== (const PdfVariant &rhs) const |
bool | operator!= (const PdfVariant &rhs) const |
bool | IsDirty () const |
void | SetImmutable (bool bImmutable) |
bool | GetImmutable () const |
Protected Member Functions | |
void | AssertMutable () const |
void | SetDirty (bool bDirty) |
void | DelayedLoad () const |
void | EnableDelayedLoading () |
virtual void | DelayedLoadImpl () |
PODOFO_NOTHROW bool | DelayedLoadDone () const |
const PdfDictionary & | GetDictionary_NoDL () const |
PdfDictionary & | GetDictionary_NoDL () |
const PdfArray & | GetArray_NoDL () const |
PdfArray & | GetArray_NoDL () |
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.
TODO: domseichter: Make this class implicitly shared
PoDoFo::PdfVariant::PdfVariant | ( | ) |
Construct an empty variant type IsNull() will return true.
PoDoFo::PdfVariant::PdfVariant | ( | bool | b | ) |
Construct a PdfVariant that is a bool.
b | the boolean value of this PdfVariant |
PoDoFo::PdfVariant::PdfVariant | ( | pdf_int64 | l | ) |
Construct a PdfVariant that is a number.
l | the value of the number. |
PoDoFo::PdfVariant::PdfVariant | ( | double | d | ) |
Construct a PdfVariant that is a real number.
d | the value of the real number. |
PoDoFo::PdfVariant::PdfVariant | ( | const PdfString & | rsString | ) |
Construct a PdfVariant that is a string. The argument string will be escaped where necessary, so it should be passed in unescaped form.
rsString | the value of the string |
PoDoFo::PdfVariant::PdfVariant | ( | const PdfName & | rName | ) |
Construct a PdfVariant that is a name.
rName | the value of the name |
PoDoFo::PdfVariant::PdfVariant | ( | const PdfReference & | rRef | ) |
Construct a PdfVariant that is a name.
rRef | the value of the name |
PoDoFo::PdfVariant::PdfVariant | ( | const PdfArray & | tList | ) |
Initalize a PdfVariant object with array data. The variant will automatically get the datatype ePdfDataType_Array. This Init call is the fastest way to create a new PdfVariant that is an array.
tList | a list of variants |
PoDoFo::PdfVariant::PdfVariant | ( | const PdfDictionary & | rDict | ) |
Construct a PdfVariant that is a dictionary.
rDict | the value of the dictionary. |
PoDoFo::PdfVariant::PdfVariant | ( | const PdfData & | rData | ) |
Construct a PdfVariant that contains raw PDF data.
rData | raw and valid PDF data. |
PoDoFo::PdfVariant::PdfVariant | ( | const PdfVariant & | rhs | ) |
Constructs a new PdfVariant which has the same contents as rhs.
rhs | an existing variant which is copied. |
void PoDoFo::PdfVariant::AssertMutable | ( | ) | const [inline, protected] |
Will throw an exception if called on an immutable object, so this should be called before actually changing a value!
void PoDoFo::PdfVariant::Clear | ( | ) |
Clear all internal member variables and free the memory they have allocated. Sets the datatype to ePdfDataType_Null
This will reset the dirty flag of this object to be clean.
void PoDoFo::PdfVariant::DelayedLoad | ( | ) | const [inline, protected] |
Dynamically load the contents of this object from a PDF file by calling the virtual method DelayedLoadImpl() if the object is not already loaded.
For objects complete created in memory and those that do not support deferred loading this function does nothing, since deferred loading will not be enabled.
bool PoDoFo::PdfVariant::DelayedLoadDone | ( | ) | const [inline, protected] |
Returns true if delayed loading is disabled, or if it is enabled and loading has completed. External callers should never need to see this, it's an internal state flag only.
void PoDoFo::PdfVariant::DelayedLoadImpl | ( | ) | [inline, protected, virtual] |
Load all data of the object if delayed loading is enabled.
Never call this method directly; use DelayedLoad() instead.
You should override this to control deferred loading in your subclass. Note that this method should not load any associated streams, just the base object.
The default implementation throws. It should never be called, since objects that do not support delayed loading should not enable it.
While this method is not `const' it may be called from a const context, so be careful what you mess with.
Reimplemented in PoDoFo::PdfParserObject.
void PoDoFo::PdfVariant::EnableDelayedLoading | ( | ) | [inline, protected] |
Flag the object incompletely loaded. DelayedLoad() will be called when any method that requires more information than is currently available is loaded.
All constructors initialize a PdfVariant with delayed loading disabled . If you want delayed loading you must ask for it. If you do so, call this method early in your ctor and be sure to override DelayedLoadImpl().
const PdfArray & PoDoFo::PdfVariant::GetArray | ( | ) | const [inline] |
Returns the value of the object as array
PdfArray & PoDoFo::PdfVariant::GetArray | ( | ) | [inline] |
Returns the value of the object as array
const PdfArray & PoDoFo::PdfVariant::GetArray_NoDL | ( | ) | const [inline, protected] |
Version of GetArray() that doesn't trigger a delayed load
PdfArray & PoDoFo::PdfVariant::GetArray_NoDL | ( | ) | [inline, protected] |
Version of GetArray() that doesn't trigger a delayed load.
bool PoDoFo::PdfVariant::GetBool | ( | ) | const [inline] |
Get the value if this object is a bool.
EPdfDataType PoDoFo::PdfVariant::GetDataType | ( | ) | const [inline] |
const char * PoDoFo::PdfVariant::GetDataTypeString | ( | ) | const |
const PdfDictionary & PoDoFo::PdfVariant::GetDictionary | ( | ) | const [inline] |
Returns the dictionary value of this object
PdfDictionary & PoDoFo::PdfVariant::GetDictionary | ( | ) | [inline] |
Returns the dictionary value of this object
const PdfDictionary & PoDoFo::PdfVariant::GetDictionary_NoDL | ( | ) | const [inline, protected] |
Version of GetDictionary() that doesn't trigger a delayed load
PdfDictionary & PoDoFo::PdfVariant::GetDictionary_NoDL | ( | ) | [inline, protected] |
Version of GetDictionary() that doesn't trigger a delayed load
bool PoDoFo::PdfVariant::GetImmutable | ( | ) | const [inline] |
Retrieve if an object is immutable.
This is used by PdfImmediateWriter and PdfStreamedDocument so that no keys can be added to an object after setting stream data on it.
const PdfName & PoDoFo::PdfVariant::GetName | ( | ) | const [inline] |
pdf_int64 PoDoFo::PdfVariant::GetNumber | ( | ) | const [inline] |
Get the value of the object as long.
PdfData & PoDoFo::PdfVariant::GetRawData | ( | ) | [inline] |
Get the reference values of this object.
const PdfData & PoDoFo::PdfVariant::GetRawData | ( | ) | const [inline] |
Get the reference values of this object.
double PoDoFo::PdfVariant::GetReal | ( | ) | const [inline] |
Get the value of the object as double.
const PdfReference & PoDoFo::PdfVariant::GetReference | ( | ) | const [inline] |
Get the reference values of this object.
const PdfString & PoDoFo::PdfVariant::GetString | ( | ) | const [inline] |
bool PoDoFo::PdfVariant::IsArray | ( | ) | const [inline] |
bool PoDoFo::PdfVariant::IsBool | ( | ) | const [inline] |
bool PoDoFo::PdfVariant::IsDictionary | ( | ) | const [inline] |
bool PoDoFo::PdfVariant::IsDirty | ( | ) | const [inline] |
The dirty flag is set if this variant has been modified after construction.
Usually the dirty flag is also set if you call any non-const member function (e.g. GetDictionary()) as PdfVariant cannot determine if you actually changed the dictionary or not.
bool PoDoFo::PdfVariant::IsEmpty | ( | ) | const [inline] |
bool PoDoFo::PdfVariant::IsHexString | ( | ) | const [inline] |
bool PoDoFo::PdfVariant::IsName | ( | ) | const [inline] |
bool PoDoFo::PdfVariant::IsNull | ( | ) | const [inline] |
bool PoDoFo::PdfVariant::IsNumber | ( | ) | const [inline] |
bool PoDoFo::PdfVariant::IsRawData | ( | ) | const [inline] |
bool PoDoFo::PdfVariant::IsReal | ( | ) | const [inline] |
bool PoDoFo::PdfVariant::IsReference | ( | ) | const [inline] |
bool PoDoFo::PdfVariant::IsString | ( | ) | const [inline] |
bool PoDoFo::PdfVariant::operator!= | ( | const PdfVariant & | rhs | ) | const [inline] |
const PdfVariant & PoDoFo::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.
bool PoDoFo::PdfVariant::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.
void PoDoFo::PdfVariant::SetBool | ( | bool | b | ) | [inline] |
Set the value of this object as bool
b | the value as bool. |
This will set the dirty flag of this object.
void PoDoFo::PdfVariant::SetDirty | ( | bool | bDirty | ) | [inline, protected] |
Sets the dirty flag of this PdfVariant
bDirty | true if this PdfVariant has been modified from the outside |
void PoDoFo::PdfVariant::SetImmutable | ( | bool | bImmutable | ) | [inline] |
Sets this object to immutable, so that no keys can be edited or changed.
bImmutable | if true set the object to be immutable |
This is used by PdfImmediateWriter and PdfStreamedDocument so that no keys can be added to an object after setting stream data on it.
void PoDoFo::PdfVariant::SetNumber | ( | long | l | ) | [inline] |
Set the value of this object as long
l | the value as long. |
This will set the dirty flag of this object.
void PoDoFo::PdfVariant::SetReal | ( | double | d | ) | [inline] |
Set the value of this object as double
d | the value as double. |
This will set the dirty flag of this object.
void PoDoFo::PdfVariant::ToString | ( | std::string & | rsData, |
EPdfWriteMode | eWriteMode = ePdfWriteMode_Clean |
||
) | const |
Converts the current object into a string representation which can be written directly to a PDF file on disc.
rsData | the object string is returned in this object. |
eWriteMode | additional options for writing to a string |
void PoDoFo::PdfVariant::Write | ( | PdfOutputDevice * | pDevice, |
EPdfWriteMode | eWriteMode, | ||
const PdfEncrypt * | pEncrypt = NULL |
||
) | const |
Write the complete variant to an output device. This is an overloaded member function.
pDevice | write the object to this device |
eWriteMode | additional options for writing this object |
pEncrypt | an encryption object which is used to encrypt this object or NULL to not encrypt this object |
void PoDoFo::PdfVariant::Write | ( | PdfOutputDevice * | pDevice, |
EPdfWriteMode | eWriteMode, | ||
const PdfEncrypt * | pEncrypt, | ||
const PdfName & | keyStop | ||
) | const [virtual] |
Write the complete variant to an output device.
pDevice | write the object to this device |
eWriteMode | additional options for writing this object |
pEncrypt | an encryption object which is used to encrypt this object or NULL to not encrypt this object |
keyStop | if not KeyNull and a key == keyStop is found writing will stop right before this key! if IsDictionary returns true. |