MWAWInputStream Class Reference

Internal class used to read the file stream Internal class used to read the file stream, this class adds some usefull functions to the basic WPXInputStream: More...

#include <MWAWInputStream.hxx>

List of all members.

Public Member Functions

 MWAWInputStream (shared_ptr< WPXInputStream > inp, bool inverted)
 creates a stream with given endian from
 MWAWInputStream (WPXInputStream *input, bool inverted, bool checkCompression=false)
 creates a stream with given endian from an existing input
 ~MWAWInputStream ()
 destructor
shared_ptr< WPXInputStream > input ()
 returns the basic WPXInputStream
bool readInverted () const
 returns the endian mode (see constructor)
void setReadInverted (bool newVal)
 sets the endian mode
int seek (long offset, WPX_SEEK_TYPE seekType)
 seeks to a offset position, from actual or beginning position
long tell ()
 returns actual offset position
long size () const
 returns the stream size
bool checkPosition (long pos) const
 checks if a position is or not a valid file position
bool atEOS ()
 returns true if we are at the end of the section/file
void pushLimit (long newLimit)
 defines a new section in the file (from actualPos to newLimit) next call of seek, tell, atEos, ... will be restrained to this section
void popLimit ()
 pops a section defined by pushLimit
unsigned long readULong (int num)
 returns a uint8, uint16, uint32 readed from actualPos
long readLong (int num)
 return a int8, int16, int32 readed from actualPos
bool readDouble (double &res)
 try to read a double (ppc)
const uint8_t * read (size_t numBytes, unsigned long &numBytesRead)
 ! reads numbytes data, WITHOUT using any endian or section consideration
bool readDataBlock (long size, WPXBinaryData &data)
 reads a WPXBinaryData with a given size in the actual section/file
bool readEndDataBlock (WPXBinaryData &data)
 reads a WPXBinaryData from actPos to the end of the section/file
bool isOLEStream ()
 return true if the stream is ole
std::vector< std::string > getOLENames ()
 return the list of all ole zone
shared_ptr< MWAWInputStreamgetDocumentOLEStream (std::string name)
 return a new stream for a ole zone
bool getFinderInfo (std::string &type, std::string &creator) const
 returns the finder info type and creator (if known)
bool hasDataFork () const
 returns true if the data fork block exists
bool hasResourceFork () const
 returns true if the resource fork block exists
shared_ptr< MWAWInputStreamgetResourceForkStream ()
 returns the resource fork if find

Static Public Member Functions

static shared_ptr
< MWAWInputStream
get (WPXBinaryData const &data, bool inverted)
 returns a new input stream corresponding to a WPXBinaryData
static unsigned long readULong (WPXInputStream *stream, int num, unsigned long a, bool inverseRead)
 internal function used to read num byte,

Protected Member Functions

void updateStreamSize ()
 update the stream size ( must be called in the constructor )
bool createStorageOLE ()
 creates a storage ole
bool unBinHex ()
 unbinhex the data in the file is a BinHex 4.0 file of a mac file
bool unzipStream ()
 unzip the data in the file is a zip file of a mac file
bool unMacMIME ()
 check if some stream are in MacMIME format, if so de MacMIME
bool unMacMIME (MWAWInputStream *input, shared_ptr< WPXInputStream > &dataInput, shared_ptr< WPXInputStream > &rsrcInput) const
 de MacMIME an input stream

Static Protected Member Functions

static uint8_t readU8 (WPXInputStream *stream)
 internal function used to read a byte

Protected Attributes

shared_ptr< WPXInputStream > m_stream
 the initial input
long m_streamSize
 the stream size
bool m_inverseRead
 big or normal endian
long m_readLimit
 actual section limit (-1 if no limit)
std::vector< long > m_prevLimits
 list of previous limits
std::string m_fInfoType
 finder info type
std::string m_fInfoCreator
 finder info type
shared_ptr< MWAWInputStreamm_resourceFork
 the resource fork
shared_ptr< libmwawOLE::Storagem_storageOLE
 the ole storage

Private Member Functions

 MWAWInputStream (MWAWInputStream const &orig)
MWAWInputStreamoperator= (MWAWInputStream const &orig)

Detailed Description

Internal class used to read the file stream Internal class used to read the file stream, this class adds some usefull functions to the basic WPXInputStream:

  • read number (int8, int16, int32) in low or end endian
  • selection of a section of a stream
  • read block of data
  • interface with modified WPXOLEStream

Constructor & Destructor Documentation

MWAWInputStream::MWAWInputStream ( shared_ptr< WPXInputStream >  inp,
bool  inverted 
)

creates a stream with given endian from

Parameters:
inp
invertedmust be set to true for pc doc and ole part
invertedmust be set to false for mac doc

Referenced by get(), getDocumentOLEStream(), unBinHex(), unMacMIME(), and unzipStream().

MWAWInputStream::MWAWInputStream ( WPXInputStream *  input,
bool  inverted,
bool  checkCompression = false 
)

creates a stream with given endian from an existing input

Note: this functions does not delete input


Member Function Documentation

bool MWAWInputStream::checkPosition ( long  pos) const [inline]

checks if a position is or not a valid file position

bool MWAWInputStream::createStorageOLE ( ) [protected]

creates a storage ole

Referenced by getDocumentOLEStream(), getOLENames(), and isOLEStream().

shared_ptr< MWAWInputStream > MWAWInputStream::getDocumentOLEStream ( std::string  name)

return a new stream for a ole zone

bool MWAWInputStream::getFinderInfo ( std::string &  type,
std::string &  creator 
) const [inline]

returns the finder info type and creator (if known)

std::vector< std::string > MWAWInputStream::getOLENames ( )

return the list of all ole zone

returns the resource fork if find

Referenced by unBinHex().

bool MWAWInputStream::hasDataFork ( ) const [inline]

returns true if the data fork block exists

Referenced by atEOS(), createStorageOLE(), read(), readDataBlock(), readEndDataBlock(), seek(), tell(), unBinHex(), unMacMIME(), and unzipStream().

bool MWAWInputStream::hasResourceFork ( ) const [inline]

returns true if the resource fork block exists

shared_ptr<WPXInputStream> MWAWInputStream::input ( ) [inline]

returns the basic WPXInputStream

return true if the stream is ole

MWAWInputStream& MWAWInputStream::operator= ( MWAWInputStream const &  orig) [private]
void MWAWInputStream::popLimit ( ) [inline]

pops a section defined by pushLimit

void MWAWInputStream::pushLimit ( long  newLimit) [inline]

defines a new section in the file (from actualPos to newLimit) next call of seek, tell, atEos, ... will be restrained to this section

const uint8_t * MWAWInputStream::read ( size_t  numBytes,
unsigned long &  numBytesRead 
)

! reads numbytes data, WITHOUT using any endian or section consideration

Returns:
a pointer to the read elements

Referenced by libmwaw_applepict1::Bitmap::readBitmapData(), libmwaw_applepict1::Pixmap::readPixmapData(), unBinHex(), and unMacMIME().

bool MWAWInputStream::readDataBlock ( long  size,
WPXBinaryData &  data 
)

reads a WPXBinaryData with a given size in the actual section/file

Referenced by readEndDataBlock().

bool MWAWInputStream::readDouble ( double &  res)

try to read a double (ppc)

bool MWAWInputStream::readEndDataBlock ( WPXBinaryData &  data)

reads a WPXBinaryData from actPos to the end of the section/file

bool MWAWInputStream::readInverted ( ) const [inline]

returns the endian mode (see constructor)

uint8_t MWAWInputStream::readU8 ( WPXInputStream *  stream) [static, protected]

internal function used to read a byte

Referenced by readULong(), and unBinHex().

unsigned long MWAWInputStream::readULong ( WPXInputStream *  stream,
int  num,
unsigned long  a,
bool  inverseRead 
) [static]

internal function used to read num byte,

  • where a is the previous read data
void MWAWInputStream::setReadInverted ( bool  newVal) [inline]

sets the endian mode

long MWAWInputStream::size ( ) const [inline]

returns the stream size

Referenced by atEOS(), readDataBlock(), readEndDataBlock(), seek(), unBinHex(), and unMacMIME().

bool MWAWInputStream::unBinHex ( ) [protected]

unbinhex the data in the file is a BinHex 4.0 file of a mac file

Referenced by MWAWInputStream().

bool MWAWInputStream::unMacMIME ( ) [protected]

check if some stream are in MacMIME format, if so de MacMIME

Referenced by MWAWInputStream().

bool MWAWInputStream::unMacMIME ( MWAWInputStream input,
shared_ptr< WPXInputStream > &  dataInput,
shared_ptr< WPXInputStream > &  rsrcInput 
) const [protected]

de MacMIME an input stream

bool MWAWInputStream::unzipStream ( ) [protected]

unzip the data in the file is a zip file of a mac file

Referenced by MWAWInputStream().

void MWAWInputStream::updateStreamSize ( ) [protected]

update the stream size ( must be called in the constructor )

Referenced by MWAWInputStream().


Member Data Documentation

std::string MWAWInputStream::m_fInfoCreator [mutable, protected]

finder info type

Referenced by getFinderInfo(), unBinHex(), and unMacMIME().

std::string MWAWInputStream::m_fInfoType [mutable, protected]

finder info type

Referenced by getFinderInfo(), unBinHex(), and unMacMIME().

big or normal endian

Referenced by getDocumentOLEStream(), readInverted(), readULong(), and setReadInverted().

std::vector<long> MWAWInputStream::m_prevLimits [protected]

list of previous limits

Referenced by popLimit(), and pushLimit().

long MWAWInputStream::m_readLimit [protected]

actual section limit (-1 if no limit)

Referenced by atEOS(), checkPosition(), popLimit(), pushLimit(), readDataBlock(), readDouble(), readEndDataBlock(), and seek().

the stream size

Referenced by checkPosition(), pushLimit(), readDouble(), seek(), size(), and updateStreamSize().


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