Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
libwps_OLE::OStorage Class Reference

## Public Member Functions
| OStorage (unsigned long minSize=0)
| constructor More...
| ~OStorage ()
| destructor More...
std::vector< std::string > | getSubStreamList (unsigned ind=0, bool all=false)
| function to retrieve the list of actual direntry More...
void | setRevision (unsigned rev)
| set the OLE revision More...
void | setRootType (bool pc)
| set the root to a mac/pc root */ More...
bool | addStream (std::string const &name, unsigned char const *buffer, unsigned long len)
| add a new stream knowing its data More...
bool | addDirectory (std::string const &dir)
| add a new directory (usefull to create empty leaf dir ) More...
void | setInformation (std::string const &name, DirInfo const &info)
| set a node information More...
bool | getFileData (std::vector< unsigned char > &data)
| try to return in data the contain of the file More...

## Protected Member Functions
unsigned | insertData (unsigned char const *buffer, unsigned long len, bool useBigBlock, unsigned end=Eof)
| add stream data in a file, returns the first index More...
bool | useBigBlockFor (unsigned long size) const
| return true if we need to use big block More...
size_t | getDataAddress (unsigned block, bool isBig) const
| returns the address of a big/small block More...
unsigned | newBBlock ()
| create a new big block, resize m_data; ... and return is identifier More...
unsigned | newSBlock ()
| create a new small block, ... and returns is identifier More...
DirEntry * | createEntry (std::string const &name)
| return a new dir entry, if it does not exists More...
bool | updateToSave ()
| finish to update the file ( note: it is better to call this function only one time ) More...

## Static Protected Member Functions
static unsigned long | getMaximumSize (bool isBig)
| returns the maximum size of a big/small block More...

## Protected Attributes
Header | m_header
DirTree | m_dirtree
AllocTable | m_bbat
unsigned | m_num_bbat
AllocTable | m_sbat
unsigned | m_num_sbat
std::vector< unsigned long > | m_sb_blocks
std::vector< unsigned char > | m_data

## Private Member Functions
| OStorage (const OStorage &)
OStorage & | operator= (const OStorage &)

## Constructor & Destructor Documentation

## ◆ OStorage() [1/2]

libwps_OLE::OStorage::OStorage | ( | unsigned long | minSize = `0` | ) |
| inline explicit

constructor

## ◆ ~OStorage()

libwps_OLE::OStorage::~OStorage | ( |  | ) |
| inline

destructor

## ◆ OStorage() [2/2]

libwps_OLE::OStorage::OStorage | ( | const OStorage & |  | ) |
| private

## Member Function Documentation

## ◆ addDirectory()

bool libwps_OLE::OStorage::addDirectory | ( | std::string const & | dir | ) |

add a new directory (usefull to create empty leaf dir )

Referenced by libwps_OLE::IStream::createOleFromDirectory().

## ◆ addStream()

bool libwps_OLE::OStorage::addStream | ( | std::string const & | name,
|  | unsigned char const * | buffer,
|  | unsigned long | len
| ) |  |

add a new stream knowing its data

Referenced by libwps_OLE::IStream::createOleFromDirectory().

## ◆ createEntry()

DirEntry* libwps_OLE::OStorage::createEntry | ( | std::string const & | name | ) |
| inline protected

return a new dir entry, if it does not exists

## ◆ getDataAddress()

size_t libwps_OLE::OStorage::getDataAddress | ( | unsigned | block,
|  | bool | isBig
| ) |  | const
| inline protected

returns the address of a big/small block

## ◆ getFileData()

bool libwps_OLE::OStorage::getFileData | ( | std::vector< unsigned char > & | data | ) |
| inline

try to return in data the contain of the file

Referenced by libwps_OLE::IStream::createOleFromDirectory().

## ◆ getMaximumSize()

static unsigned long libwps_OLE::OStorage::getMaximumSize | ( | bool | isBig | ) |
| inline static protected

returns the maximum size of a big/small block

## ◆ getSubStreamList()

std::vector<std::string> libwps_OLE::OStorage::getSubStreamList | ( | unsigned | ind = `0`,
|  | bool | all = `false`
| ) |  |
| inline

function to retrieve the list of actual direntry

Referenced by libwps_OLE::IStream::createOleFromDirectory().

## ◆ insertData()

unsigned libwps_OLE::OStorage::insertData | ( | unsigned char const * | buffer,
|  | unsigned long | len,
|  | bool | useBigBlock,
|  | unsigned | end = `Eof`
| ) |  |
| protected

add stream data in a file, returns the first index

## ◆ newBBlock()

unsigned libwps_OLE::OStorage::newBBlock | ( |  | ) |
| inline protected

create a new big block, resize m_data; ... and return is identifier

Referenced by newSBlock().

## ◆ newSBlock()

unsigned libwps_OLE::OStorage::newSBlock | ( |  | ) |
| inline protected

create a new small block, ... and returns is identifier

## ◆ operator=()

OStorage& libwps_OLE::OStorage::operator= | ( | const OStorage & |  | ) |
| private

## ◆ setInformation()

void libwps_OLE::OStorage::setInformation | ( | std::string const & | name,
|  | DirInfo const & | info
| ) |  |
| inline

set a node information

Referenced by libwps_OLE::IStream::createOleFromDirectory().

## ◆ setRevision()

void libwps_OLE::OStorage::setRevision | ( | unsigned | rev | ) |
| inline

set the OLE revision

Referenced by libwps_OLE::IStream::createOleFromDirectory().

## ◆ setRootType()

void libwps_OLE::OStorage::setRootType | ( | bool | pc | ) |
| inline

set the root to a mac/pc root */

Referenced by libwps_OLE::IStream::createOleFromDirectory().

## ◆ updateToSave()

bool libwps_OLE::OStorage::updateToSave | ( |  | ) |
| protected

finish to update the file ( note: it is better to call this function only one time )

Referenced by getFileData().

## ◆ useBigBlockFor()

bool libwps_OLE::OStorage::useBigBlockFor | ( | unsigned long | size | ) | const
| inline protected

return true if we need to use big block

## Member Data Documentation

## ◆ m_bbat

AllocTable libwps_OLE::OStorage::m_bbat
| protected

Referenced by newBBlock().

## ◆ m_data

std::vector<unsigned char> libwps_OLE::OStorage::m_data
| protected

Referenced by getFileData(), newBBlock(), and OStorage().

## ◆ m_dirtree

DirTree libwps_OLE::OStorage::m_dirtree
| protected

Referenced by createEntry(), getSubStreamList(), setInformation(), and setRootType().

## ◆ m_header

Header libwps_OLE::OStorage::m_header
| protected

Referenced by setRevision(), and useBigBlockFor().

## ◆ m_num_bbat

unsigned libwps_OLE::OStorage::m_num_bbat
| protected

Referenced by newBBlock().

## ◆ m_num_sbat

unsigned libwps_OLE::OStorage::m_num_sbat
| protected

Referenced by newSBlock().

## ◆ m_sb_blocks

std::vector<unsigned long> libwps_OLE::OStorage::m_sb_blocks
| protected

Referenced by getDataAddress(), and newSBlock().

## ◆ m_sbat

AllocTable libwps_OLE::OStorage::m_sbat
| protected

Referenced by newSBlock().

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

- WPSOLEStream.cpp