librevenge::DirTree Class Reference documentation

librevenge::DirTree Class Reference

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

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

## Protected Member Functions
std::vector< unsigned > | get_siblings (unsigned ind) const
| returns a list of siblings corresponding to a node
void | get_siblings (unsigned ind, std::set< unsigned > &seens) const
| constructs the list of siblings ( by filling the seens set )
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
void | setInRedBlackTreeForm (unsigned id, std::set< unsigned > &seen)
| check that the subtrees of index is a red black tree, if not rebuild it
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.

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

## Private Attributes
std::vector< DirEntry > | m_entries

## Constructor & Destructor Documentation

## ◆ DirTree() [1/2]

librevenge::DirTree::DirTree | ( |  | ) |
| inline

constructor

Referenced by librevenge::DirTree::CompareEntryName::CompareEntryName(), DirTree(), and operator=().

## ◆ DirTree() [2/2]

librevenge::DirTree::DirTree | ( | const DirTree & |  | ) |
| private

## Member Function Documentation

## ◆ clear()

void librevenge::DirTree::clear | ( |  | ) |

clear all entries, leaving only a root entries

Referenced by DirTree().

## ◆ count()

unsigned librevenge::DirTree::count | ( |  | ) | const
| inline

returns the number of entries

Referenced by entry(), entry(), get_siblings(), getSubStreamList(), index(), save(), and saveSize().

## ◆ entry() [1/3]

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

returns the entry with a given name

## ◆ entry() [2/3]

DirEntry * librevenge::DirTree::entry | ( | unsigned | ind | ) |
| inline

returns the entry with a given index

## ◆ entry() [3/3]

DirEntry const * librevenge::DirTree::entry | ( | unsigned | ind | ) | const
| inline

returns the entry with a given index

Referenced by entry(), find_child(), get_siblings(), getSubStreamList(), index(), setInRBTForm(), and setInRedBlackTreeForm().

## ◆ find_child()

unsigned librevenge::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().

## ◆ get_siblings() [1/2]

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

returns a list of siblings corresponding to a node

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

## ◆ get_siblings() [2/2]

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

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

## ◆ getSubStreamList() [1/2]

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

## ◆ getSubStreamList() [2/2]

std::vector< std::string > librevenge::DirTree::getSubStreamList | ( | unsigned | ind = 0,
|  | bool | retrieveAll = false )
| inline

returns the list of ind substream

Referenced by getSubStreamList(), and getSubStreamList().

## ◆ hasRootTypePc()

bool librevenge::DirTree::hasRootTypePc | ( |  | ) | const
| inline

returns true if it is a pc file

## ◆ index()

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

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

Referenced by entry().

## ◆ load()

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

tries to read the different entries

## ◆ operator=()

DirTree & librevenge::DirTree::operator= | ( | const DirTree & |  | ) |
| private

## ◆ save()

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

save the list of direntry in buffer

Referenced by save().

## ◆ saveSize()

unsigned librevenge::DirTree::saveSize | ( |  | ) | const
| inline

return space required to save a dir entry

## ◆ setInRBTForm()

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

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 setInRBTForm(), and setInRedBlackTreeForm().

## ◆ setInRedBlackTreeForm() [1/2]

void librevenge::DirTree::setInRedBlackTreeForm | ( |  | ) |
| inline

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

Referenced by setInRedBlackTreeForm(), and setInRedBlackTreeForm().

## ◆ setInRedBlackTreeForm() [2/2]

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

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

## ◆ setRootType()

void librevenge::DirTree::setRootType | ( | bool | pc = true | ) |

set the root to a mac/pc root

Referenced by clear().

## Member Data Documentation

## ◆ m_entries

std::vector<DirEntry> librevenge::DirTree::m_entries
| private

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

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

- RVNGOLEStream.cpp