|
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) ![]() |
#include <cstream.h>


Public Types | |
| typedef char | StreamChar |
| typedef std::vector< StreamChar > | Buffer |
| typedef observer::BasicChangeContext < IProperty > | BasicObserverContext |
Public Member Functions | |
| CStream (boost::weak_ptr< CPdf > p, const Object &o, const IndiRef &rf) | |
| CStream (const Object &o) | |
| CStream (const CDict &dict) | |
| CStream (bool makeReqEntries=true) | |
| size_t | getPropertyCount () const |
| template<typename Container > | |
| void | getAllPropertyNames (Container &container) const |
| boost::shared_ptr< IProperty > | getProperty (PropertyId id) const |
| bool | containsProperty (PropertyId id) const |
| PropertyType | getPropertyType (PropertyId id) const |
| boost::shared_ptr< IProperty > | setProperty (PropertyId id, IProperty &ip) |
| boost::shared_ptr< IProperty > | addProperty (PropertyId id, const IProperty &newIp) |
| void | delProperty (PropertyId id) |
| virtual PropertyType | getType () const |
| virtual void | getStringRepresentation (std::string &str) const |
| virtual void | getDecodedStringRepresentation (std::string &str) const |
| const Buffer & | getBuffer () const |
| template<typename Container > | |
| void | getFilters (Container &container) const |
| virtual void | setPdf (boost::weak_ptr< CPdf > pdf) |
| virtual void | setIndiRef (const IndiRef &rf) |
| void | setRawBuffer (const Buffer &buf) |
| template<typename Container > | |
| void | setBuffer (const Container &buf) |
| ~CStream () | |
| virtual Object * | _makeXpdfObject () const |
| template<typename Storage > | |
| void | _getAllChildObjects (Storage &store) const |
Public Member Functions inherited from pdfobjects::IProperty | |
| boost::shared_ptr< IProperty > | clone () const |
| boost::weak_ptr< CPdf > | getPdf () const |
| void | canChange () const |
| const IndiRef & | getIndiRef () const |
| void | setIndiRef (IndiRef::ObjNum n, IndiRef::GenNum g) |
| PropertyMode | getMode () const |
| void | setMode (PropertyMode md) |
| void | dispatchChange () const |
| void | lockChange () |
| void | unlockChange () |
| 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 Attributes | |
| static const PropertyType | type = pStream |
Protected Member Functions | |
| virtual IProperty * | doClone () const |
| virtual CStream * | _newInstance () const |
| void | createReqEntries () |
Protected Member Functions inherited from pdfobjects::IProperty | |
| IProperty (boost::weak_ptr< CPdf > _pdf=boost::shared_ptr< CPdf >()) | |
| IProperty (boost::weak_ptr< CPdf > _pdf, const IndiRef &rf) | |
Protected Member Functions inherited from observer::ObserverHandler< T > | |
| void | dumpObservers () const |
Protected Attributes | |
| CDict | dictionary |
| Buffer | buffer |
| ::Parser * | parser |
| mutable::Object | curObj |
Friends | |
| template<typename T > | |
| class | CStreamsXpdfReader |
Additional Inherited Members | |
Static Public Member Functions inherited from pdfobjects::IProperty | |
| template<typename T > | |
| static boost::shared_ptr< T > | getSmartCObjectPtr (const boost::shared_ptr< IProperty > &ptr) |
Class representing stream object from pdf specification v1.5.
We do not want to use xpdf stream because it is a real mess and it is really not suitable for editing. We use xpdf object just for initializing and for reading objects.
According to pdf specification, stream is a dictionary and a stream of characters of specified length. Dictionary is used to describe the stream (its length, filters, parameters, etc..)
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 std::vector<StreamChar> pdfobjects::CStream::Buffer |
| typedef char pdfobjects::CStream::StreamChar |
Constructor. Stream will be associated with specified pdf.
| p | Pointer to pdf object. |
| o | Xpdf object. |
| rf | Indirect id and gen id. |
Referenced by _newInstance().
Constructor. Stream will not be associated with a pdf.
| o | Xpdf object. |
Constructor. Stream will not be associated with a pdf.
| dict | reference to a dictionary which will be associated with this stream |
| buffer | reference to buffer associtated with this stream |
Definition at line 101 of file cstream.cc.
References debug::DBG_DBG, and kernelPrintDbg.
| pdfobjects::CStream::CStream | ( | bool | makeReqEntries = true) |
Public constructor. This object will not be associated with a pdf. It adds all required properties to object dictionary in compliance with the pdf specification if needed.
| makeReqEntries | If true required entries are added to the stream dictionary. |
Definition at line 111 of file cstream.cc.
References createReqEntries(), debug::DBG_DBG, and kernelPrintDbg.
| pdfobjects::CStream::~CStream | ( | ) |
Destructor.
Definition at line 523 of file cstream.cc.
References curObj, curObj, curObj, debug::DBG_DBG, xpdf::freeXpdfObject(), kernelPrintDbg, NULL, NULL, NULL, parser, parser, and parser.
|
inline |
Return all child objects.
| store | Container of objects. |
Definition at line 476 of file cstream.h.
References dictionary, and dictionary.
|
virtual |
Make xpdf Object from this object. This function allocates and initializes xpdf object. Caller has to deallocate the xpdf Object.
| ObjBadValueE | Thrown when xpdf can't parse the string representation of this object correctly. |
Implements pdfobjects::IProperty.
Reimplemented in pdfobjects::CInlineImage.
Definition at line 258 of file cstream.cc.
References buffer, buffer, debug::DBG_DBG, debug::DBG_WARN, Object::getType(), kernelPrintDbg, kernelPrintDbg, NULL, objStream, and pdfobjects::utils::xpdfStreamObjFromBuffer().
Referenced by getDecodedStringRepresentation().
|
inlineprotectedvirtual |
Return new instance.
Reimplemented in pdfobjects::CInlineImage.
Definition at line 155 of file cstream.h.
References CStream().
Referenced by doClone().
|
inline |
Delagate this operation to underlying dictionary.
Definition at line 191 of file cstream.h.
References dictionary.
|
inline |
Delagate this operation to underlying dictionary.
Definition at line 179 of file cstream.h.
References dictionary.
Referenced by gui::QSStream::exist().
|
protected |
|
inline |
Delagate this operation to underlying dictionary.
Definition at line 195 of file cstream.h.
References dictionary.
|
protectedvirtual |
Implementation of clone method.
Implements pdfobjects::IProperty.
Definition at line 139 of file cstream.cc.
References _newInstance(), buffer, buffer, buffer, pdfobjects::IProperty::clone(), debug::DBG_DBG, dictionary, kernelPrintDbg, NULL, and parser.
|
inline |
Delagate this operation to underlying dictionary.
Definition at line 171 of file cstream.h.
References dictionary.
Referenced by gui::TreeItemCStream::getChildNames(), gui::QSStream::propertyNames(), and gui::PropertyEditor::setObject().
Get encoded buffer. Can contain non printable characters.
Definition at line 230 of file cstream.h.
References buffer.
Referenced by gui::QSStream::getBuffer(), gui::QSStream::getBufferString(), and gui::QSStream::saveBuffer().
|
virtual |
Returns decoded string representation of this object.
| str | Output string representation. |
Definition at line 301 of file cstream.cc.
References _makeXpdfObject(), debug::DBG_DBG, xpdf::freeXpdfObject(), pdfobjects::utils::getStringFromXpdfStream(), kernelPrintDbg, and NULL.
|
inline |
Get filters.
| container | Container of filter names. |
Definition at line 238 of file cstream.h.
References debug::DBG_DBG, debug::DBG_DBG, debug::DBG_DBG, dictionary, pdfobjects::isArray(), pdfobjects::isName(), kernelPrintDbg, kernelPrintDbg, kernelPrintDbg, name, and name.
Referenced by setBuffer().
|
inline |
Delagate this operation to underlying dictionary.
Definition at line 175 of file cstream.h.
References dictionary.
Referenced by gui::TreeItemCStream::createChild(), gui::TreeItemCStream::getChildNames(), gui::TreeItemCStream::getChildType(), gui::QSStream::property(), gui::PropertyEditor::setObject(), and gui::TreeItemCStream::validChild().
|
inline |
Delagate this operation to underlying dictionary.
Definition at line 166 of file cstream.h.
References dictionary.
Referenced by gui::QSStream::count(), and gui::TreeItemCStream::haveChild().
|
inline |
Delagate this operation to underlying dictionary.
Definition at line 183 of file cstream.h.
References dictionary.
|
virtual |
Returns string representation of this object.
| str | Output string representation. |
Implements pdfobjects::IProperty.
Reimplemented in pdfobjects::CInlineImage.
Definition at line 281 of file cstream.cc.
References buffer, buffer, debug::DBG_DBG, kernelPrintDbg, and pdfobjects::utils::streamToString().
|
inlinevirtual |
Returns type of object.
Implements pdfobjects::IProperty.
Definition at line 209 of file cstream.h.
References pdfobjects::pStream.
|
inline |
Set decoded (raw) buffer. Drops all filters if present.
| buf | New buffer (can be string or Buffer types). |
Definition at line 316 of file cstream.h.
References buffer, buffer, buffer, pdfobjects::IProperty::canChange(), debug::DBG_DBG, dictionary, getFilters(), kernelPrintDbg, kernelPrintDbg, pdfobjects::utils::makeStreamPdfValid(), NULL, NULL, parser, and parser.
Set ref to itself and also to all children.
| rf | New indirect reference numbers. |
Reimplemented from pdfobjects::IProperty.
Definition at line 185 of file cstream.cc.
References pdfobjects::IProperty::setIndiRef().
Referenced by pdfobjects::CInlineImage::CInlineImage().
|
virtual |
Set pdf to itself and also to all children.
| New pdf. |
Reimplemented from pdfobjects::IProperty.
Definition at line 174 of file cstream.cc.
References pdfobjects::IProperty::setPdf().
Referenced by pdfobjects::CInlineImage::CInlineImage().
|
inline |
Delagate this operation to underlying dictionary.
Definition at line 187 of file cstream.h.
References dictionary.
Set encoded buffer.
| buf | New buffer. |
Definition at line 197 of file cstream.cc.
References buffer, buffer, buffer, pdfobjects::IProperty::canChange(), NULL, NULL, parser, and parser.
|
friend |
|
protected |
Stream buffer.
Definition at line 88 of file cstream.h.
Referenced by _makeXpdfObject(), _makeXpdfObject(), pdfobjects::CInlineImage::CInlineImage(), pdfobjects::CInlineImage::CInlineImage(), pdfobjects::CInlineImage::CInlineImage(), doClone(), doClone(), doClone(), getBuffer(), pdfobjects::CInlineImage::getStringRepresentation(), pdfobjects::CInlineImage::getStringRepresentation(), getStringRepresentation(), getStringRepresentation(), setBuffer(), setBuffer(), setBuffer(), setRawBuffer(), setRawBuffer(), and setRawBuffer().
|
protected |
Current object in an opened stream.
Definition at line 97 of file cstream.h.
Referenced by ~CStream(), ~CStream(), and ~CStream().
|
protected |
Stream dictionary.
Definition at line 86 of file cstream.h.
Referenced by _getAllChildObjects(), _getAllChildObjects(), addProperty(), pdfobjects::CInlineImage::CInlineImage(), pdfobjects::CInlineImage::CInlineImage(), pdfobjects::CInlineImage::CInlineImage(), pdfobjects::CInlineImage::CInlineImage(), containsProperty(), delProperty(), doClone(), getAllPropertyNames(), getFilters(), getProperty(), getPropertyCount(), getPropertyType(), pdfobjects::CInlineImage::getStringRepresentation(), pdfobjects::CInlineImage::getStringRepresentation(), setBuffer(), and setProperty().
|
protected |
Xpdf parser.
Definition at line 95 of file cstream.h.
Referenced by doClone(), setBuffer(), setBuffer(), setRawBuffer(), setRawBuffer(), ~CStream(), ~CStream(), and ~CStream().
|
static |