STOFFInputStream Class Reference documentation

Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
STOFFInputStream 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...

`#include <STOFFInputStream.hxx>`

## Public Member Functions
| STOFFInputStream (std::shared_ptr< librevenge::RVNGInputStream > input, bool inverted)
| creates a stream with given endian More...
| STOFFInputStream (librevenge::RVNGInputStream *input, bool inverted)
| creates a stream with given endian from an existing input More...
| ~STOFFInputStream ()
| destructor More...
std::shared_ptr< librevenge::RVNGInputStream > | input ()
| returns the basic librevenge::RVNGInputStream More...
bool | readInverted () const
| returns the endian mode (see constructor) More...
void | setReadInverted (bool newVal)
| sets the endian mode More...
int | seek (long offset, librevenge::RVNG_SEEK_TYPE seekType)
| seeks to a offset position, from actual, beginning or ending position More...
long | tell ()
| returns actual offset position More...
long | size () const
| returns the stream size More...
bool | checkPosition (long pos) const
| checks if a position is or not a valid file position More...
bool | isEnd ()
| returns true if we are at the end of the section/file More...
int | peek ()
| returns the value of the next caracters or -1, but does not increment the position counter More...
STOFFInputStream & | operator>> (bool &res)
| operator>> for bool More...
STOFFInputStream & | operator>> (uint8_t &res)
| operator>> for uint8_t More...
STOFFInputStream & | operator>> (int8_t &res)
| operator>> for int8_t More...
STOFFInputStream & | operator>> (uint16_t &res)
| operator>> for uint16_t More...
STOFFInputStream & | operator>> (int16_t &res)
| operator>> for int16_t More...
STOFFInputStream & | operator>> (uint32_t &res)
| operator>> for uint32_t More...
STOFFInputStream & | operator>> (int32_t &res)
| operator>> for int32_t More...
STOFFInputStream & | operator>> (double &res)
| operator>> for double More...
unsigned long | readULong (int num)
| returns a uint8, uint16, uint32 readed from actualPos More...
long | readLong (int num)
| return a int8, int16, int32 readed from actualPos More...
bool | readColor (STOFFColor &color)
| try to read a color More...
bool | readCompressedLong (long &res)
| read a compressed long (pstm.cxx:ReadCompressed) More...
bool | readCompressedULong (unsigned long &res)
| read a compressed unsigned long (sw_sw3imp.cxx Sw3IoImp::InULong) More...
bool | readDouble8 (double &res, bool &isNotANumber)
| try to read a double of size 8: 1.5 bytes exponent, 6.5 bytes mantisse More...
bool | readDoubleReverted8 (double &res, bool &isNotANumber)
| try to read a double of size 8: 6.5 bytes mantisse, 1.5 bytes exponent More...
bool | readDouble10 (double &res, bool &isNotANumber)
| try to read a double of size 10: 2 bytes exponent, 8 bytes mantisse More...
const uint8_t * | read (size_t numBytes, unsigned long &numBytesRead)
| ! reads numbytes data, WITHOUT using any endian or section consideration More...
bool | readDataBlock (long size, librevenge::RVNGBinaryData &data)
| reads a librevenge::RVNGBinaryData with a given size in the actual section/file More...
bool | readEndDataBlock (librevenge::RVNGBinaryData &data)
| reads a librevenge::RVNGBinaryData from actPos to the end of the section/file More...
bool | isStructured ()
| return true if the stream is ole More...
unsigned | subStreamCount ()
| returns the number of substream More...
std::string | subStreamName (unsigned id)
| returns the name of the i^th substream More...
std::shared_ptr< STOFFInputStream > | getSubStreamByName (std::string const &name)
| return a new stream for a ole zone More...
std::shared_ptr< STOFFInputStream > | getSubStreamById (unsigned id)
| return a new stream for a ole zone More...
bool | hasDataFork () const
| returns true if the data fork block exists More...

## Static Public Member Functions
static std::shared_ptr< STOFFInputStream > | get (librevenge::RVNGBinaryData const &data, bool inverted)
| returns a new input stream corresponding to a librevenge::RVNGBinaryData More...
static unsigned long | readULong (librevenge::RVNGInputStream *stream, int num, unsigned long a, bool inverseRead)
| internal function used to read num byte, More...

## Protected Member Functions
void | updateStreamSize ()
| update the stream size ( must be called in the constructor ) More...

## Static Protected Member Functions
static uint8_t | readU8 (librevenge::RVNGInputStream *stream)
| internal function used to read a byte More...

## Protected Attributes
std::shared_ptr< librevenge::RVNGInputStream > | m_stream
| the initial input More...
long | m_streamSize
| the stream size More...
bool | m_inverseRead
| big or normal endian More...

## Private Member Functions
| STOFFInputStream (STOFFInputStream const &orig)
STOFFInputStream & | operator= (STOFFInputStream 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 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

## ◆ STOFFInputStream() [1/3]

STOFFInputStream::STOFFInputStream | ( | std::shared_ptr< librevenge::RVNGInputStream > | input,
|  | bool | inverted
| ) |  |

creates a stream with given endian

Parameters

  input | the given input
  inverted | must be set to true for pc doc and ole part and to false for mac doc

Referenced by get(), getSubStreamById(), getSubStreamByName(), and hasDataFork().

## ◆ STOFFInputStream() [2/3]

STOFFInputStream::STOFFInputStream | ( | librevenge::RVNGInputStream * | input,
|  | bool | inverted
| ) |  |

creates a stream with given endian from an existing input

Note: this functions does not delete input

## ◆ ~STOFFInputStream()

STOFFInputStream::~STOFFInputStream | ( |  | ) |

destructor

## ◆ STOFFInputStream() [3/3]

STOFFInputStream::STOFFInputStream | ( | STOFFInputStream const & | orig | ) |
| private

## Member Function Documentation

## ◆ checkPosition()

bool STOFFInputStream::checkPosition | ( | long | pos | ) | const
| inline

checks if a position is or not a valid file position

Referenced by readColor().

## ◆ get()

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

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

## ◆ getSubStreamById()

std::shared_ptr< STOFFInputStream > STOFFInputStream::getSubStreamById | ( | unsigned | id | ) |

return a new stream for a ole zone

Referenced by readULong().

## ◆ getSubStreamByName()

std::shared_ptr< STOFFInputStream > STOFFInputStream::getSubStreamByName | ( | std::string const & | name | ) |

return a new stream for a ole zone

Referenced by readULong().

## ◆ hasDataFork()

bool STOFFInputStream::hasDataFork | ( |  | ) | const
| inline

returns true if the data fork block exists

Referenced by isEnd(), read(), readDataBlock(), readEndDataBlock(), seek(), and tell().

## ◆ input()

std::shared_ptr<librevenge::RVNGInputStream> STOFFInputStream::input | ( |  | ) |
| inline

returns the basic librevenge::RVNGInputStream

## ◆ isEnd()

bool STOFFInputStream::isEnd | ( |  | ) |

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

Referenced by checkPosition(), and peek().

## ◆ isStructured()

bool STOFFInputStream::isStructured | ( |  | ) |

return true if the stream is ole

Referenced by readULong().

## ◆ operator=()

STOFFInputStream& STOFFInputStream::operator= | ( | STOFFInputStream const & | orig | ) |
| private

Referenced by hasDataFork().

## ◆ operator>>() [1/8]

STOFFInputStream& STOFFInputStream::operator>> | ( | bool & | res | ) |
| inline

operator>> for bool

## ◆ operator>>() [2/8]

STOFFInputStream& STOFFInputStream::operator>> | ( | uint8_t & | res | ) |
| inline

operator>> for uint8_t

## ◆ operator>>() [3/8]

STOFFInputStream& STOFFInputStream::operator>> | ( | int8_t & | res | ) |
| inline

operator>> for int8_t

## ◆ operator>>() [4/8]

STOFFInputStream& STOFFInputStream::operator>> | ( | uint16_t & | res | ) |
| inline

operator>> for uint16_t

## ◆ operator>>() [5/8]

STOFFInputStream& STOFFInputStream::operator>> | ( | int16_t & | res | ) |
| inline

operator>> for int16_t

## ◆ operator>>() [6/8]

STOFFInputStream& STOFFInputStream::operator>> | ( | uint32_t & | res | ) |
| inline

operator>> for uint32_t

## ◆ operator>>() [7/8]

STOFFInputStream& STOFFInputStream::operator>> | ( | int32_t & | res | ) |
| inline

operator>> for int32_t

## ◆ operator>>() [8/8]

STOFFInputStream& STOFFInputStream::operator>> | ( | double & | res | ) |
| inline

operator>> for double

## ◆ peek()

int STOFFInputStream::peek | ( |  | ) |

returns the value of the next caracters or -1, but does not increment the position counter

Referenced by checkPosition().

## ◆ read()

const uint8_t * STOFFInputStream::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 readULong().

## ◆ readColor()

bool STOFFInputStream::readColor | ( | STOFFColor & | color | ) |

try to read a color

Referenced by readULong().

## ◆ readCompressedLong()

bool STOFFInputStream::readCompressedLong | ( | long & | res | ) |

read a compressed long (pstm.cxx:ReadCompressed)

Referenced by readULong().

## ◆ readCompressedULong()

bool STOFFInputStream::readCompressedULong | ( | unsigned long & | res | ) |

read a compressed unsigned long (sw_sw3imp.cxx Sw3IoImp::InULong)

Referenced by readULong().

## ◆ readDataBlock()

bool STOFFInputStream::readDataBlock | ( | long | size,
|  | librevenge::RVNGBinaryData & | data
| ) |  |

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

Referenced by readEndDataBlock(), and readULong().

## ◆ readDouble10()

bool STOFFInputStream::readDouble10 | ( | double & | res,
|  | bool & | isNotANumber
| ) |  |

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

Referenced by readULong().

## ◆ readDouble8()

bool STOFFInputStream::readDouble8 | ( | double & | res,
|  | bool & | isNotANumber
| ) |  |

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

Referenced by readULong().

## ◆ readDoubleReverted8()

bool STOFFInputStream::readDoubleReverted8 | ( | double & | res,
|  | bool & | isNotANumber
| ) |  |

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

Referenced by operator>>(), and readULong().

## ◆ readEndDataBlock()

bool STOFFInputStream::readEndDataBlock | ( | librevenge::RVNGBinaryData & | data | ) |

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

Referenced by readULong().

## ◆ readInverted()

bool STOFFInputStream::readInverted | ( |  | ) | const
| inline

returns the endian mode (see constructor)

## ◆ readLong()

long STOFFInputStream::readLong | ( | int | num | ) |

return a int8, int16, int32 readed from actualPos

Referenced by operator>>(), and readULong().

## ◆ readU8()

uint8_t STOFFInputStream::readU8 | ( | librevenge::RVNGInputStream * | stream | ) |
| staticprotected

internal function used to read a byte

Referenced by hasDataFork(), and readULong().

## ◆ readULong() [1/2]

unsigned long STOFFInputStream::readULong | ( | int | num | ) |
| inline

returns a uint8, uint16, uint32 readed from actualPos

Referenced by operator>>(), peek(), readColor(), readCompressedLong(), readCompressedULong(), readDouble10(), readDouble8(), readDoubleReverted8(), readLong(), and readULong().

## ◆ readULong() [2/2]

unsigned long STOFFInputStream::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 STOFFInputStream::seek | ( | long | offset,
|  | librevenge::RVNG_SEEK_TYPE | seekType
| ) |  |

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

Returns
  0 if ok

Referenced by getSubStreamById(), getSubStreamByName(), operator>>(), peek(), readDouble10(), setReadInverted(), and STOFFInputStream().

## ◆ setReadInverted()

void STOFFInputStream::setReadInverted | ( | bool | newVal | ) |
| inline

sets the endian mode

## ◆ size()

long STOFFInputStream::size | ( |  | ) | const
| inline

returns the stream size

Referenced by isEnd(), readDataBlock(), readEndDataBlock(), readULong(), and seek().

## ◆ subStreamCount()

unsigned STOFFInputStream::subStreamCount | ( |  | ) |

returns the number of substream

Referenced by readULong().

## ◆ subStreamName()

std::string STOFFInputStream::subStreamName | ( | unsigned | id | ) |

returns the name of the i^th substream

Referenced by readULong().

## ◆ tell()

long STOFFInputStream::tell | ( |  | ) |

returns actual offset position

Referenced by getSubStreamById(), getSubStreamByName(), operator>>(), readColor(), readCompressedLong(), readDataBlock(), readDouble10(), readDouble8(), readDoubleReverted8(), readEndDataBlock(), seek(), setReadInverted(), and updateStreamSize().

## ◆ updateStreamSize()

void STOFFInputStream::updateStreamSize | ( |  | ) |
| protected

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

Referenced by hasDataFork(), and STOFFInputStream().

## Member Data Documentation

## ◆ m_inverseRead

bool STOFFInputStream::m_inverseRead
| protected

big or normal endian

Referenced by getSubStreamById(), getSubStreamByName(), readInverted(), readULong(), and setReadInverted().

## ◆ m_stream

std::shared_ptr<librevenge::RVNGInputStream> STOFFInputStream::m_stream
| protected

the initial input

Referenced by getSubStreamById(), getSubStreamByName(), hasDataFork(), input(), isEnd(), isStructured(), read(), readColor(), readCompressedLong(), readCompressedULong(), readDataBlock(), readDouble10(), readDouble8(), readDoubleReverted8(), readULong(), seek(), STOFFInputStream(), subStreamCount(), subStreamName(), tell(), and updateStreamSize().

## ◆ m_streamSize

long STOFFInputStream::m_streamSize
| protected

the stream size

Referenced by checkPosition(), readCompressedLong(), readDouble10(), readDouble8(), readDoubleReverted8(), seek(), size(), and updateStreamSize().

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

- STOFFInputStream.hxx
- STOFFInputStream.cxx