Support Forum       G3D Web Page     
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
G3D::PrefixTree Class Reference

Inherits G3D::ReferenceCountedObject.

Public Member Functions

 PrefixTree (const String &value="")
 
virtual ~PrefixTree ()
 
const Array< shared_ptr< PrefixTree > > & children () const
 
bool contains (const String &s)
 
String getPathToBranch (shared_ptr< PrefixTree > &branchPoint)
 
void insert (String s)
 
bool isLeaf () const
 If the node is a leaf, then its value is the full inserted value. More...
 
int size () const
 
const Stringvalue () const
 

Static Public Member Functions

static shared_ptr< PrefixTreecreate (const String &s="", bool cleanUpInput=false)
 
template<class T >
static shared_ptr< PrefixTreecreate (const Array< T > &elements, bool cleanUpInput=false)
 

Protected Member Functions

bool canHaveChildren ()
 
const shared_ptr< PrefixTreechildNodeWithPrefix (const String &s)
 
void fillComponents (String s, Array< String > &components)
 Perform input clean up on string s while converting to component array. More...
 

Static Protected Member Functions

static void compactJoin (Array< String > &elements, String &result)
 Modifies input array. More...
 
static void compactSplit (const String &s, Array< String > &result)
 
template<class T , class ... ArgTypes>
static shared_ptr< T > createShared (ArgTypes &&... args)
 Like std::make_shared, but works for protected constructors. More...
 
static void rejectEmptyString (Array< String > &elements)
 Mutates array, omitting elements that are the empty string. More...
 

Protected Attributes

Array< shared_ptr< PrefixTree > > m_children
 
bool m_cleanUpInput
 If set to true, then we will treat special characters as spaces when creating PrefixTree. More...
 
int m_size = 0
 Number of leaf nodes. More...
 
const String m_value
 

Static Protected Attributes

static constexpr char DELIMITER = '\31'
 ANSI "item separator". More...
 

Constructor & Destructor Documentation

◆ PrefixTree()

G3D::PrefixTree::PrefixTree ( const String value = "")

◆ ~PrefixTree()

virtual G3D::PrefixTree::~PrefixTree ( )
virtual

Member Function Documentation

◆ canHaveChildren()

bool G3D::PrefixTree::canHaveChildren ( )
protected

◆ childNodeWithPrefix()

const shared_ptr<PrefixTree> G3D::PrefixTree::childNodeWithPrefix ( const String s)
protected

◆ children()

const Array<shared_ptr<PrefixTree> >& G3D::PrefixTree::children ( ) const
inline

◆ compactJoin()

static void G3D::PrefixTree::compactJoin ( Array< String > &  elements,
String result 
)
staticprotected

Modifies input array.

◆ compactSplit()

static void G3D::PrefixTree::compactSplit ( const String s,
Array< String > &  result 
)
staticprotected

◆ contains()

bool G3D::PrefixTree::contains ( const String s)

◆ create() [1/2]

static shared_ptr<PrefixTree> G3D::PrefixTree::create ( const String s = "",
bool  cleanUpInput = false 
)
inlinestatic

Referenced by create().

◆ create() [2/2]

template<class T >
static shared_ptr<PrefixTree> G3D::PrefixTree::create ( const Array< T > &  elements,
bool  cleanUpInput = false 
)
inlinestatic

◆ createShared()

template<class T , class ... ArgTypes>
static shared_ptr<T> G3D::ReferenceCountedObject::createShared ( ArgTypes &&...  args)
inlinestaticprotectedinherited

Like std::make_shared, but works for protected constructors.

Call as createShared<myclass>.

◆ fillComponents()

void G3D::PrefixTree::fillComponents ( String  s,
Array< String > &  components 
)
protected

Perform input clean up on string s while converting to component array.

◆ getPathToBranch()

String G3D::PrefixTree::getPathToBranch ( shared_ptr< PrefixTree > &  branchPoint)

◆ insert()

void G3D::PrefixTree::insert ( String  s)

◆ isLeaf()

bool G3D::PrefixTree::isLeaf ( ) const
inline

If the node is a leaf, then its value is the full inserted value.

Roughly, the result of joining all the prefixes on the path to the leaf; specifically, the String that was passed to PrefixTree::insert()

◆ rejectEmptyString()

static void G3D::PrefixTree::rejectEmptyString ( Array< String > &  elements)
staticprotected

Mutates array, omitting elements that are the empty string.

◆ size()

int G3D::PrefixTree::size ( ) const
inline

◆ value()

const String& G3D::PrefixTree::value ( ) const
inline

Member Data Documentation

◆ DELIMITER

constexpr char G3D::PrefixTree::DELIMITER = '\31'
staticprotected

ANSI "item separator".

Referenced by create().

◆ m_children

Array<shared_ptr<PrefixTree> > G3D::PrefixTree::m_children
protected

Referenced by children(), and isLeaf().

◆ m_cleanUpInput

bool G3D::PrefixTree::m_cleanUpInput
protected

If set to true, then we will treat special characters as spaces when creating PrefixTree.

◆ m_size

int G3D::PrefixTree::m_size = 0
protected

Number of leaf nodes.

Referenced by size().

◆ m_value

const String G3D::PrefixTree::m_value
protected

Referenced by value().


documentation generated on Wed Nov 24 2021 08:01:59 using doxygen 1.8.15