|
| FileSystemTrie () |
|
Node * | root () |
|
const Node * | root () const |
|
Node * | find (Node *base, FileSystemPathView relativePath) |
|
Node * | find (FileSystemPathView path) |
|
const Node * | find (const Node *base, FileSystemPathView relativePath) const |
|
const Node * | find (FileSystemPathView path) const |
|
Node * | walk (Node *base, FileSystemPathView relativePath, FileSystemPathView *tail=nullptr) |
|
Node * | walk (FileSystemPathView path, FileSystemPathView *tail=nullptr) |
|
const Node * | walk (const Node *base, FileSystemPathView relativePath, FileSystemPathView *tail=nullptr) const |
|
const Node * | walk (FileSystemPathView path, FileSystemPathView *tail=nullptr) const |
|
bool | erase (Node *base, FileSystemPathView relativePath={}) |
|
bool | erase (FileSystemPathView path) |
|
void | chop (Node *base, FileSystemPathView relativePath={}) |
|
void | chop (FileSystemPathView path) |
|
Node * | insertOrAssign (Node *base, FileSystemPathView relativePath, T value) |
|
Node * | insertOrAssign (FileSystemPathView path, T value) |
|
std::unique_ptr< Node > | extract (Node *node) |
|
Node * | insertOrAssign (Node *base, FileSystemPathView relativePath, std::unique_ptr< Node > node) |
|
Node * | insertOrAssign (FileSystemPathView path, std::unique_ptr< Node > node) |
|
void | clear () |
|
bool | isEmpty () const |
|
template<class T>
class detail::FileSystemTrie< T >
Trie map from FileSystemPath
to T
.
Each node can contain a value, even if it's not a leaf node. If the user needs a trie that only contains values in the leaf nodes, then it's up to the user to maintain this invariant.
The only invariant maintained by FileSystemTrie
is that it automatically drops all nodes that don't lie on a path to a value node. This means, for example, that the following code will leave the trie empty:
Definition: FileSystemPath.h:24
Definition: FileSystemTrie.h:89
Node * insertOrAssign(Node *base, FileSystemPathView relativePath, T value)
Definition: FileSystemTrie.h:189
bool erase(Node *base, FileSystemPathView relativePath={})
Definition: FileSystemTrie.h:157
Note that the interface of FileSystemTrie
is a bit different from what one would expect a map-like class to offer. We are directly exposing the fact that FileSystemTrie
is a tree. For example, erase
removes subtrees. A more STL-like interface would expose something like equal_range
to get a subtree, and a two-arg erase
to drop it, but that's just adding complexity where it's not warranted.