pdfedit  0.4.5
About: PDFedit is a free and open source library for manipulating PDF documents.
  Fossies Dox: pdfedit-0.4.5.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
pdfobjects::IProperty Class Referenceabstract

#include <iproperty.h>

Inheritance diagram for pdfobjects::IProperty:
Collaboration diagram for pdfobjects::IProperty:

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 ()
 
- Public Member Functions inherited from observer::ObserverHandler< T >
virtual ~ObserverHandler ()
 
virtual void registerObserver (const Observer &observer)
 
virtual void unregisterObserver (const Observer &observer)
 
virtual void notifyObservers (boost::shared_ptr< T > newValue, boost::shared_ptr< const ObserverContext > context)
 

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
 
- Protected Member Functions inherited from observer::ObserverHandler< T >
void dumpObservers () const
 

Additional Inherited Members

- Public Types inherited from observer::ObserverHandler< T >
typedef boost::shared_ptr
< const IObserver< T > > 
Observer
 
typedef PriorityList< ObserverObserverList
 
typedef IChangeContext< T > ObserverContext
 
- Protected Attributes inherited from observer::ObserverHandler< T >
ObserverList observers
 

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.

Definition at line 95 of file iproperty.h.

Constructor & Destructor Documentation

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

Copy constructor. Basic constructor.

Definition at line 40 of file iproperty.cc.

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

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

Constructor.

Definition at line 48 of file iproperty.cc.

virtual pdfobjects::IProperty::~IProperty ( )
inlinevirtual

Destructor.

Definition at line 290 of file iproperty.h.

References observer::ObserverHandler< T >::observers.

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::CStream, pdfobjects::CDict, pdfobjects::CArray, pdfobjects::CObjectSimple< Tp >, and pdfobjects::CInlineImage.

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.

Definition at line 56 of file iproperty.cc.

References doClone().

Referenced by pdfobjects::CArray::addProperty(), pdfobjects::CDict::addProperty(), pdfobjects::CStream::doClone(), pdfobjects::CArray::setProperty(), and pdfobjects::CDict::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.

Definition at line 91 of file iproperty.cc.

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

virtual IProperty* pdfobjects::IProperty::doClone ( ) const
protectedpure virtual

Implementation of clone method.

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

Returns
Deep copy of this object.

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

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.

Definition at line 179 of file iproperty.h.

Referenced by pdfobjects::CArray::addProperty(), pdfobjects::CDict::addProperty(), dispatchChange(), pdfobjects::hasValidRef(), pdfobjects::utils::objHasParent(), pdfobjects::CArray::setProperty(), and pdfobjects::CDict::setProperty().

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

Get mode of this property.

Returns
Mode.

Definition at line 207 of file iproperty.h.

Referenced by pdfobjects::CArray::_setMode(), pdfobjects::CDict::_setMode(), and gui::propertyFactory().

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

Returns pointer to derived object.

Parameters
ptrPointer to an IProperty.
Returns
Object casted to desired type.

Definition at line 228 of file iproperty.h.

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
strOutput string.

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

Referenced by ip_validate(), ip_validate(), ip_validate(), ip_validate(), and operator<<().

virtual PropertyType pdfobjects::IProperty::getType ( ) const
pure virtual
void pdfobjects::IProperty::lockChange ( )
inline

Lock changes. Do not dispatch changes.

Definition at line 272 of file iproperty.h.

virtual void pdfobjects::IProperty::setIndiRef ( const IndiRef rf)
inlinevirtual

Set object identification number and generation number.

Parameters
rfIndirect reference identification and generation number.

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

Definition at line 186 of file iproperty.h.

Referenced by pdfobjects::CArray::setIndiRef(), pdfobjects::CDict::setIndiRef(), and pdfobjects::CStream::setIndiRef().

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

Set object identification number and generation number.

Parameters
nObjects identification number.
gObjects generation number.

Definition at line 195 of file iproperty.h.

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

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

Set mode of this property.

Parameters
mdMode.

Definition at line 214 of file iproperty.h.

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

Set association with pdf.

Parameters
ppdf that this object belongs to

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

Definition at line 75 of file iproperty.cc.

Referenced by pdfobjects::CArray::setPdf(), pdfobjects::CDict::setPdf(), and pdfobjects::CStream::setPdf().

void pdfobjects::IProperty::unlockChange ( )
inline

Unlock changes. Do dispatch changes.

Definition at line 277 of file iproperty.h.


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