#include <iproperty.h>
Public Member Functions | |
| boost::shared_ptr< IProperty > | clone () const |
| virtual void | setPdf (boost::weak_ptr< CPdf > p) |
| boost::weak_ptr< CPdf > | getPdf () const |
| void | canChange () const |
| const IndiRef & | getIndiRef () 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 IProperty * | doClone () const =0 |
Private Attributes | |
| IndiRef | ref |
| PropertyMode | mode |
| boost::weak_ptr< CPdf > | |
| bool | wantDispatch |
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.
| 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.
Constructor.
| virtual pdfobjects::IProperty::~IProperty | ( | ) | [inline, virtual] |
Destructor.
References observer::check_observerlist(), and observer::ObserverHandler< T >::observers.
| 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.
Implemented in pdfobjects::CArray, pdfobjects::CDict, pdfobjects::CInlineImage, pdfobjects::CObjectSimple< Tp >, and pdfobjects::CStream.
| void pdfobjects::IProperty::canChange | ( | ) | const |
Checks if a property can be changed.
References pdf, and wantDispatch.
Referenced by pdfobjects::CArray::addProperty(), pdfobjects::CDict::delProperty(), pdfobjects::CArray::delProperty(), pdfobjects::CStream::setBuffer(), pdfobjects::CDict::setProperty(), pdfobjects::CArray::setProperty(), pdfobjects::CStream::setRawBuffer(), pdfobjects::CObjectSimple< Tp >::setStringRepresentation(), and pdfobjects::CObjectSimple< Tp >::setValue().
| 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.
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.
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.
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.
References mode.
Referenced by pdfobjects::CArray::_setMode().
| boost::weak_ptr<CPdf> pdfobjects::IProperty::getPdf | ( | ) | const [inline] |
Returns pdf in which this object resides.
References pdf.
Referenced by pdfobjects::CObjectSimple< Tp >::_createContext(), pdfobjects::CDict::_makeXpdfObject(), pdfobjects::CArray::_makeXpdfObject(), pdfobjects::CObjectSimple< Tp >::_objectChanged(), pdfobjects::CArray::addProperty(), dispatchChange(), pdfobjects::hasValidPdf(), pdfobjects::CStream::open(), pdfobjects::CDict::setProperty(), and pdfobjects::CArray::setProperty().
| static boost::shared_ptr<T> pdfobjects::IProperty::getSmartCObjectPtr | ( | const boost::shared_ptr< IProperty > & | ptr | ) | [inline, static] |
Returns pointer to derived object.
| ptr | Pointer to an IProperty. |
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.
| 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.
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.
| 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.
| 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] |
| void pdfobjects::IProperty::setPdf | ( | boost::weak_ptr< CPdf > | p | ) | [virtual] |
Set association with pdf.
| 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.
PropertyMode pdfobjects::IProperty::mode [private] |
boost::weak_ptr<CPdf> pdfobjects::IProperty::pdf [private] |
This object belongs to this pdf.
Referenced by pdfobjects::CDict::_makeXpdfObject(), pdfobjects::CArray::_makeXpdfObject(), canChange(), dispatchChange(), getPdf(), and setPdf().
IndiRef pdfobjects::IProperty::ref [private] |
Objects pdf identification and generation number.
Referenced by getIndiRef(), IProperty(), and setIndiRef().
bool pdfobjects::IProperty::wantDispatch [private] |
If true changes are dispatched.
Referenced by canChange(), dispatchChange(), lockChange(), and unlockChange().