#include <Stream.hh>
Inheritance diagram for pdf::core::CStream:
this class represents streams in PDF files. streams objects contains a number of bytes. it is transformed by a filter before saving to the file. it is used to store page contents, images and embedded files in PDF files.
this class is a abstract base class. it has no data member. it has pure virtual function. it requires the derived classes to provide the stream data. the derived are free to store data in any form. it only need to override two pure virtual function: GetContent() and MakeDictionary(). by doing this the derived classes can specify the stream data and the fields in the stream dictionary.
|
write the stream object to the output stream, which should be a PDF file. this function is required by CObject Implements pdf::core::CObject.
00044 { 00045 using namespace std ; 00046 00047 // create stream dictionary 00048 CDictionary dict ; 00049 MakeDictionary( dict ) ; 00050 00051 // get stream content. see 00052 CByteVec temp ; 00053 const CByteVec& content = GetContent( temp ) ; 00054 00055 // fields that must be presend in a stream dictionary 00056 dict.AddPair( "Length", new CNumber( content.size( ) ) ) ; 00057 00058 os << dict << "\nstream\n" ; 00059 copy( content.begin( ), content.end( ), ostreambuf_iterator<char>( os ) ) ; 00060 return os << "\nendstream" ; 00061 } |
|
the derived classes should override this function in order to provide the stream data. the prototype of this function is strange, but it allows the the derived classes to return a constrant reference of its own vector, such that a data copy can be avoided. in other cases, the derived classes can put the stream data to the output vector and return it.
Implemented in pdf::graph::CImage, and pdf::graph::CJpegImage. |
|
this function will fill in the fields into the stream dictionary. derived classes must override it if it wants to customize the stream dictionary.
00072 { 00073 } |