PoDoFo  0.9.4
Public Member Functions | List of all members
PoDoFo::PdfDictionary Class Reference

#include <PdfDictionary.h>

Inheritance diagram for PoDoFo::PdfDictionary:
PoDoFo::PdfDataType

Public Member Functions

 PdfDictionary ()
 
 PdfDictionary (const PdfDictionary &rhs)
 
virtual ~PdfDictionary ()
 
const PdfDictionaryoperator= (const PdfDictionary &rhs)
 
bool operator== (const PdfDictionary &rhs) const
 
bool operator!= (const PdfDictionary &rhs) const
 
void Clear ()
 
void AddKey (const PdfName &identifier, const PdfObject &rObject)
 
void AddKey (const PdfName &identifier, const PdfObject *pObject)
 
const PdfObjectGetKey (const PdfName &key) const
 
PdfObjectGetKey (const PdfName &key)
 
bool HasKey (const PdfName &key) const
 
bool RemoveKey (const PdfName &identifier)
 
void Write (PdfOutputDevice *pDevice, EPdfWriteMode eWriteMode, const PdfEncrypt *pEncrypt=NULL) const
 
void Write (PdfOutputDevice *pDevice, EPdfWriteMode eWriteMode, const PdfEncrypt *pEncrypt, const PdfName &keyStop=PdfName::KeyNull) const
 
const TKeyMap & GetKeys () const
 
TKeyMap & GetKeys ()
 
virtual bool IsDirty () const
 
virtual void SetDirty (bool bDirty)
 
- Public Member Functions inherited from PoDoFo::PdfDataType
void SetImmutable (bool bImmutable)
 
bool GetImmutable () const
 

Additional Inherited Members

- Protected Member Functions inherited from PoDoFo::PdfDataType
 PdfDataType ()
 
void AssertMutable () const
 

Detailed Description

The PDF dictionary data type of PoDoFo (inherits from PdfDataType, the base class for such representations)

Constructor & Destructor Documentation

PoDoFo::PdfDictionary::PdfDictionary ( )

Create a new, empty dictionary

PoDoFo::PdfDictionary::PdfDictionary ( const PdfDictionary rhs)

Deep copy a dictionary

Parameters
rhsthe PdfDictionary to copy
PoDoFo::PdfDictionary::~PdfDictionary ( )
virtual

Destructor

Member Function Documentation

void PoDoFo::PdfDictionary::AddKey ( const PdfName identifier,
const PdfObject rObject 
)

Add a key to the dictionary. If an existing key of this name exists, its value is replaced and the old value object will be deleted. The passed object is copied.

Parameters
identifierthe key is identified by this name in the dictionary
rObjecta variant object containing the data. The object is copied.

This will set the dirty flag of this object.

See also
IsDirty
void PoDoFo::PdfDictionary::AddKey ( const PdfName identifier,
const PdfObject pObject 
)

Add a key to the dictionary. If an existing key of this name exists, its value is replaced and the old value object will be deleted. The passed object is copied.

This is an overloaded member function.

Parameters
identifierthe key is identified by this name in the dictionary
rObjecta variant object containing the data. The object is copied.

This will set the dirty flag of this object.

See also
IsDirty
void PoDoFo::PdfDictionary::Clear ( )

Removes all keys from the dictionary

const PdfObject * PoDoFo::PdfDictionary::GetKey ( const PdfName key) const

Get the keys value out of the dictionary.

The returned value is a pointer to the internal object in the dictionary so it MUST not be deleted.

Parameters
keylook for the key names pszKey in the dictionary
Returns
pointer to the found value or 0 if the key was not found.
PdfObject * PoDoFo::PdfDictionary::GetKey ( const PdfName key)

Get the keys value out of the dictionary. This is an overloaded member function.

The returned value is a pointer to the internal object in the dictionary. It may be modified but is still owned by the dictionary so it MUST not be deleted.

Parameters
keylook for the key named key in the dictionary
Returns
the found value or 0 if the key was not found.
const TKeyMap & PoDoFo::PdfDictionary::GetKeys ( ) const
inline

Get access to the internal map of keys.

Returns
all keys of this dictionary
TKeyMap & PoDoFo::PdfDictionary::GetKeys ( )
inline

Get access to the internal map of keys.

Returns
all keys of this dictionary
bool PoDoFo::PdfDictionary::HasKey ( const PdfName key) const

Allows to check if a dictionary contains a certain key.

Parameters
keylook for the key named key.Name() in the dictionary
Returns
true if the key is part of the dictionary, otherwise false.
bool PoDoFo::PdfDictionary::IsDirty ( ) const
virtual

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 as we cannot determine if you actually changed something or not.

Returns
true if the value is dirty and has been modified since construction

Reimplemented from PoDoFo::PdfDataType.

bool PoDoFo::PdfDictionary::operator!= ( const PdfDictionary rhs) const
inline
See also
operator==
const PdfDictionary & PoDoFo::PdfDictionary::operator= ( const PdfDictionary rhs)

Asignment operator. Asign another PdfDictionary to this dictionary. This is a deep copy; all elements of the source dictionary are duplicated.

Parameters
rhsthe PdfDictionary to copy.
Returns
this PdfDictionary

This will set the dirty flag of this object.

See also
IsDirty
bool PoDoFo::PdfDictionary::operator== ( const PdfDictionary rhs) const

Comparison operator. If this dictionary contains all the same keys as the other dictionary, and for each key the values compare equal, the dictionaries are considered equal.

bool PoDoFo::PdfDictionary::RemoveKey ( const PdfName identifier)

Remove a key from this dictionary. If the key does not exists, this function does nothing.

Parameters
identifierthe name of the key to delete
Returns
true if the key was found in the object and was removed if there was is no key with this name, false is returned.

This will set the dirty flag of this object.

See also
IsDirty
void PoDoFo::PdfDictionary::SetDirty ( bool  bDirty)
virtual

Sets the dirty flag of this PdfVariant

Parameters
bDirtytrue if this PdfVariant has been modified from the outside
See also
IsDirty

Reimplemented from PoDoFo::PdfDataType.

void PoDoFo::PdfDictionary::Write ( PdfOutputDevice pDevice,
EPdfWriteMode  eWriteMode,
const PdfEncrypt pEncrypt = NULL 
) const
inlinevirtual

Write the complete dictionary to a file.

Parameters
pDevicewrite the object to this device
eWriteModeadditional options for writing this object
pEncryptan encryption object which is used to encrypt this object or NULL to not encrypt this object

Implements PoDoFo::PdfDataType.

void PoDoFo::PdfDictionary::Write ( PdfOutputDevice pDevice,
EPdfWriteMode  eWriteMode,
const PdfEncrypt pEncrypt,
const PdfName keyStop = PdfName::KeyNull 
) const

Write the complete dictionary to a file.

Parameters
pDevicewrite the object to this device
eWriteModeadditional options for writing this object
pEncryptan encryption object which is used to encrypt this object or NULL to not encrypt this object
keyStopif not KeyNull and a key == keyStop is found writing will stop right before this key!