FIFE  be64c707dea6b3250bd4355bf5c825d25920087d
FIFE::ZipNode Class Reference

#include <zipnode.h>

+ Collaboration diagram for FIFE::ZipNode:

Public Member Functions

 ZipNode (const std::string &name, ZipNode *parent=0)
 constructor for creating a node More...
 
 ~ZipNode ()
 destructor More...
 
std::string getName () const
 accessor for the name of this node More...
 
std::string getFullName () const
 accessor for the absolute path name of this node More...
 
ZipContentType::Enum getContentType () const
 accessor for the content type of this node More...
 
ZipNodegetParent () const
 accessor for the parent node of this node will be NULL if this node has no parent More...
 
std::vector< ZipNode * > getChildren (ZipContentType::Enum contentType=ZipContentType::All) const
 gives access to retrieve the children of this node More...
 
ZipNodegetChild (const std::string &name, ZipContentType::Enum contentType=ZipContentType::All) const
 gives access to retrieving a specific child node by name More...
 
ZipNodeaddChild (const std::string &child)
 allows adding a child node to this node More...
 
void removeChild (ZipNode *child)
 allows removing a child from this node More...
 
void removeChild (const std::string &name)
 allows removing a child node by name More...
 
bool isLeaf () const
 accessor for checking if this node has any children More...
 
bool isBranch () const
 accessor for checking if this node has children More...
 
void setZipEntryData (const ZipEntryData &entryData)
 sets the zip file entry information for this node in the zip archive More...
 
const ZipEntryDatagetZipEntryData () const
 accessor for the entry data associated with this node in the zip archive More...
 

Private Attributes

std::string m_name
 
ZipContentType::Enum m_contentType
 
ZipEntryData m_entryData
 
ZipNodem_parent
 
ZipNodeContainer m_fileChildren
 
ZipNodeContainer m_directoryChildren
 

Detailed Description

Definition at line 64 of file zipnode.h.

Constructor & Destructor Documentation

◆ ZipNode()

FIFE::ZipNode::ZipNode ( const std::string &  name,
ZipNode parent = 0 
)

constructor for creating a node

Parameters
namethe name of the node
parentthe parent of this node, defaults to NULL

Definition at line 68 of file zipnode.cpp.

References FIFE::ZipContentType::Directory, FIFE::ZipContentType::File, FIFE::HasExtension(), m_contentType, and m_name.

Referenced by addChild().

+ Here is the caller graph for this function:

◆ ~ZipNode()

FIFE::ZipNode::~ZipNode ( )

destructor

Definition at line 83 of file zipnode.cpp.

References m_directoryChildren, and m_fileChildren.

Member Function Documentation

◆ addChild()

ZipNode * FIFE::ZipNode::addChild ( const std::string &  child)

allows adding a child node to this node

Note
this should only be used internally by the FIFE zip classes
Parameters
childthe name to add as a child node
Returns
the newly created child ZipNode

Definition at line 181 of file zipnode.cpp.

References FIFE::ZipContentType::Directory, FIFE::ZipContentType::File, getContentType(), m_directoryChildren, m_fileChildren, and ZipNode().

Referenced by FIFE::ZipTree::addNode().

+ Here is the caller graph for this function:

◆ getChild()

ZipNode * FIFE::ZipNode::getChild ( const std::string &  name,
ZipContentType::Enum  contentType = ZipContentType::All 
) const

gives access to retrieving a specific child node by name

Parameters
namethe name of the child node to search for
contentTypeoptional for filtering on the type of node to return
Returns
the ZipNode pointer matching the child (NULL if not found)

Definition at line 147 of file zipnode.cpp.

References FIFE::ZipContentType::All, FIFE::ZipContentType::Directory, FIFE::ZipContentType::File, FIFE::HasExtension(), m_directoryChildren, and m_fileChildren.

Referenced by FIFE::ZipTree::addNode(), and FIFE::ZipTree::getNode().

+ Here is the caller graph for this function:

◆ getChildren()

std::vector< ZipNode * > FIFE::ZipNode::getChildren ( ZipContentType::Enum  contentType = ZipContentType::All) const

gives access to retrieve the children of this node

Parameters
contentTypeallows filtering on the type of nodes returned,
See also
ZipContentType for description
Returns
vector of ZipNode pointers matching the request

Definition at line 123 of file zipnode.cpp.

References FIFE::ZipContentType::All, FIFE::ZipContentType::Directory, FIFE::ZipContentType::File, m_directoryChildren, and m_fileChildren.

Referenced by FIFE::ZipSource::listDirectories(), FIFE::ZipSource::listFiles(), and operator<<().

+ Here is the caller graph for this function:

◆ getContentType()

ZipContentType::Enum FIFE::ZipNode::getContentType ( ) const

accessor for the content type of this node

Returns
ZipContentType enumeration

Definition at line 115 of file zipnode.cpp.

References m_contentType.

Referenced by addChild(), and removeChild().

+ Here is the caller graph for this function:

◆ getFullName()

std::string FIFE::ZipNode::getFullName ( ) const

accessor for the absolute path name of this node

Definition at line 100 of file zipnode.cpp.

References getFullName(), m_name, and m_parent.

Referenced by getFullName().

+ Here is the caller graph for this function:

◆ getName()

std::string FIFE::ZipNode::getName ( ) const

accessor for the name of this node

Definition at line 96 of file zipnode.cpp.

References m_name.

Referenced by operator<<().

+ Here is the caller graph for this function:

◆ getParent()

ZipNode * FIFE::ZipNode::getParent ( ) const

accessor for the parent node of this node will be NULL if this node has no parent

Definition at line 119 of file zipnode.cpp.

References m_parent.

Referenced by FIFE::ZipTree::getNode().

+ Here is the caller graph for this function:

◆ getZipEntryData()

const ZipEntryData & FIFE::ZipNode::getZipEntryData ( ) const

accessor for the entry data associated with this node in the zip archive

Returns
ZipEntryData for this node

Definition at line 246 of file zipnode.cpp.

References m_entryData.

Referenced by FIFE::ZipSource::open().

+ Here is the caller graph for this function:

◆ isBranch()

bool FIFE::ZipNode::isBranch ( ) const

accessor for checking if this node has children

Returns
true if node has children false if node does not have children

Definition at line 236 of file zipnode.cpp.

References isLeaf().

◆ isLeaf()

bool FIFE::ZipNode::isLeaf ( ) const

accessor for checking if this node has any children

Returns
true if node has no children false if node has children

Definition at line 231 of file zipnode.cpp.

References m_directoryChildren, and m_fileChildren.

Referenced by isBranch().

+ Here is the caller graph for this function:

◆ removeChild() [1/2]

void FIFE::ZipNode::removeChild ( ZipNode child)

allows removing a child from this node

Parameters
childthe child node to remove

Definition at line 198 of file zipnode.cpp.

References FIFE::ZipContentType::File, getContentType(), and m_fileChildren.

◆ removeChild() [2/2]

void FIFE::ZipNode::removeChild ( const std::string &  name)

allows removing a child node by name

Parameters
namethe name of the child to remove

Definition at line 212 of file zipnode.cpp.

References FIFE::HasExtension(), m_directoryChildren, and m_fileChildren.

◆ setZipEntryData()

void FIFE::ZipNode::setZipEntryData ( const ZipEntryData entryData)

sets the zip file entry information for this node in the zip archive

Parameters
entryDatathe entry data that goes with this node

Definition at line 241 of file zipnode.cpp.

References m_entryData.

Referenced by FIFE::ZipSource::readFileToIndex().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_contentType

ZipContentType::Enum FIFE::ZipNode::m_contentType
private

Definition at line 153 of file zipnode.h.

Referenced by getContentType(), and ZipNode().

◆ m_directoryChildren

ZipNodeContainer FIFE::ZipNode::m_directoryChildren
private

Definition at line 158 of file zipnode.h.

Referenced by addChild(), getChild(), getChildren(), isLeaf(), removeChild(), and ~ZipNode().

◆ m_entryData

ZipEntryData FIFE::ZipNode::m_entryData
private

Definition at line 154 of file zipnode.h.

Referenced by getZipEntryData(), and setZipEntryData().

◆ m_fileChildren

ZipNodeContainer FIFE::ZipNode::m_fileChildren
private

Definition at line 157 of file zipnode.h.

Referenced by addChild(), getChild(), getChildren(), isLeaf(), removeChild(), and ~ZipNode().

◆ m_name

std::string FIFE::ZipNode::m_name
private

Definition at line 152 of file zipnode.h.

Referenced by getFullName(), getName(), and ZipNode().

◆ m_parent

ZipNode* FIFE::ZipNode::m_parent
private

Definition at line 156 of file zipnode.h.

Referenced by getFullName(), and getParent().


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