PoDoFo::PdfVariant Class Reference
#include <PdfVariant.h>
List of all members.
Detailed Description
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.
- Warning:
- All methods not marked otherwise may trigger a deferred load. This means that they are unsafe to call while a deferred load is already in progress (as recursion will occurr).
TODO: domseichter: Make this class implicitly shared
Constructor & Destructor Documentation
PoDoFo::PdfVariant::PdfVariant |
( |
|
) |
|
Construct an empty variant type IsNull() will return true.
PoDoFo::PdfVariant::PdfVariant |
( |
bool |
b |
) |
|
Construct a PdfVariant that is a bool.
- Parameters:
-
PoDoFo::PdfVariant::PdfVariant |
( |
long |
l |
) |
|
Construct a PdfVariant that is a number.
- Parameters:
-
| l | the value of the number. |
PoDoFo::PdfVariant::PdfVariant |
( |
double |
d |
) |
|
Construct a PdfVariant that is a real number.
- Parameters:
-
| 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.
- Parameters:
-
| rsString | the value of the string |
PoDoFo::PdfVariant::PdfVariant |
( |
const PdfName & |
rName |
) |
|
Construct a PdfVariant that is a name.
- Parameters:
-
| rName | the value of the name |
PoDoFo::PdfVariant::PdfVariant |
( |
const PdfReference & |
rRef |
) |
|
Construct a PdfVariant that is a name.
- Parameters:
-
| 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.
- Parameters:
-
- Returns:
- ErrOk on sucess
PoDoFo::PdfVariant::PdfVariant |
( |
const PdfDictionary & |
rDict |
) |
|
Construct a PdfVariant that is a dictionary.
- Parameters:
-
| rDict | the value of the dictionary. |
PoDoFo::PdfVariant::PdfVariant |
( |
const PdfData & |
rData |
) |
|
Construct a PdfVariant that contains raw PDF data.
- Parameters:
-
| rData | raw and valid PDF data. |
PoDoFo::PdfVariant::PdfVariant |
( |
const PdfVariant & |
rhs |
) |
|
Constructs a new PdfVariant which has the same contents as rhs.
- Parameters:
-
| rhs | an existing variant which is copied. |
Member Function Documentation
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.
- See also:
- IsDirty
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().
PdfArray & PoDoFo::PdfVariant::GetArray |
( |
|
) |
[inline] |
Returns the value of the object as array
- Returns:
- a array
const PdfArray & PoDoFo::PdfVariant::GetArray |
( |
|
) |
const [inline] |
Returns the value of the object as array
- Returns:
- a array
PdfArray & PoDoFo::PdfVariant::GetArray_NoDL |
( |
|
) |
[inline, protected] |
Version of GetArray() that doesn't trigger a delayed load.
- Returns:
- a array
const PdfArray & PoDoFo::PdfVariant::GetArray_NoDL |
( |
|
) |
const [inline, protected] |
Version of GetArray() that doesn't trigger a delayed load
- Returns:
- a array
bool PoDoFo::PdfVariant::GetBool |
( |
|
) |
const [inline] |
Get the value if this object is a bool.
- Returns:
- the bool value.
EPdfDataType PoDoFo::PdfVariant::GetDataType |
( |
|
) |
const [inline] |
- Returns:
- the datatype of this object or ePdfDataType_Unknown if it does not have a value.
const char * PoDoFo::PdfVariant::GetDataTypeString |
( |
|
) |
const |
- Returns:
- a human readable string representation of GetDataType() The returned string must not be free'd.
PdfDictionary & PoDoFo::PdfVariant::GetDictionary |
( |
|
) |
[inline] |
Returns the dictionary value of this object
- Returns:
- a PdfDictionary
const PdfDictionary & PoDoFo::PdfVariant::GetDictionary |
( |
|
) |
const [inline] |
Returns the dictionary value of this object
- Returns:
- a PdfDictionary
PdfDictionary & PoDoFo::PdfVariant::GetDictionary_NoDL |
( |
|
) |
[inline, protected] |
Version of GetDictionary() that doesn't trigger a delayed load
- Returns:
- a PdfDictionary
const PdfDictionary & PoDoFo::PdfVariant::GetDictionary_NoDL |
( |
|
) |
const [inline, protected] |
Version of GetDictionary() that doesn't trigger a delayed load
- Returns:
- a PdfDictionary
const PdfName & PoDoFo::PdfVariant::GetName |
( |
|
) |
const [inline] |
- Returns:
- the value of the object as name
long PoDoFo::PdfVariant::GetNumber |
( |
|
) |
const [inline] |
Get the value of the object as long.
- Returns:
- the value of the number
double PoDoFo::PdfVariant::GetReal |
( |
|
) |
const [inline] |
Get the value of the object as double.
- Returns:
- the value of the number
const PdfReference & PoDoFo::PdfVariant::GetReference |
( |
|
) |
const [inline] |
Get the reference values of this object.
- Returns:
- a PdfReference
const PdfString & PoDoFo::PdfVariant::GetString |
( |
|
) |
const [inline] |
- Returns:
- the value of the object as string.
bool PoDoFo::PdfVariant::IsArray |
( |
|
) |
const [inline] |
- Returns:
- true if this variant is an array (i.e. GetDataType() == ePdfDataType_Array)
bool PoDoFo::PdfVariant::IsBool |
( |
|
) |
const [inline] |
- Returns:
- true if this variant is a bool (i.e. GetDataType() == ePdfDataType_Bool)
bool PoDoFo::PdfVariant::IsDictionary |
( |
|
) |
const [inline] |
- Returns:
- true if this variant is a dictionary (i.e. GetDataType() == ePdfDataType_Dictionary)
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.
- Returns:
- true if the value is dirty and has been modified since construction
bool PoDoFo::PdfVariant::IsEmpty |
( |
|
) |
const [inline] |
- Returns:
- true if this PdfVariant is empty. i.e. m_eDataType == ePdfDataType_Null
bool PoDoFo::PdfVariant::IsHexString |
( |
|
) |
const [inline] |
- Returns:
- true if this variant is a hex-string (i.e. GetDataType() == ePdfDataType_HexString)
bool PoDoFo::PdfVariant::IsName |
( |
|
) |
const [inline] |
- Returns:
- true if this variant is a name (i.e. GetDataType() == ePdfDataType_Name)
bool PoDoFo::PdfVariant::IsNull |
( |
|
) |
const [inline] |
- Returns:
- true if this variant is null (i.e. GetDataType() == ePdfDataType_Null)
bool PoDoFo::PdfVariant::IsNumber |
( |
|
) |
const [inline] |
- Returns:
- true if this variant is a number (i.e. GetDataType() == ePdfDataType_Number)
bool PoDoFo::PdfVariant::IsRawData |
( |
|
) |
const [inline] |
- Returns:
- true if this variant is raw data (i.e. GetDataType() == ePdfDataType_RawData
bool PoDoFo::PdfVariant::IsReal |
( |
|
) |
const [inline] |
- Returns:
- true if this variant is a real (i.e. GetDataType() == ePdfDataType_Real)
bool PoDoFo::PdfVariant::IsReference |
( |
|
) |
const [inline] |
- Returns:
- true if this variant is a reference (i.e. GetDataType() == ePdfDataType_Reference)
bool PoDoFo::PdfVariant::IsString |
( |
|
) |
const [inline] |
- Returns:
- true if this variant is a string (i.e. GetDataType() == ePdfDataType_String)
bool PoDoFo::PdfVariant::operator!= |
( |
const PdfVariant & |
rhs |
) |
const [inline] |
Assign the values of another PdfVariant to this one.
- Parameters:
-
| rhs | an existing variant which is copied. |
This will set the dirty flag of this object.
- See also:
- IsDirty
Reimplemented in PoDoFo::PdfObject.
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.
Reimplemented in PoDoFo::PdfObject.
void PoDoFo::PdfVariant::SetBool |
( |
bool |
b |
) |
[inline] |
Set the value of this object as bool
- Parameters:
-
This will set the dirty flag of this object.
- See also:
- IsDirty
void PoDoFo::PdfVariant::SetDirty |
( |
bool |
bDirty |
) |
[inline, protected] |
void PoDoFo::PdfVariant::SetNumber |
( |
long |
l |
) |
[inline] |
Set the value of this object as long
- Parameters:
-
This will set the dirty flag of this object.
- See also:
- IsDirty
void PoDoFo::PdfVariant::SetReal |
( |
double |
d |
) |
[inline] |
Set the value of this object as double
- Parameters:
-
This will set the dirty flag of this object.
- See also:
- IsDirty
void PoDoFo::PdfVariant::ToString |
( |
std::string & |
rsData |
) |
const |
Converts the current object into a string representation which can be written directly to a PDF file on disc.
- Parameters:
-
| rsData | the object string is returned in this object. |
Write the complete variant to an output device.
- Parameters:
-
| pDevice | write the object to this device |
| 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. |
Write the complete variant to an output device. This is an overloaded member function.
- Parameters:
-
| pDevice | write the object to this device |
| pEncrypt | an encryption object which is used to encrypt this object or NULL to not encrypt this object |