pdfobjects::CObjectSimple< Tp > Class Template Reference

#include <cobjectsimple.h>

Inheritance diagram for pdfobjects::CObjectSimple< Tp >:
pdfobjects::IProperty observer::ObserverHandler< T >

List of all members.

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 IPropertydoClone () const

Private Member Functions

ObserverContext_createContext () const
void _objectChanged (boost::shared_ptr< const ObserverContext > context)

Private Attributes

Value value

Detailed Description

template<PropertyType Tp>
class pdfobjects::CObjectSimple< Tp >

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.


Member Typedef Documentation

template<PropertyType Tp>
typedef PropertyTraitSimple<Tp>::value pdfobjects::CObjectSimple< Tp >::Value
template<PropertyType Tp>
typedef PropertyTraitSimple<Tp>::writeType pdfobjects::CObjectSimple< Tp >::WriteType

Constructor & Destructor Documentation

template<PropertyType Tp>
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.

Parameters:
p Pointer to pdf object.
o Xpdf object.
rf Indirect id and gen id.

References pdfobjects::CObjectSimple< Tp >::value.

template<PropertyType Tp>
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.

Parameters:
o Xpdf object.

References pdfobjects::CObjectSimple< Tp >::value.

template<PropertyType Tp>
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.

Parameters:
val Value that will this object hold.
template<PropertyType Tp>
pdfobjects::CObjectSimple< Tp >::~CObjectSimple (  )  [inline]

Destructor


Member Function Documentation

template<PropertyType Tp>
ObserverContext* pdfobjects::CObjectSimple< Tp >::_createContext (  )  const [inline, private]

Create context of a change.

REMARK: Be carefull. Deallocate this object.

Returns:
Context in which a change occured.

References pdfobjects::IProperty::clone(), pdfobjects::IProperty::getIndiRef(), and pdfobjects::IProperty::getPdf().

Referenced by pdfobjects::CObjectSimple< Tp >::setStringRepresentation(), and pdfobjects::CObjectSimple< Tp >::setValue().

template<PropertyType Tp>
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)

Exceptions:
ObjBadValueE Thrown when xpdf can't parse the string representation of this object correctly.
Returns:
Xpdf object representing value of this simple object.

Implements pdfobjects::IProperty.

References pdfobjects::CObjectSimple< Tp >::value.

template<PropertyType Tp>
void pdfobjects::CObjectSimple< Tp >::_objectChanged ( boost::shared_ptr< const ObserverContext context  )  [inline, private]
template<PropertyType Tp>
IProperty * pdfobjects::CObjectSimple< Tp >::doClone (  )  const [inline, protected, virtual]

Clone.

Performs deep copy. REMARK: CRef does NOT copy the referenced object just itself.

Returns:
Deep copy of this object.

Implements pdfobjects::IProperty.

References debug::DBG_DBG, kernelPrintDbg, and pdfobjects::CObjectSimple< Tp >::value.

template<PropertyType Tp>
void pdfobjects::CObjectSimple< Tp >::getStringRepresentation ( std::string &  str  )  const [inline, virtual]

Returns string representation of this object according to pdf specification.

Parameters:
str Output string that will hold the string representation of current object.

Implements pdfobjects::IProperty.

References pdfobjects::CObjectSimple< Tp >::value.

template<PropertyType Tp>
virtual PropertyType pdfobjects::CObjectSimple< Tp >::getType (  )  const [inline, virtual]

Return type of this property.

Returns:
Type of this property.

Implements pdfobjects::IProperty.

References pdfobjects::CObjectSimple< Tp >::type.

template<PropertyType Tp>
PropertyTraitSimple< Tp >::value pdfobjects::CObjectSimple< Tp >::getValue (  )  const [inline]

Return property value. Each property has its own return type.

Returns:
Property value.

References pdfobjects::pNull, STATIC_CHECK, and pdfobjects::CObjectSimple< Tp >::value.

template<PropertyType Tp>
void pdfobjects::CObjectSimple< Tp >::getValue ( Value val  )  const [inline]
template<PropertyType Tp>
void pdfobjects::CObjectSimple< Tp >::setStringRepresentation ( const std::string &  strO  )  [inline]

Convert string to an object value.

Exceptions:
ObjBadValueE Thrown when we can't parse the string correctly.
Parameters:
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.

template<PropertyType Tp>
void pdfobjects::CObjectSimple< Tp >::setValue ( WriteType  val  )  [inline]

Member Data Documentation

template<PropertyType Tp>
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().

template<PropertyType Tp>
Value pdfobjects::CObjectSimple< Tp >::value [private]

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