PoDoFo 0.9.1
Public Member Functions | Protected Member Functions

PoDoFo::PdfElement Class Reference

#include <PdfElement.h>

Inheritance diagram for PoDoFo::PdfElement:
PoDoFo::PdfAction PoDoFo::PdfAnnotation PoDoFo::PdfContents PoDoFo::PdfDifferenceEncoding PoDoFo::PdfExtGState PoDoFo::PdfFileSpec PoDoFo::PdfFont PoDoFo::PdfFunction PoDoFo::PdfInfo PoDoFo::PdfOutlineItem PoDoFo::PdfPage PoDoFo::PdfPagesTree PoDoFo::PdfShadingPattern PoDoFo::PdfXObject

List of all members.

Public Member Functions

PdfObjectGetObject ()
const PdfObjectGetObject () const

Protected Member Functions

 PdfElement (const char *pszType, PdfVecObjects *pParent)
 PdfElement (const char *pszType, PdfDocument *pParent)
 PdfElement (const char *pszType, PdfObject *pObject)
 PdfElement (EPdfDataType eExpectedDataType, PdfObject *pObject)
const char * TypeNameForIndex (int i, const char **ppTypes, long lLen) const
int TypeNameToIndex (const char *pszType, const char **ppTypes, long lLen, int nUnknownValue) const
PdfObjectCreateObject (const char *pszType=NULL)
PdfObjectGetNonConstObject () const

Detailed Description

PdfElement is a common base class for all elements in a PDF file. For example pages, action and annotations.

Every PDF element has one PdfObject and provides an easier interface to modify the contents of the dictionary.

A PdfElement base class can be created from an existing PdfObject or created from scratch. In the later case, the PdfElement creates a PdfObject and adds it to a vector of objects.

A PdfElement cannot be created directly. Use one of the subclasses which implement real functionallity.

See also:
PdfPage
PdfAction
PdfAnnotation

Constructor & Destructor Documentation

builddir build BUILD podofo src doc PdfElement cpp PoDoFo::PdfElement::PdfElement ( const char *  pszType,
PdfVecObjects pParent 
) [protected]

Creates a new PdfElement

Parameters:
pszTypetype entry of the elements object
pParentparent vector of objects. Add a newly created object to this vector.
PoDoFo::PdfElement::PdfElement ( const char *  pszType,
PdfDocument pParent 
) [protected]

Creates a new PdfElement

Parameters:
pszTypetype entry of the elements object
pParentparent PdfDocument. Add a newly created object to this vector.
PoDoFo::PdfElement::PdfElement ( const char *  pszType,
PdfObject pObject 
) [protected]

Create a PdfElement from an existing PdfObject The object must be a dictionary.

Parameters:
pszTypetype entry of the elements object. Throws an exception if the type in the PdfObject differs from pszType.
pObjectpointer to the PdfObject that is modified by this PdfElement
PoDoFo::PdfElement::PdfElement ( EPdfDataType  eExpectedDataType,
PdfObject pObject 
) [protected]

Create a PdfElement from an existing PdfObject The object might be of any data type, PdfElement will throw an exception if the PdfObject if not of the same datatype as the expected one. This is necessary in rare cases. E.g. in PdfContents.

Parameters:
eExpectedDataTypethe expected datatype of this object
pObjectpointer to the PdfObject that is modified by this PdfElement

Member Function Documentation

PdfObject * PoDoFo::PdfElement::CreateObject ( const char *  pszType = NULL) [protected]

Create a PdfObject in the parent of this PdfElement which might either be a PdfStreamedDocument, a PdfDocument or a PdfVecObjects

Use this function in an own subclass of PdfElement to create new PdfObjects.

Parameters:
pszTypean optional /Type key of the created object
Returns:
a PdfObject which is owned by the parent
PdfObject * PoDoFo::PdfElement::GetNonConstObject ( ) const [inline, protected]

Get access to the internal object. Use this method if you need access to the internal object in a const-method without having to do a const cast.

Returns:
the internal PdfObject
const PdfObject * PoDoFo::PdfElement::GetObject ( ) const [inline]

Get access to the internal object This is an overloaded member function.

Returns:
the internal PdfObject
PdfObject * PoDoFo::PdfElement::GetObject ( ) [inline]

Get access to the internal object

Returns:
the internal PdfObject
const char * PoDoFo::PdfElement::TypeNameForIndex ( int  i,
const char **  ppTypes,
long  lLen 
) const [protected]

Convert an enum or index to its string representation which can be written to the PDF file.

This is a helper function for various PdfElement subclasses that need strings and enums for their SubTypes keys.

Parameters:
ithe index or enum value
ppTypesan array of strings containing the string mapping of the index
lLenthe length of the string array
Returns:
the string representation or NULL for values out of range
int PoDoFo::PdfElement::TypeNameToIndex ( const char *  pszType,
const char **  ppTypes,
long  lLen,
int  nUnknownValue 
) const [protected]

Convert a string type to an array index or enum.

This is a helper function for various PdfElement subclasses that need strings and enums for their SubTypes keys.

Parameters:
pszTypethe type as string
ppTypesan array of strings containing the string mapping of the index
lLenthe length of the string array
nUnknownValuethe value that is returned when the type is unknown
Returns:
the index of the string in the array