libmwawOLE::DirTree Class Reference

Internal and low level: class of libmwawOLE used to store and write a dirTree. More...

## Classes

struct | CompareEntryName
| a comparison funcion of DirTree used to sort the entry by name More...

## Public Member Functions

| DirTree ()
| constructor More...
void | clear ()
| clear all entries, leaving only a root entries More...
void | setRootType (bool pc=true)
| set the root to a mac/pc root More...
bool | hasRootTypePc () const
| returns true if it is a pc file More...
unsigned | count () const
| returns the number of entries More...
DirEntry const * | entry (unsigned ind) const
| returns the entry with a given index More...
DirEntry * | entry (unsigned ind)
| returns the entry with a given index More...
DirEntry * | entry (const std::string &name)
| returns the entry with a given name More...
unsigned | index (const std::string &name, bool create=false)
| given a fullname (e.g "/ObjectPool/_1020961869"), find the entry More...
unsigned | find_child (unsigned ind, const std::string &name) const
| tries to find a child of ind with a given name More...
void | load (unsigned char *buffer, unsigned len)
| tries to read the different entries More...
std::vector< std::string > | getSubStreamList (unsigned ind=0, bool retrieveAll=false) const
| returns the list of ind substream More...
void | setInRedBlackTreeForm ()
| check/update so that the sibling are store with a red black tree More...
unsigned | saveSize () const
| return space required to save a dir entry More...
void | save (unsigned char *buffer) const
| save the list of direntry in buffer More...
void | print_all_siblings (std::ostream &o) const
| a debug function used to print all siblings More...

## Protected Member Functions

std::vector< unsigned > | get_siblings (unsigned ind) const
| returns a list of siblings corresponding to a node More...
void | get_siblings (unsigned ind, std::set< unsigned > &seens) const
| constructs the list of siblings ( by filling the seens set ) More...
void | print_all_siblings (unsigned ind, std::ostream &o, std::set< unsigned > &seens) const
| a debug function used to print all siblings More...
void | print_siblings (unsigned ind, std::ostream &o, std::set< unsigned > &seen) const
| a debug function to print the siblings to try to give a sense to the sibling tree More...
void | getSubStreamList (unsigned ind, bool all, const std::string &prefix, std::vector< std::string > &res, std::set< unsigned > &seen, bool isRoot=false) const
| returns a substream list More...
void | setInRedBlackTreeForm (unsigned id, std::set< unsigned > &seen)
| check that the subtrees of index is a red black tree, if not rebuild it More...

## Private Member Functions

unsigned | setInRBTForm (std::vector< unsigned > const &childList, unsigned firstInd, unsigned lastInd, unsigned height)
| rebuild all the childs m_left, m_right index as a red black tree, returns the root index. More...
| DirTree (const DirTree &)
DirTree & | operator= (const DirTree &)

## Private Attributes

std::vector< DirEntry > | m_entries
| the list of entry More...

## Friends

struct | CompareEntryName

## Detailed Description

Internal and low level: class of libmwawOLE used to store and write a dirTree.

## Constructor & Destructor Documentation

libmwawOLE::DirTree::DirTree | ( |  | ) |

inline

constructor

libmwawOLE::DirTree::DirTree | ( | const DirTree & |  | ) |

private

## Member Function Documentation

void libmwawOLE::DirTree::clear | ( |  | ) |

clear all entries, leaving only a root entries

Referenced by DirTree().

unsigned libmwawOLE::DirTree::count | ( |  | ) | const

inline

returns the number of entries

Referenced by libmwawOLE::IStorage::addDebugInfo(), entry(), get_siblings(), getSubStreamList(), index(), print_all_siblings(), print_siblings(), save(), and saveSize().

DirEntry const* libmwawOLE::DirTree::entry | ( | unsigned | ind | ) | const

inline

returns the entry with a given index

Referenced by libmwawOLE::IStorage::addDebugInfo(), libmwawOLE::OStorage::createEntry(), entry(), libmwawOLE::IStorage::entry(), find_child(), get_siblings(), getSubStreamList(), index(), libmwawOLE::IStorage::isSubStream(), libmwawOLE::DirTree::CompareEntryName::operator()(), print_all_siblings(), print_siblings(), libmwawOLE::OStorage::setInformation(), setInRBTForm(), setInRedBlackTreeForm(), and libmwawOLE::OStorage::updateToSave().

DirEntry* libmwawOLE::DirTree::entry | ( | unsigned | ind | ) |

inline

returns the entry with a given index

DirEntry* libmwawOLE::DirTree::entry | ( | const std::string & | name | ) |

inline

returns the entry with a given name

unsigned libmwawOLE::DirTree::find_child | ( | unsigned | ind,
|  | const std::string & | name
| ) |  | const

inline

tries to find a child of ind with a given name

Referenced by index().

std::vector<unsigned> libmwawOLE::DirTree::get_siblings | ( | unsigned | ind | ) | const

inline protected

returns a list of siblings corresponding to a node

Referenced by find_child(), get_siblings(), getSubStreamList(), and setInRedBlackTreeForm().

void libmwawOLE::DirTree::get_siblings | ( | unsigned | ind,
|  | std::set< unsigned > & | seens
| ) |  | const

inline protected

constructs the list of siblings ( by filling the seens set )

std::vector<std::string> libmwawOLE::DirTree::getSubStreamList | ( | unsigned | ind = `0`,
|  | bool | retrieveAll = `false`
| ) |  | const

inline

returns the list of ind substream

Referenced by getSubStreamList(), libmwawOLE::IStorage::getSubStreamList(), and libmwawOLE::OStorage::getSubStreamList().

void libmwawOLE::DirTree::getSubStreamList | ( | unsigned | ind,
|  | bool | all,
|  | const std::string & | prefix,
|  | std::vector< std::string > & | res,
|  | std::set< unsigned > & | seen,
|  | bool | isRoot = `false`
| ) |  | const

protected

returns a substream list

bool libmwawOLE::DirTree::hasRootTypePc | ( |  | ) | const

inline

returns true if it is a pc file

Referenced by libmwawOLE::IStorage::hasRootTypePc().

unsigned libmwawOLE::DirTree::index | ( | const std::string & | name,
|  | bool | create = `false`
| ) |  |

given a fullname (e.g "/ObjectPool/_1020961869"), find the entry

Referenced by libmwawOLE::OStorage::createEntry(), entry(), and libmwawOLE::IStorage::index().

void libmwawOLE::DirTree::load | ( | unsigned char * | buffer,
|  | unsigned | len
| ) |  |

tries to read the different entries

Referenced by libmwawOLE::IStorage::load().

DirTree& libmwawOLE::DirTree::operator= | ( | const DirTree & |  | ) |

private

void libmwawOLE::DirTree::print_all_siblings | ( | std::ostream & | o | ) | const

inline

a debug function used to print all siblings

Referenced by libmwawOLE::IStorage::load(), and print_all_siblings().

void libmwawOLE::DirTree::print_all_siblings | ( | unsigned | ind,
|  | std::ostream & | o,
|  | std::set< unsigned > & | seens
| ) |  | const

protected

a debug function used to print all siblings

void libmwawOLE::DirTree::print_siblings | ( | unsigned | ind,
|  | std::ostream & | o,
|  | std::set< unsigned > & | seen
| ) |  | const

protected

a debug function to print the siblings to try to give a sense to the sibling tree

Referenced by print_all_siblings().

void libmwawOLE::DirTree::save | ( | unsigned char * | buffer | ) | const

inline

save the list of direntry in buffer

Referenced by libmwawOLE::OStorage::updateToSave().

unsigned libmwawOLE::DirTree::saveSize | ( |  | ) | const

inline

return space required to save a dir entry

Referenced by libmwawOLE::OStorage::updateToSave().

unsigned libmwawOLE::DirTree::setInRBTForm | ( | std::vector< unsigned > const & | childList,
|  | unsigned | firstInd,
|  | unsigned | lastInd,
|  | unsigned | height
| ) |  |

private

rebuild all the childs m_left, m_right index as a red black tree, returns the root index.

Note
  : this function supposes that the childs list is already sorted

Referenced by setInRedBlackTreeForm().

void libmwawOLE::DirTree::setInRedBlackTreeForm | ( |  | ) |

inline

check/update so that the sibling are store with a red black tree

Referenced by setInRedBlackTreeForm(), and libmwawOLE::OStorage::updateToSave().

void libmwawOLE::DirTree::setInRedBlackTreeForm | ( | unsigned | id,
|  | std::set< unsigned > & | seen
| ) |  |

protected

check that the subtrees of index is a red black tree, if not rebuild it

void libmwawOLE::DirTree::setRootType | ( | bool | pc = `true` | ) |

set the root to a mac/pc root

Referenced by clear(), and libmwawOLE::OStorage::setRootType().

## Friends And Related Function Documentation

friend struct CompareEntryName

friend

## Member Data Documentation

std::vector<DirEntry> libmwawOLE::DirTree::m_entries

private

the list of entry

Referenced by clear(), count(), entry(), hasRootTypePc(), index(), load(), save(), and setRootType().

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

- MWAWOLEStream.cxx