ALib C++ Library
Library Version: 2402 R1
Documentation generated by doxygen
Loading...
Searching...
No Matches
StringTreeBase< T, TNodeMaintainer, TRecycling >::NodeBase Struct Reference

Description:

template<typename T, typename TNodeMaintainer, typename TRecycling>
struct alib::monomem::detail::StringTreeBase< T, TNodeMaintainer, TRecycling >::NodeBase

This is the base class of the internal node type Node . This type implements functionality needed. Derived type Node then only adds the custom value T.

Objects of this type can not be received directly and all interface is available via public type StringTree::Cursor only, which holds a pointer to an object of this class.

Definition at line 213 of file stringtreebase.inl.

Inheritance diagram for StringTreeBase< T, TNodeMaintainer, TRecycling >::NodeBase:
[legend]
Collaboration diagram for StringTreeBase< T, TNodeMaintainer, TRecycling >::NodeBase:
[legend]

Public Field Index:

NodeList children
 
uinteger qtyChildren
 
- Public Field Index: inherited from BidiNodeBase< NodeBase >
NodeBase * pprev
 
- Public Field Index: inherited from SidiNodeBase< NodeBase >
NodeBase * pnext
 
- Public Field Index: inherited from StringTreeBase< T, TNodeMaintainer, TRecycling >::NodeKey
NodeNameUnion name
 
NodeBaseparent
 

Public Method Index:

 NodeBase (const NodeKey &pKey)
 
 NodeBase (NodeBase *pParent, const NameType &pName)
 
AStringassemblePath (AString &target, const NodeBase *childNode, const NodeBase *maxParent, character separatorChar) const
 
uinteger deleteChild (StringTreeBase *tree, NodeBase *child)
 
uinteger deleteChildren (StringTreeBase *tree)
 
int depth () const
 
NodeBasefindChild (StringTreeBase *tree, const NameType &childName)
 
template<typename... TArgs>
std::pair< NodeBase *, bool > findOrCreateChild (StringTreeBase *tree, const NameType &childName, TArgs &&... args)
 
bool isRoot () const
 
- Public Method Index: inherited from BidiNodeBase< NodeBase >
 BidiNodeBase () noexcept=default
 
 BidiNodeBase (BidiNodeBase &&) noexcept=default
 
 BidiNodeBase (const BidiNodeBase &)=delete
 
 BidiNodeBase (NodeBase *next, NodeBase *prev) noexcept
 
void addBefore (NodeBase *elem)
 
void addBehind (NodeBase *elem)
 
BidiNodeBaseoperator= (BidiNodeBase &&) noexcept=default
 
BidiNodeBaseoperator= (const BidiNodeBase &)=delete
 
NodeBase * prev () const
 
void prev (BidiNodeBase *newPrev)
 
void remove ()
 
void remove (NodeBase *last)
 
- Public Method Index: inherited from SidiNodeBase< NodeBase >
 SidiNodeBase () noexcept=default
 
 SidiNodeBase (const SidiNodeBase &)=delete
 
 SidiNodeBase (NodeBase *next) noexcept
 
 SidiNodeBase (SidiNodeBase &&) noexcept=default
 
NodeBase * addBehind (NodeBase *elem)
 
integer count (SidiNodeBase *end=nullptr) const
 
bool hasNext () const
 
NodeBase * next () const
 
void next (SidiNodeBase *p)
 
SidiNodeBaseoperator= (const SidiNodeBase &)=delete
 
SidiNodeBaseoperator= (SidiNodeBase &&) noexcept=default
 
bool pointsTo (const SidiNodeBase *elem) const
 
NodeBase * removeNext ()
 
NodeBase * removeRangeBehind (NodeBase *last)
 
- Public Method Index: inherited from StringTreeBase< T, TNodeMaintainer, TRecycling >::NodeKey
 NodeKey (NodeBase *pParent, const NameType &pName)
 

Additional Inherited Members

- Public Type Index: inherited from BidiNodeBase< NodeBase >
using FWDNode
 

Field Details:

◆ children

template<typename T , typename TNodeMaintainer , typename TRecycling >
NodeList children

The hook to the doubly linked list of children.

Definition at line 220 of file stringtreebase.inl.

◆ qtyChildren

template<typename T , typename TNodeMaintainer , typename TRecycling >
uinteger qtyChildren

The number of children currently stored in this node.

Definition at line 217 of file stringtreebase.inl.

Constructor(s) / Destructor Details::

◆ NodeBase() [1/2]

template<typename T , typename TNodeMaintainer , typename TRecycling >
NodeBase ( const NodeKey & pKey)
inline

Constructor.

Parameters
pKeyThe key portion of the node.

Definition at line 226 of file stringtreebase.inl.

◆ NodeBase() [2/2]

template<typename T , typename TNodeMaintainer , typename TRecycling >
NodeBase ( NodeBase * pParent,
const NameType & pName )
inline

Constructor. Custom data is default-initialized.

Parameters
pParentParent node to search a child for.
pNameChild name to search

Definition at line 236 of file stringtreebase.inl.

Method Details:

◆ assemblePath()

template<typename T , typename TNodeMaintainer , typename TRecycling >
AString & assemblePath ( AString & target,
const NodeBase * childNode,
const NodeBase * maxParent,
character separatorChar ) const
inline

Implementation of alib::monomem;StringTree<T;TNodeMaintainer;TRecycling>;TCursor::AssemblePath "monomem;StringTree<T;TNodeMaintainer;TRecycling>;TCursor::AssemblePath" .

Parameters
targetThe target to append the path to.
childNodeThe (current) child node.
maxParentThe last parent node to travel up to. The root node is designated by nullptr.
separatorCharThe separator character as defined with the template parameter of class StringTree .
Returns
The given AString to allow concatenated operations on it.

Definition at line 404 of file stringtreebase.inl.

Here is the call graph for this function:

◆ deleteChild()

template<typename T , typename TNodeMaintainer , typename TRecycling >
uinteger deleteChild ( StringTreeBase * tree,
NodeBase * child )
inline

Deletes a given child node.

Note
If the given node is not a child of this node, the behavior is undefined. With debug builds, in this case an ALib assertion is raised.
Parameters
treeThe tree this node belongs to.
childA pointer to a child of this node that is to be deleted.
Returns
The total number of nodes deleted.

Definition at line 349 of file stringtreebase.inl.

Here is the call graph for this function:

◆ deleteChildren()

template<typename T , typename TNodeMaintainer , typename TRecycling >
uinteger deleteChildren ( StringTreeBase * tree)
inline

Deletes all child nodes.

Parameters
treeThe tree this node belongs to.
Returns
The number of children that were deleted.

Definition at line 371 of file stringtreebase.inl.

Here is the call graph for this function:

◆ depth()

template<typename T , typename TNodeMaintainer , typename TRecycling >
int depth ( ) const
inline

Iterates over the parent nodes to the root node and returns the this node's depth.

Returns
The depth of the this node.

Definition at line 293 of file stringtreebase.inl.

◆ findChild()

template<typename T , typename TNodeMaintainer , typename TRecycling >
NodeBase * findChild ( StringTreeBase * tree,
const NameType & childName )
inline

Searches a child with a given name. The name is not checked for ., .. or if separation characters.

Parameters
treeThe tree this node belongs to.
childNameThe name of the child to search.
Returns
The child or nullptr if not found.

Definition at line 258 of file stringtreebase.inl.

Here is the call graph for this function:

◆ findOrCreateChild()

template<typename T , typename TNodeMaintainer , typename TRecycling >
template<typename... TArgs>
std::pair< NodeBase *, bool > findOrCreateChild ( StringTreeBase * tree,
const NameType & childName,
TArgs &&... args )
inline

Searches a child with a given name, if not found, one is created. The name is not checked for ., .. or if separation characters.

Template Parameters
TArgsTypes of variadic parameters given with parameter args .
Parameters
treeThe tree this node belongs to.
childNameThe name of the child to search.
argsVariadic parameters to be forwarded to constructor of custom type T in the case a child is created.
Returns
A pair containing an iterator referencing either the element found or the new element added. The bool component is true if the insertion took place and false nothing was changed.

Definition at line 320 of file stringtreebase.inl.

Here is the call graph for this function:

◆ isRoot()

template<typename T , typename TNodeMaintainer , typename TRecycling >
bool isRoot ( ) const
inline

Returns true if this is the root node, false otherwise.

Returns
true if this is the root node, false otherwise.

Definition at line 245 of file stringtreebase.inl.


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