pdfobjects::IProperty Class Reference

#include <iproperty.h>

Inheritance diagram for pdfobjects::IProperty:
observer::ObserverHandler< T > pdfobjects::CArray pdfobjects::CDict pdfobjects::CObjectSimple< Tp > pdfobjects::CStream pdfobjects::CInlineImage

List of all members.

Public Member Functions

boost::shared_ptr< IPropertyclone () const
virtual void setPdf (boost::weak_ptr< CPdf > p)
boost::weak_ptr< CPdfgetPdf () const
void canChange () const
const IndiRefgetIndiRef () const
virtual void setIndiRef (const IndiRef &rf)
void setIndiRef (IndiRef::ObjNum n, IndiRef::GenNum g)
PropertyMode getMode () const
void setMode (PropertyMode md)
virtual PropertyType getType () const =0
virtual void getStringRepresentation (std::string &str) const =0
void dispatchChange () const
void lockChange ()
void unlockChange ()
virtual Object * _makeXpdfObject () const =0
virtual ~IProperty ()

Static Public Member Functions

template<typename T >
static boost::shared_ptr< T > getSmartCObjectPtr (const boost::shared_ptr< IProperty > &ptr)

Protected Member Functions

 IProperty (boost::weak_ptr< CPdf > _pdf=boost::shared_ptr< CPdf >())
 IProperty (boost::weak_ptr< CPdf > _pdf, const IndiRef &rf)
virtual IPropertydoClone () const =0

Private Attributes

IndiRef ref
PropertyMode mode
boost::weak_ptr< CPdfpdf
bool wantDispatch

Detailed Description

Narrow interface describing properties of every pdf object. We use this interface when accessing properties of pdf object.

Each IProperty is associated with one pdf object. Changes made to this object are visible by xpdf only after calling dispatchChange() method.

When accessing complex properties, we have to know their type. According to the type, we can cast this object to CArray, CDict, CStream to get more functionality.

This object implements Observer interface which means we can observe changes made to all cobjects.

REMARK: The association with CPdf is stored in pdf variable as weak_ptr<CPdf>. Each access to this variable has to be checked with weak_ptr::lock method which transforms it to proper shared_ptr if the underlaying pointer is still valid.


Constructor & Destructor Documentation

pdfobjects::IProperty::IProperty ( boost::weak_ptr< CPdf _pdf = boost::shared_ptr<CPdf>()  )  [protected]

Copy constructor. Basic constructor.

References pdfobjects::IndiRef::gen, pdfobjects::IndiRef::num, and ref.

pdfobjects::IProperty::IProperty ( boost::weak_ptr< CPdf _pdf,
const IndiRef rf 
) [protected]

Constructor.

virtual pdfobjects::IProperty::~IProperty (  )  [inline, virtual]

Member Function Documentation

virtual Object* pdfobjects::IProperty::_makeXpdfObject (  )  const [pure virtual]

Create xpdf object from this object. This is a factory method because we do not know the type of instance of this object.

Returns:
Xpdf object(s).

Implemented in pdfobjects::CArray, pdfobjects::CDict, pdfobjects::CInlineImage, pdfobjects::CObjectSimple< Tp >, and pdfobjects::CStream.

void pdfobjects::IProperty::canChange (  )  const
boost::shared_ptr< IProperty > pdfobjects::IProperty::clone (  )  const

Copy constructor. Returns deep copy.

REMARK: This is an example of Factory method design pattern where we do not know the real type of the instance of this object.

Returns:
Deep copy of this object.

References doClone().

Referenced by pdfobjects::CObjectSimple< Tp >::_createContext(), pdfobjects::CArray::addProperty(), pdfobjects::CStream::doClone(), pdfobjects::CDict::setProperty(), and pdfobjects::CArray::setProperty().

void pdfobjects::IProperty::dispatchChange (  )  const

Notify Writer object that this object has changed.

We have to call this function to make changes visible.

REMARK: This is an example of Template method design pattern.

References getIndiRef(), getPdf(), pdfobjects::hasValidPdf(), pdfobjects::hasValidRef(), pdfobjects::utils::objHasParent(), pdf, and wantDispatch.

Referenced by pdfobjects::CObjectSimple< Tp >::_objectChanged(), and pdfobjects::CArray::_objectChanged().

virtual IProperty* pdfobjects::IProperty::doClone (  )  const [protected, pure virtual]

Implementation of clone method.

REMARK: This is an example of Template method design pattern.

Returns:
Deep copy of this object.

Implemented in pdfobjects::CArray, pdfobjects::CDict, pdfobjects::CObjectSimple< Tp >, and pdfobjects::CStream.

Referenced by clone().

const IndiRef& pdfobjects::IProperty::getIndiRef (  )  const [inline]

Returns object identification number. If it is a direct object returns identification and generation number of parent object.

Returns:
Identification and generation number.

References ref.

Referenced by pdfobjects::CObjectSimple< Tp >::_createContext(), pdfobjects::CObjectSimple< Tp >::_objectChanged(), pdfobjects::CArray::addProperty(), dispatchChange(), pdfobjects::hasValidRef(), pdfobjects::CDict::setProperty(), and pdfobjects::CArray::setProperty().

PropertyMode pdfobjects::IProperty::getMode (  )  const [inline]

Get mode of this property.

Returns:
Mode.

References mode.

Referenced by pdfobjects::CArray::_setMode().

boost::weak_ptr<CPdf> pdfobjects::IProperty::getPdf (  )  const [inline]
template<typename T >
static boost::shared_ptr<T> pdfobjects::IProperty::getSmartCObjectPtr ( const boost::shared_ptr< IProperty > &  ptr  )  [inline, static]

Returns pointer to derived object.

Parameters:
ptr Pointer to an IProperty.
Returns:
Object casted to desired type.

References STATIC_CHECK.

virtual void pdfobjects::IProperty::getStringRepresentation ( std::string &  str  )  const [pure virtual]

Returns string representation according to pdf specification of this object or its children.

Parameters:
str Output string.

Implemented in pdfobjects::CArray, pdfobjects::CDict, pdfobjects::CInlineImage, pdfobjects::CObjectSimple< Tp >, and pdfobjects::CStream.

virtual PropertyType pdfobjects::IProperty::getType (  )  const [pure virtual]

Returns type of instance of this object.

Returns:
Type of this instance.

Implemented in pdfobjects::CArray, pdfobjects::CDict, pdfobjects::CObjectSimple< Tp >, and pdfobjects::CStream.

Referenced by pdfobjects::isIPType().

void pdfobjects::IProperty::lockChange (  )  [inline]

Lock changes. Do not dispatch changes.

References wantDispatch.

void pdfobjects::IProperty::setIndiRef ( IndiRef::ObjNum  n,
IndiRef::GenNum  g 
) [inline]

Set object identification number and generation number.

Parameters:
n Objects identification number.
g Objects generation number.

References pdfobjects::IndiRef::gen, pdfobjects::IndiRef::num, and ref.

virtual void pdfobjects::IProperty::setIndiRef ( const IndiRef rf  )  [inline, virtual]

Set object identification number and generation number.

Parameters:
rf Indirect reference identification and generation number.

Reimplemented in pdfobjects::CArray, pdfobjects::CDict, and pdfobjects::CStream.

References ref.

void pdfobjects::IProperty::setMode ( PropertyMode  md  )  [inline]

Set mode of this property.

Parameters:
md Mode.

References mode.

void pdfobjects::IProperty::setPdf ( boost::weak_ptr< CPdf p  )  [virtual]

Set association with pdf.

Parameters:
p pdf that this object belongs to

Reimplemented in pdfobjects::CArray, pdfobjects::CDict, and pdfobjects::CStream.

References pdf.

void pdfobjects::IProperty::unlockChange (  )  [inline]

Unlock changes. Do dispatch changes.

References wantDispatch.


Member Data Documentation

Mode of this property.

Referenced by getMode(), and setMode().

boost::weak_ptr<CPdf> pdfobjects::IProperty::pdf [private]

Objects pdf identification and generation number.

Referenced by getIndiRef(), IProperty(), and setIndiRef().

If true changes are dispatched.

Referenced by canChange(), dispatchChange(), lockChange(), and unlockChange().


The documentation for this class was generated from the following files: