#include <cobjectsimple.h>
Public Types | |
| typedef PropertyTraitSimple < Tp >::writeType | WriteType |
| typedef PropertyTraitSimple < Tp >::value | Value |
| typedef observer::BasicChangeContext < IProperty > | BasicObserverContext |
Public Member Functions | |
| CObjectSimple (boost::weak_ptr< CPdf > p, const Object &o, const IndiRef &rf) | |
| CObjectSimple (const Object &o) | |
| CObjectSimple (const Value &val=Value()) | |
| virtual PropertyType | getType () const |
| virtual void | getStringRepresentation (std::string &str) const |
| void | getValue (Value &val) const |
| Value | getValue () const |
| void | setStringRepresentation (const std::string &strO) |
| void | setValue (WriteType val) |
| ~CObjectSimple () | |
| virtual ::Object * | _makeXpdfObject () const |
Static Public Attributes | |
| static const PropertyType | type = Tp |
Protected Member Functions | |
| virtual IProperty * | doClone () const |
Private Member Functions | |
| ObserverContext * | _createContext () const |
| void | _objectChanged (boost::shared_ptr< const ObserverContext > context) |
Private Attributes | |
| Value | value |
Template class representing simple PDF objects from pdf specification v1.5.
This is a very generic class representing simple objects like null, string, number etc. Simple types only store information like string, name, number, two numbers etc.
Other xpdf objects like objCmd can not be instantiated although the PropertyType exists. It is because PropertyTraitSimple is not specialized for these types.
This class does not provide default copy constructor because copying a property could be understood either as deep copy or shallow copy. Copying complex types could be very expensive so we have made the decision to avoid it.
| typedef observer::BasicChangeContext<IProperty> pdfobjects::CObjectSimple< Tp >::BasicObserverContext |
| typedef PropertyTraitSimple<Tp>::value pdfobjects::CObjectSimple< Tp >::Value |
| typedef PropertyTraitSimple<Tp>::writeType pdfobjects::CObjectSimple< Tp >::WriteType |
| pdfobjects::CObjectSimple< Tp >::CObjectSimple | ( | boost::weak_ptr< CPdf > | p, | |
| const Object & | o, | |||
| const IndiRef & | rf | |||
| ) | [inline] |
Constructor. The object will read value from o and store it. We do NOT save any reference to o.
| p | Pointer to pdf object. | |
| o | Xpdf object. | |
| rf | Indirect id and gen id. |
References pdfobjects::CObjectSimple< Tp >::value.
| pdfobjects::CObjectSimple< Tp >::CObjectSimple | ( | const Object & | o | ) | [inline] |
Constructor. The object will read value from o and store it. We do NOT save any reference to o.
| o | Xpdf object. |
References pdfobjects::CObjectSimple< Tp >::value.
| pdfobjects::CObjectSimple< Tp >::CObjectSimple | ( | const Value & | val = Value() |
) | [inline] |
Public constructor. Can be used to create pdf objects. This object is created as a standalone and does not belong to any pdf. When added to a pdf the relation will be saved to IProperty::pdf.
| val | Value that will this object hold. |
| pdfobjects::CObjectSimple< Tp >::~CObjectSimple | ( | ) | [inline] |
Destructor
| ObserverContext* pdfobjects::CObjectSimple< Tp >::_createContext | ( | ) | const [inline, private] |
Create context of a change.
REMARK: Be carefull. Deallocate this object.
References pdfobjects::IProperty::clone(), pdfobjects::IProperty::getIndiRef(), and pdfobjects::IProperty::getPdf().
Referenced by pdfobjects::CObjectSimple< Tp >::setStringRepresentation(), and pdfobjects::CObjectSimple< Tp >::setValue().
| Object * pdfobjects::CObjectSimple< Tp >::_makeXpdfObject | ( | ) | const [inline, virtual] |
Make xpdf Object from this object. This function allocates and initializes xpdf object. Caller has to free the xpdf Object (call Object::free and then deallocating)
| ObjBadValueE | Thrown when xpdf can't parse the string representation of this object correctly. |
Implements pdfobjects::IProperty.
References pdfobjects::CObjectSimple< Tp >::value.
| void pdfobjects::CObjectSimple< Tp >::_objectChanged | ( | boost::shared_ptr< const ObserverContext > | context | ) | [inline, private] |
Indicate that the object has changed. Notifies all observers associated with this property about the change.
| context | Context in which a change occured. |
References debug::DBG_DBG, pdfobjects::IProperty::dispatchChange(), pdfobjects::IProperty::getIndiRef(), pdfobjects::IProperty::getPdf(), pdfobjects::hasValidPdf(), pdfobjects::hasValidRef(), kernelPrintDbg, and observer::ObserverHandler< T >::notifyObservers().
Referenced by pdfobjects::CObjectSimple< Tp >::setStringRepresentation(), and pdfobjects::CObjectSimple< Tp >::setValue().
| IProperty * pdfobjects::CObjectSimple< Tp >::doClone | ( | ) | const [inline, protected, virtual] |
Clone.
Performs deep copy. REMARK: CRef does NOT copy the referenced object just itself.
Implements pdfobjects::IProperty.
References debug::DBG_DBG, kernelPrintDbg, and pdfobjects::CObjectSimple< Tp >::value.
| void pdfobjects::CObjectSimple< Tp >::getStringRepresentation | ( | std::string & | str | ) | const [inline, virtual] |
Returns string representation of this object according to pdf specification.
| str | Output string that will hold the string representation of current object. |
Implements pdfobjects::IProperty.
References pdfobjects::CObjectSimple< Tp >::value.
| virtual PropertyType pdfobjects::CObjectSimple< Tp >::getType | ( | ) | const [inline, virtual] |
Return type of this property.
Implements pdfobjects::IProperty.
References pdfobjects::CObjectSimple< Tp >::type.
| PropertyTraitSimple< Tp >::value pdfobjects::CObjectSimple< Tp >::getValue | ( | ) | const [inline] |
Return property value. Each property has its own return type.
References pdfobjects::pNull, STATIC_CHECK, and pdfobjects::CObjectSimple< Tp >::value.
| void pdfobjects::CObjectSimple< Tp >::getValue | ( | Value & | val | ) | const [inline] |
Return property value. Each property has its own return type.
| val | Out parameter where property value will be stored. |
References pdfobjects::pNull, STATIC_CHECK, and pdfobjects::CObjectSimple< Tp >::value.
Referenced by gui::TreeItemRef::createChild(), gui::TreeItemRef::deepReload(), gui::StringProperty::readValue(), gui::RealProperty::readValue(), gui::NameProperty::readValue(), gui::IntProperty::readValue(), gui::BoolProperty::readValue(), and gui::QSIProperty::value().
| void pdfobjects::CObjectSimple< Tp >::setStringRepresentation | ( | const std::string & | strO | ) | [inline] |
Convert string to an object value.
| ObjBadValueE | Thrown when we can't parse the string correctly. |
| strO | String object that will be parsed and saved to this object's value. |
References pdfobjects::CObjectSimple< Tp >::_createContext(), pdfobjects::CObjectSimple< Tp >::_objectChanged(), pdfobjects::IProperty::canChange(), pdfobjects::hasValidPdf(), pdfobjects::hasValidRef(), pdfobjects::pNull, pdfobjects::utils::simpleValueFromString(), STATIC_CHECK, and pdfobjects::CObjectSimple< Tp >::value.
| void pdfobjects::CObjectSimple< Tp >::setValue | ( | WriteType | val | ) | [inline] |
Change the value of an object. The variable type depends on CObject type.
We can define the best type to represent an pdf object in PropertyTraitSimple.
| val | Value that will be set. |
References pdfobjects::CObjectSimple< Tp >::_createContext(), pdfobjects::CObjectSimple< Tp >::_objectChanged(), pdfobjects::IProperty::canChange(), pdfobjects::hasValidPdf(), pdfobjects::hasValidRef(), pdfobjects::pNull, STATIC_CHECK, and pdfobjects::CObjectSimple< Tp >::value.
Referenced by gui::QSIProperty::set(), pdfobjects::CPageDisplay::setMediabox(), gui::StringProperty::setValue(), gui::RealProperty::setValue(), gui::NameProperty::setValue(), gui::IntProperty::setValue(), and gui::BoolProperty::setValue().
const PropertyType pdfobjects::CObjectSimple< Tp >::type = Tp [static] |
Type of the property. Static field common to all simple objects with same type. This association allows us to get the PropertyType from object type.
Referenced by pdfobjects::CObjectSimple< Tp >::getType().
Value pdfobjects::CObjectSimple< Tp >::value [private] |
Simple value.
Referenced by pdfobjects::CObjectSimple< Tp >::_makeXpdfObject(), pdfobjects::CObjectSimple< Tp >::CObjectSimple(), pdfobjects::CObjectSimple< Tp >::doClone(), pdfobjects::CObjectSimple< Tp >::getStringRepresentation(), pdfobjects::CObjectSimple< Tp >::getValue(), pdfobjects::CObjectSimple< Tp >::setStringRepresentation(), and pdfobjects::CObjectSimple< Tp >::setValue().