libqxp::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 librevenge::RVNGInputStream: More...

Public Member Functions

 MWAWInputStream (std::shared_ptr< librevenge::RVNGInputStream > input, bool inverted)
 creates a stream with given endian
 
 MWAWInputStream (librevenge::RVNGInputStream *input, bool inverted, bool checkCompression=false)
 creates a stream with given endian from an existing input
 
 ~MWAWInputStream ()
 destructor
 
std::shared_ptr< librevenge::RVNGInputStream > input ()
 returns the basic librevenge::RVNGInputStream
 
bool readInverted () const
 returns the endian mode (see constructor)
 
void setReadInverted (bool newVal)
 sets the endian mode
 
int seek (long offset, librevenge::RVNG_SEEK_TYPE seekType)
 seeks to a offset position, from actual, beginning or ending 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 isEnd ()
 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 readDouble8 (double &res, bool &isNotANumber)
 try to read a double of size 8: 1.5 bytes exponent, 6.5 bytes mantisse
 
bool readDoubleReverted8 (double &res, bool &isNotANumber)
 try to read a double of size 8: 6.5 bytes mantisse, 1.5 bytes exponent
 
bool readDouble10 (double &res, bool &isNotANumber)
 try to read a double of size 10: 2 bytes exponent, 8 bytes mantisse
 
const uint8_t * read (size_t numBytes, unsigned long &numBytesRead)
 !
 
bool readDataBlock (long size, librevenge::RVNGBinaryData &data)
 reads a librevenge::RVNGBinaryData with a given size in the actual section/file
 
bool readEndDataBlock (librevenge::RVNGBinaryData &data)
 reads a librevenge::RVNGBinaryData from actPos to the end of the section/file
 
bool isStructured ()
 return true if the stream is ole
 
unsigned subStreamCount ()
 returns the number of substream
 
std::string subStreamName (unsigned id)
 returns the name of the i^th substream
 
std::shared_ptr< MWAWInputStreamgetSubStreamByName (std::string const &name)
 return a new stream for a ole zone
 
std::shared_ptr< MWAWInputStreamgetSubStreamById (unsigned id)
 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
 
std::shared_ptr< MWAWInputStreamgetResourceForkStream ()
 returns the resource fork if find
 

Static Public Member Functions

static std::shared_ptr< MWAWInputStreamget (librevenge::RVNGBinaryData const &data, bool inverted)
 returns a new input stream corresponding to a librevenge::RVNGBinaryData
 
static unsigned long readULong (librevenge::RVNGInputStream *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 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, std::shared_ptr< librevenge::RVNGInputStream > &dataInput, std::shared_ptr< librevenge::RVNGInputStream > &rsrcInput) const
 de MacMIME an input stream
 
bool unsplitInternalMergeStream ()
 check if a stream is an internal merge stream
 

Static Protected Member Functions

static uint8_t readU8 (librevenge::RVNGInputStream *stream)
 internal function used to read a byte
 

Protected Attributes

std::shared_ptr< librevenge::RVNGInputStream > m_stream
 the initial input
 
long m_streamSize
 the stream size
 
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
 
std::shared_ptr< MWAWInputStreamm_resourceFork
 the resource fork
 
bool m_inverseRead
 big or normal endian
 

Private Member Functions

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

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 librevenge::RVNGInputStream:

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

Constructor & Destructor Documentation

◆ MWAWInputStream() [1/3]

libqxp::MWAWInputStream::MWAWInputStream ( std::shared_ptr< librevenge::RVNGInputStream > input,
bool inverted )

creates a stream with given endian

Parameters
inputthe given input
invertedmust be set to true for pc doc and ole part and to false for mac doc

Referenced by get(), getSubStreamById(), getSubStreamByName(), MWAWInputStream(), operator=(), unBinHex(), unMacMIME(), unMacMIME(), unsplitInternalMergeStream(), and unzipStream().

◆ MWAWInputStream() [2/3]

libqxp::MWAWInputStream::MWAWInputStream ( librevenge::RVNGInputStream * input,
bool inverted,
bool checkCompression = false )

creates a stream with given endian from an existing input

Note: this functions does not delete input

◆ ~MWAWInputStream()

libqxp::MWAWInputStream::~MWAWInputStream ( )

destructor

◆ MWAWInputStream() [3/3]

libqxp::MWAWInputStream::MWAWInputStream ( MWAWInputStream const & orig)
privatedelete

Member Function Documentation

◆ checkPosition()

bool libqxp::MWAWInputStream::checkPosition ( long pos) const
inline

checks if a position is or not a valid file position

Referenced by unMacMIME().

◆ get()

std::shared_ptr< MWAWInputStream > libqxp::MWAWInputStream::get ( librevenge::RVNGBinaryData const & data,
bool inverted )
static

returns a new input stream corresponding to a librevenge::RVNGBinaryData

◆ getFinderInfo()

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

returns the finder info type and creator (if known)

Referenced by libqxp::QXPMacFileParser::parse().

◆ getResourceForkStream()

std::shared_ptr< MWAWInputStream > libqxp::MWAWInputStream::getResourceForkStream ( )
inline

returns the resource fork if find

Referenced by unBinHex().

◆ getSubStreamById()

std::shared_ptr< MWAWInputStream > libqxp::MWAWInputStream::getSubStreamById ( unsigned id)

return a new stream for a ole zone

◆ getSubStreamByName()

std::shared_ptr< MWAWInputStream > libqxp::MWAWInputStream::getSubStreamByName ( std::string const & name)

return a new stream for a ole zone

◆ hasDataFork()

bool libqxp::MWAWInputStream::hasDataFork ( ) const
inline

returns true if the data fork block exists

Referenced by isEnd(), libqxp::QXPMacFileParser::parse(), read(), readDataBlock(), readEndDataBlock(), seek(), tell(), unBinHex(), and unMacMIME().

◆ hasResourceFork()

bool libqxp::MWAWInputStream::hasResourceFork ( ) const
inline

returns true if the resource fork block exists

◆ input()

std::shared_ptr< librevenge::RVNGInputStream > libqxp::MWAWInputStream::input ( )
inline

returns the basic librevenge::RVNGInputStream

Referenced by libqxp::QXPMacFileParser::parse().

◆ isEnd()

bool libqxp::MWAWInputStream::isEnd ( )

returns true if we are at the end of the section/file

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

◆ isStructured()

bool libqxp::MWAWInputStream::isStructured ( )

return true if the stream is ole

Referenced by unsplitInternalMergeStream(), and unzipStream().

◆ operator=()

MWAWInputStream & libqxp::MWAWInputStream::operator= ( MWAWInputStream const & orig)
privatedelete

◆ popLimit()

void libqxp::MWAWInputStream::popLimit ( )
inline

pops a section defined by pushLimit

◆ pushLimit()

void libqxp::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

◆ read()

const uint8_t * libqxp::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 unBinHex(), and unMacMIME().

◆ readDataBlock()

bool libqxp::MWAWInputStream::readDataBlock ( long size,
librevenge::RVNGBinaryData & data )

reads a librevenge::RVNGBinaryData with a given size in the actual section/file

Referenced by readEndDataBlock().

◆ readDouble10()

bool libqxp::MWAWInputStream::readDouble10 ( double & res,
bool & isNotANumber )

try to read a double of size 10: 2 bytes exponent, 8 bytes mantisse

◆ readDouble8()

bool libqxp::MWAWInputStream::readDouble8 ( double & res,
bool & isNotANumber )

try to read a double of size 8: 1.5 bytes exponent, 6.5 bytes mantisse

◆ readDoubleReverted8()

bool libqxp::MWAWInputStream::readDoubleReverted8 ( double & res,
bool & isNotANumber )

try to read a double of size 8: 6.5 bytes mantisse, 1.5 bytes exponent

◆ readEndDataBlock()

bool libqxp::MWAWInputStream::readEndDataBlock ( librevenge::RVNGBinaryData & data)

reads a librevenge::RVNGBinaryData from actPos to the end of the section/file

◆ readInverted()

bool libqxp::MWAWInputStream::readInverted ( ) const
inline

returns the endian mode (see constructor)

◆ readLong()

long libqxp::MWAWInputStream::readLong ( int num)

return a int8, int16, int32 readed from actualPos

Referenced by unBinHex().

◆ readU8()

uint8_t libqxp::MWAWInputStream::readU8 ( librevenge::RVNGInputStream * stream)
staticprotected

internal function used to read a byte

Referenced by readULong(), and unBinHex().

◆ readULong() [1/2]

unsigned long libqxp::MWAWInputStream::readULong ( int num)
inline

returns a uint8, uint16, uint32 readed from actualPos

Referenced by readDouble10(), readDouble8(), readDoubleReverted8(), readLong(), readULong(), readULong(), unBinHex(), and unMacMIME().

◆ readULong() [2/2]

unsigned long libqxp::MWAWInputStream::readULong ( librevenge::RVNGInputStream * stream,
int num,
unsigned long a,
bool inverseRead )
static

internal function used to read num byte,

  • where a is the previous read data

◆ seek()

int libqxp::MWAWInputStream::seek ( long offset,
librevenge::RVNG_SEEK_TYPE seekType )

seeks to a offset position, from actual, beginning or ending position

Returns
0 if ok
See also
pushLimit popLimit

Referenced by getSubStreamById(), getSubStreamByName(), MWAWInputStream(), readDouble10(), unBinHex(), unMacMIME(), and unzipStream().

◆ setReadInverted()

void libqxp::MWAWInputStream::setReadInverted ( bool newVal)
inline

sets the endian mode

◆ size()

long libqxp::MWAWInputStream::size ( ) const
inline

returns the stream size

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

◆ subStreamCount()

unsigned libqxp::MWAWInputStream::subStreamCount ( )

returns the number of substream

◆ subStreamName()

std::string libqxp::MWAWInputStream::subStreamName ( unsigned id)

returns the name of the i^th substream

◆ tell()

long libqxp::MWAWInputStream::tell ( )

◆ unBinHex()

bool libqxp::MWAWInputStream::unBinHex ( )
protected

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

Referenced by MWAWInputStream().

◆ unMacMIME() [1/2]

bool libqxp::MWAWInputStream::unMacMIME ( )
protected

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

Referenced by MWAWInputStream(), and unMacMIME().

◆ unMacMIME() [2/2]

bool libqxp::MWAWInputStream::unMacMIME ( MWAWInputStream * input,
std::shared_ptr< librevenge::RVNGInputStream > & dataInput,
std::shared_ptr< librevenge::RVNGInputStream > & rsrcInput ) const
protected

de MacMIME an input stream

◆ unsplitInternalMergeStream()

bool libqxp::MWAWInputStream::unsplitInternalMergeStream ( )
protected

check if a stream is an internal merge stream

Referenced by MWAWInputStream().

◆ unzipStream()

bool libqxp::MWAWInputStream::unzipStream ( )
protected

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

Referenced by MWAWInputStream().

◆ updateStreamSize()

void libqxp::MWAWInputStream::updateStreamSize ( )
protected

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

Referenced by MWAWInputStream(), and MWAWInputStream().

Member Data Documentation

◆ m_fInfoCreator

std::string libqxp::MWAWInputStream::m_fInfoCreator
mutableprotected

◆ m_fInfoType

std::string libqxp::MWAWInputStream::m_fInfoType
mutableprotected

◆ m_inverseRead

bool libqxp::MWAWInputStream::m_inverseRead
protected

◆ m_prevLimits

std::vector<long> libqxp::MWAWInputStream::m_prevLimits
protected

list of previous limits

Referenced by MWAWInputStream(), MWAWInputStream(), popLimit(), and pushLimit().

◆ m_readLimit

long libqxp::MWAWInputStream::m_readLimit
protected

◆ m_resourceFork

std::shared_ptr<MWAWInputStream> libqxp::MWAWInputStream::m_resourceFork
protected

◆ m_stream

◆ m_streamSize

long libqxp::MWAWInputStream::m_streamSize
protected

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

Generated for libqxp by doxygen 1.13.2