PoDoFo
0.9.1
|
#include <PdfParserObject.h>
Public Member Functions | |
PdfParserObject (PdfVecObjects *pCreator, const PdfRefCountedInputDevice &rDevice, const PdfRefCountedBuffer &rBuffer, pdf_long lOffset=-1) | |
PdfParserObject (const PdfRefCountedBuffer &rBuffer) | |
void | ParseFile (PdfEncrypt *pEncrypt, bool bIsTrailer=false) |
bool | HasStreamToParse () const |
bool | IsLoadOnDemand () const |
void | SetLoadOnDemand (bool bDelayed) |
void | SetObjectNumber (unsigned int nObjNo) |
void | FreeObjectMemory (bool bForce=false) |
![]() | |
PdfObject () | |
PdfObject (const PdfReference &rRef, const char *pszType) | |
PdfObject (const PdfReference &rRef, const PdfVariant &rVariant) | |
PdfObject (const PdfVariant &var) | |
PdfObject (bool b) | |
PdfObject (pdf_int64 l) | |
PdfObject (double d) | |
PdfObject (const PdfString &rsString) | |
PdfObject (const PdfName &rName) | |
PdfObject (const PdfReference &rRef) | |
PdfObject (const PdfArray &tList) | |
PdfObject (const PdfDictionary &rDict) | |
PdfObject (const PdfObject &rhs) | |
PdfObject * | GetIndirectKey (const PdfName &key) const |
PdfObject * | MustGetIndirectKey (const PdfName &key) const |
void | WriteObject (PdfOutputDevice *pDevice, EPdfWriteMode eWriteMode, PdfEncrypt *pEncrypt, const PdfName &keyStop=PdfName::KeyNull) const |
pdf_long | GetObjectLength (EPdfWriteMode eWriteMode) |
const PdfReference & | Reference () const |
PdfStream * | GetStream () |
const PdfStream * | GetStream () const |
bool | HasStream () const |
PODOFO_NOTHROW bool | operator< (const PdfObject &rhs) const |
PODOFO_NOTHROW bool | operator== (const PdfObject &rhs) const |
void | SetOwner (PdfVecObjects *pVecObjects) |
PdfVecObjects * | GetOwner () const |
const PdfObject & | operator= (const PdfObject &rhs) |
void | FlateCompressStream () |
pdf_long | GetByteOffset (const char *pszKey, EPdfWriteMode eWriteMode) |
void | DelayedStreamLoad () const |
![]() | |
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 |
![]() | |
virtual bool | GetNextToken (const char *&pszToken, EPdfTokenType *peType=NULL) |
bool | IsNextToken (const char *pszToken) |
pdf_long | GetNextNumber () |
void | GetNextVariant (PdfVariant &rVariant, PdfEncrypt *pEncrypt) |
Protected Member Functions | |
virtual void | DelayedLoadImpl () |
virtual void | DelayedStreamLoadImpl () |
void | ParseStream () |
![]() | |
void | EnableDelayedStreamLoading () |
PdfStream * | GetStream_NoDL () |
![]() | |
void | AssertMutable () const |
void | SetDirty (bool bDirty) |
void | DelayedLoad () const |
void | EnableDelayedLoading () |
PODOFO_NOTHROW bool | DelayedLoadDone () const |
const PdfDictionary & | GetDictionary_NoDL () const |
PdfDictionary & | GetDictionary_NoDL () |
const PdfArray & | GetArray_NoDL () const |
PdfArray & | GetArray_NoDL () |
![]() | |
void | GetNextVariant (const char *pszToken, EPdfTokenType eType, PdfVariant &rVariant, PdfEncrypt *pEncrypt) |
EPdfDataType | DetermineDataType (const char *pszToken, EPdfTokenType eType, PdfVariant &rVariant) |
void | ReadDictionary (PdfVariant &rVariant, PdfEncrypt *pEncrypt) |
void | ReadArray (PdfVariant &rVariant, PdfEncrypt *pEncrypt) |
void | ReadString (PdfVariant &rVariant, PdfEncrypt *pEncrypt) |
void | ReadHexString (PdfVariant &rVariant, PdfEncrypt *pEncrypt) |
void | ReadName (PdfVariant &rVariant) |
void | QuequeToken (const char *pszToken, EPdfTokenType eType) |
Additional Inherited Members | |
![]() | |
static PODOFO_NOTHROW bool | IsWhitespace (const unsigned char ch) |
static PODOFO_NOTHROW bool | IsDelimiter (const unsigned char ch) |
static PODOFO_NOTHROW bool | IsRegular (const unsigned char ch) |
static PODOFO_NOTHROW bool | IsPrintable (const unsigned char ch) |
static PODOFO_NOTHROW int | GetHexValue (const unsigned char ch) |
![]() | |
static const unsigned int | HEX_NOT_FOUND = std::numeric_limits<unsigned int>::max() |
A PdfParserObject constructs a PdfObject from a PDF file. Parsing starts always at the current file position.
PoDoFo::PdfParserObject::PdfParserObject | ( | PdfVecObjects * | pCreator, |
const PdfRefCountedInputDevice & | rDevice, | ||
const PdfRefCountedBuffer & | rBuffer, | ||
pdf_long | lOffset = -1 |
||
) |
Parse the object data from the given file handle starting at the current position.
pCreator | pointer to a PdfVecObjects to resolve object references |
rDevice | an open reference counted input device which is positioned in front of the object which is going to be parsed. |
rBuffer | buffer to use for parsing to avoid reallocations |
lOffset | the position in the device from which the object shall be read if lOffset = -1, the object will be read from the current position in the file. |
|
explicit |
Parse the object data for an internal object. You have to call ParseDictionaryKeys as next function call.
The following two parameters are used to avoid allocation of a new buffer in PdfSimpleParser.
rBuffer | buffer to use for parsing to avoid reallocations |
|
protectedvirtual |
Load all data of the object if load object on demand is enabled. Reimplemented from PdfVariant. Do not call this directly, use DelayedLoad().
Reimplemented from PoDoFo::PdfVariant.
|
protectedvirtual |
Load the stream of the object if it has one and if loading on demand is enabled. Reimplemented from PdfObject. Do not call this directly, use DelayedStreamLoad().
Reimplemented from PoDoFo::PdfObject.
void PoDoFo::PdfParserObject::FreeObjectMemory | ( | bool | bForce = false | ) |
Tries to free all memory allocated by this PdfObject (variables and streams) and reads it from disk again if it is requested another time.
This will only work if load on demand is used. If the object is dirty if will not be free'd.
bForce | if true the object will be free'd even if IsDirty() returns true. So you will loose any changes made to this object. |
|
inline |
Returns if this object has a stream object appended. which has to be parsed.
|
inline |
void PoDoFo::PdfParserObject::ParseFile | ( | PdfEncrypt * | pEncrypt, |
bool | bIsTrailer = false |
||
) |
Parse the object data from the given file handle If delayed loading is enabled, only the object and generation number is read now and everything else is read later.
pEncrypt | an encryption dictionary which is used to decrypt strings and streams during parsing or NULL if the PDF file was not encrypted |
bIsTrailer | wether this is a trailer dictionary or not. trailer dictionaries do not have a object number etc. |
|
protected |
Starts reading at the file position m_lStreamOffset and interprets all bytes as contents of the objects stream. It is assumed that the dictionary has a valid /Length key already.
Called from DelayedStreamLoadImpl(). Do not call directly.
|
inline |
Sets wether this object shall be loaded on demand when it's data is accessed for the first time.
bDelayed | if true the object is loaded delayed. |
|
inline |
Set the object number of this object. It is almost never necessary to use this call. It is only included for usage in the PdfParser.
nObjNo | the new object number of this object |