PoDoFo 0.9.20
|
#include <PdfObject.h>
Public Member Functions | |
PdfObject () | |
PdfObject (const PdfVariant &var) | |
PdfObject (bool b) | |
PdfObject (int64_t l) | |
PdfObject (double d) | |
PdfObject (const PdfString &str) | |
PdfObject (const PdfName &name) | |
PdfObject (const PdfReference &ref) | |
PdfObject (const PdfArray &arr) | |
PdfObject (const PdfDictionary &dict) | |
PdfObject (const PdfObject &rhs) | |
PdfDataType | GetDataType () const |
const char * | 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 () const |
bool | GetBool () const |
int64_t | GetNumberLenient () const |
int64_t | GetNumber () const |
double | GetReal () const |
double | GetRealStrict () const |
const PdfString & | GetString () const |
const PdfName & | GetName () const |
PdfReference | GetReference () const |
const PdfArray & | GetArray () const |
const PdfDictionary & | GetDictionary () const |
void | SetBool (bool b) |
void | SetNumber (int64_t l) |
void | SetReal (double d) |
void | SetName (const PdfName &name) |
void | SetString (const PdfString &str) |
void | Write (OutputStream &stream, PdfWriteFlags writeMode, const PdfEncrypt *encrypt, charbuff &buffer) const |
PdfObjectStream & | GetOrCreateStream () |
const PdfObjectStream & | MustGetStream () const |
PdfObjectStream & | MustGetStream () |
bool | HasStream () const |
bool | operator< (const PdfObject &rhs) const |
bool | operator== (const PdfObject &rhs) const |
bool | operator!= (const PdfObject &rhs) const |
bool | operator== (const PdfVariant &rhs) const |
bool | operator!= (const PdfVariant &rhs) const |
PdfObject & | operator= (const PdfObject &rhs) |
bool | IsDirty () const |
PdfDocument * | GetDocument () const |
PdfDocument & | MustGetDocument () const |
const PdfReference & | GetIndirectReference () const |
bool | IsDelayedLoadDone () const |
Protected Member Functions | |
void | DelayedLoad () const |
virtual void | DelayedLoadImpl () |
void | SetDirty () |
void | SetDocument (PdfDocument *document) |
void | EnableDelayedLoading () |
This class represents a PDF indirect Object in memory
It is possible to manipulate the stream which can be appended to the object (if the object is of underlying type dictionary). A PdfObject is uniquely identified by an object number and a generation number which has to be passed to the constructor.
The object can be written to a file easily using the Write() function.
PdfObject::PdfObject | ( | ) |
Create a PDF object with an empty PdfDictionary.
PdfObject::PdfObject | ( | const PdfVariant & | var | ) |
Create a PDF object with the passed variant.
var | the value of the object |
PdfObject::PdfObject | ( | bool | b | ) |
PdfObject::PdfObject | ( | int64_t | l | ) |
PdfObject::PdfObject | ( | double | d | ) |
PdfObject::PdfObject | ( | const PdfString & | str | ) |
PdfObject::PdfObject | ( | const PdfName & | name | ) |
PdfObject::PdfObject | ( | const PdfReference & | ref | ) |
Construct a PdfObject with PdfReference as value.
ref | the value of the this PdfObject |
PdfObject::PdfObject | ( | const PdfArray & | arr | ) |
PdfObject::PdfObject | ( | const PdfDictionary & | dict | ) |
Construct a PdfObject with PdfDictionary as value.
dict | the value of the this PdfObject |
PdfObject::PdfObject | ( | const PdfObject & | rhs | ) |
|
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.
|
protectedvirtual |
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, and PoDoFo::PdfXRefStreamParserObject.
|
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 & PdfObject::GetArray | ( | ) | const |
Returns the value of the object as array
bool PdfObject::GetBool | ( | ) | const |
Get the value if this object is a bool.
PdfDataType PdfObject::GetDataType | ( | ) | const |
const char * PdfObject::GetDataTypeString | ( | ) | const |
const PdfDictionary & PdfObject::GetDictionary | ( | ) | const |
Returns the dictionary value of this object
|
inline |
Get the document of this object.
|
inline |
Get an indirect reference to this object.
const PdfName & PdfObject::GetName | ( | ) | const |
int64_t PdfObject::GetNumber | ( | ) | const |
Get the value of the object as int64_t
This method throws if the numer is a floating point number
int64_t PdfObject::GetNumberLenient | ( | ) | const |
Get the value of the object as int64_t.
This method is lenient and narrows floating point numbers
PdfObjectStream & PdfObject::GetOrCreateStream | ( | ) |
Get a handle to a PDF stream object. If the PDF object does not have a stream, one will be created.
double PdfObject::GetReal | ( | ) | const |
Get the value of the object as a floating point
This method is lenient and returns also strictly integral numbers
double PdfObject::GetRealStrict | ( | ) | const |
Get the value of the object as floating point number
This method throws if the numer is integer
PdfReference PdfObject::GetReference | ( | ) | const |
Get the reference values of this object.
const PdfString & PdfObject::GetString | ( | ) | const |
bool PdfObject::HasStream | ( | ) | const |
Check if this object has a PdfObjectStream object appended.
bool PdfObject::IsArray | ( | ) | const |
bool PdfObject::IsBool | ( | ) | const |
|
inline |
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.
bool PdfObject::IsDictionary | ( | ) | 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 PdfObject::IsName | ( | ) | const |
bool PdfObject::IsNull | ( | ) | const |
bool PdfObject::IsNumber | ( | ) | const |
bool PdfObject::IsNumberOrReal | ( | ) | const |
bool PdfObject::IsRawData | ( | ) | const |
bool PdfObject::IsRealStrict | ( | ) | const |
This method strictly check for a floating point number and return false on integer
bool PdfObject::IsReference | ( | ) | const |
bool PdfObject::IsString | ( | ) | const |
PdfDocument & PdfObject::MustGetDocument | ( | ) | const |
Get the document of this object.
PdfObjectStream & PdfObject::MustGetStream | ( | ) |
Get a handle to a const PDF stream object. Throws if there's no stream
const PdfObjectStream & PdfObject::MustGetStream | ( | ) | const |
Get a handle to a const PDF stream object. Throws if there's no stream
bool PdfObject::operator!= | ( | const PdfObject & | rhs | ) | const |
The disequality operator with PdfObject checks for parent document and indirect reference first
bool PdfObject::operator!= | ( | const PdfVariant & | rhs | ) | const |
The disequality operator with PdfVariant checks disequality with variant object only
bool PdfObject::operator< | ( | const PdfObject & | rhs | ) | const |
This operator is required for sorting a list of PdfObject instances. It compares the object number. If object numbers are equal, the generation number is compared.
bool PdfObject::operator== | ( | const PdfObject & | rhs | ) | const |
The equality operator with PdfObject checks for parent document and indirect reference first
bool PdfObject::operator== | ( | const PdfVariant & | rhs | ) | const |
The equality operator with PdfVariant checks equality with variant object only
void PdfObject::SetBool | ( | bool | b | ) |
Set the value of this object as bool
b | the value as bool. |
This will set the dirty flag of this object.
|
protected |
Sets the dirty flag of this PdfVariant
|
protected |
Set the owner of this object, i.e. the PdfIndirectObjectList to which this object belongs.
objects | a vector of pdf objects |
void PdfObject::SetName | ( | const PdfName & | name | ) |
Set the name value of this object
d | the name value |
This will set the dirty flag of this object.
void PdfObject::SetNumber | ( | int64_t | l | ) |
Set the value of this object as int64_t
l | the value as int64_t. |
This will set the dirty flag of this object.
void PdfObject::SetReal | ( | double | d | ) |
Set the value of this object as double
d | the value as double. |
This will set the dirty flag of this object.
void PdfObject::SetString | ( | const PdfString & | str | ) |
Set the string value of this object.
str | the string value |
This will set the dirty flag of this object.
string PdfObject::ToString | ( | ) | 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 PdfObject::Write | ( | OutputStream & | stream, |
PdfWriteFlags | writeMode, | ||
const PdfEncrypt * | encrypt, | ||
charbuff & | buffer ) const |
Write the complete object to a file.
stream | write the object to this device |
encrypt | an encryption object which is used to encrypt this object or nullptr to not encrypt this object |
writeMode | additional options for writing the object |
keyStop | if not KeyNull and a key == keyStop is found writing will stop right before this key! |