ALib C++ Framework
by
Library Version: 2511 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::containers::detail::StringTreeBase< TAllocator, T, TNodeHandler, TRecycling >::NodeBase Struct Reference

Description:

template<typename TAllocator, typename T, typename TNodeHandler, Recycling TRecycling>
struct alib::containers::detail::StringTreeBase< TAllocator, T, TNodeHandler, 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 cannot be received directly and all interface is available via public type Cursor only, which holds a pointer to an object of this class.

Definition at line 139 of file stringtreebase.inl.

Inheritance diagram for alib::containers::detail::StringTreeBase< TAllocator, T, TNodeHandler, TRecycling >::NodeBase:
alib::lang::BidiNodeBase< NodeBase > alib::containers::detail::StringTreeBase< TAllocator, T, TNodeHandler, TRecycling >::NodeKey alib::lang::SidiNodeBase< NodeBase > alib::containers::detail::StringTreeBase< TAllocator, T, TNodeHandler, TRecycling >::Node

Public Field Index:

NodeList children
 The hook to the doubly linked list of children.
uinteger qtyChildren
 The number of children currently stored in this node.
Public Field Index: inherited from alib::lang::BidiNodeBase< NodeBase >
NodeBase * p
Public Field Index: inherited from alib::lang::SidiNodeBase< NodeBase >
NodeBase * n
Public Field Index: inherited from alib::containers::detail::StringTreeBase< TAllocator, T, TNodeHandler, TRecycling >::NodeKey
NodeNameUnion name
NodeBaseparent

Public Method Index:

 NodeBase (const NodeKey &pKey)
 NodeBase (NodeBase *pParent, const NameType &pName)
strings::TAString< CharacterType, lang::HeapAllocator > & assemblePath (strings::TAString< CharacterType, lang::HeapAllocator > &target, const NodeBase *childNode, const NodeBase *maxParent, CharacterType separatorChar) const
uinteger deleteChild (StringTreeBase *tree, NodeBase *child)
uinteger deleteChildren (StringTreeBase *tree)
int depth () const
int distance (const NodeBase *other) 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 alib::lang::BidiNodeBase< NodeBase >
 BidiNodeBase () noexcept=default
 Default constructor. (Does not initialize the pointer!).
void addBefore (NodeBase *elem) noexcept
void addBehind (NodeBase *elem) noexcept
BidiNodeBaseoperator= (const BidiNodeBase &)=delete
NodeBase * prev () const noexcept
void remove () noexcept
 Unhooks this node from a list.
Public Method Index: inherited from alib::lang::SidiNodeBase< NodeBase >
 SidiNodeBase () noexcept=default
 Default constructor. (Does not initialize the pointer.).
NodeBase * addBehind (NodeBase *elem) noexcept
integer count (SidiNodeBase *end=nullptr) const noexcept
bool hasNext () const
void next (SidiNodeBase *p)
SidiNodeBaseoperator= (const SidiNodeBase &)=delete
bool pointsTo (const SidiNodeBase *elem) const
NodeBase * removeNext () noexcept
NodeBase * removeRangeBehind (NodeBase *last) noexcept
Public Method Index: inherited from alib::containers::detail::StringTreeBase< TAllocator, T, TNodeHandler, TRecycling >::NodeKey
 NodeKey (NodeBase *pParent, const NameType &pName)

Additional Inherited Members

Public Type Index: inherited from alib::lang::BidiNodeBase< NodeBase >
using FWDNode
 Alias name for an instantiation of the base template.

Field Details:

◆ children

template<typename TAllocator, typename T, typename TNodeHandler, Recycling TRecycling>
NodeList alib::containers::detail::StringTreeBase< TAllocator, T, TNodeHandler, TRecycling >::NodeBase::children

The hook to the doubly linked list of children.

Definition at line 146 of file stringtreebase.inl.

◆ qtyChildren

template<typename TAllocator, typename T, typename TNodeHandler, Recycling TRecycling>
uinteger alib::containers::detail::StringTreeBase< TAllocator, T, TNodeHandler, TRecycling >::NodeBase::qtyChildren

The number of children currently stored in this node.

Definition at line 143 of file stringtreebase.inl.

Constructor(s) / Destructor Details:

◆ NodeBase() [1/2]

template<typename TAllocator, typename T, typename TNodeHandler, Recycling TRecycling>
alib::containers::detail::StringTreeBase< TAllocator, T, TNodeHandler, TRecycling >::NodeBase::NodeBase ( const NodeKey & pKey)
inline

Constructor.

Parameters
pKeyThe key portion of the node.

Definition at line 150 of file stringtreebase.inl.

◆ NodeBase() [2/2]

template<typename TAllocator, typename T, typename TNodeHandler, Recycling TRecycling>
alib::containers::detail::StringTreeBase< TAllocator, T, TNodeHandler, TRecycling >::NodeBase::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 157 of file stringtreebase.inl.

Method Details:

◆ assemblePath()

template<typename TAllocator, typename T, typename TNodeHandler, Recycling TRecycling>
strings::TAString< CharacterType, lang::HeapAllocator > & alib::containers::detail::StringTreeBase< TAllocator, T, TNodeHandler, TRecycling >::NodeBase::assemblePath ( strings::TAString< CharacterType, lang::HeapAllocator > & target,
const NodeBase * childNode,
const NodeBase * maxParent,
CharacterType separatorChar ) const
inline

Implementation of 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 315 of file stringtreebase.inl.

◆ deleteChild()

template<typename TAllocator, typename T, typename TNodeHandler, Recycling TRecycling>
uinteger alib::containers::detail::StringTreeBase< TAllocator, T, TNodeHandler, TRecycling >::NodeBase::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 265 of file stringtreebase.inl.

◆ deleteChildren()

template<typename TAllocator, typename T, typename TNodeHandler, Recycling TRecycling>
uinteger alib::containers::detail::StringTreeBase< TAllocator, T, TNodeHandler, TRecycling >::NodeBase::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 284 of file stringtreebase.inl.

◆ depth()

template<typename TAllocator, typename T, typename TNodeHandler, Recycling TRecycling>
int alib::containers::detail::StringTreeBase< TAllocator, T, TNodeHandler, TRecycling >::NodeBase::depth ( ) const
inline

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

Returns
The depth of this node.

Definition at line 201 of file stringtreebase.inl.

◆ distance()

template<typename TAllocator, typename T, typename TNodeHandler, Recycling TRecycling>
int alib::containers::detail::StringTreeBase< TAllocator, T, TNodeHandler, TRecycling >::NodeBase::distance ( const NodeBase * other) const
inline

Iterates over the parent nodes and searches given other in the path.

Parameters
otherThe node to calculate the distance to.
Returns
The distance of other to this node. 0 if the nodes are the same. -1 if other was not found.

Definition at line 216 of file stringtreebase.inl.

◆ findChild()

template<typename TAllocator, typename T, typename TNodeHandler, Recycling TRecycling>
NodeBase * alib::containers::detail::StringTreeBase< TAllocator, T, TNodeHandler, 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 171 of file stringtreebase.inl.

◆ findOrCreateChild()

template<typename TAllocator, typename T, typename TNodeHandler, Recycling TRecycling>
template<typename... TArgs>
std::pair< NodeBase *, bool > alib::containers::detail::StringTreeBase< TAllocator, T, TNodeHandler, TRecycling >::NodeBase::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 the 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 241 of file stringtreebase.inl.

◆ isRoot()

template<typename TAllocator, typename T, typename TNodeHandler, Recycling TRecycling>
bool alib::containers::detail::StringTreeBase< TAllocator, T, TNodeHandler, TRecycling >::NodeBase::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 163 of file stringtreebase.inl.


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