|
Arduino DLNA Server
|
Simple in-memory directory tree built using SdFat recursive directory listing. More...
#include <SdFatDirectoryTree.h>
Public Member Functions | |
| bool | begin (FS &SD, const char *beginPath="/") |
| Initializes the tree by scanning from a starting path. | |
| void | end () |
| Releases all dynamically allocated nodes and clears the tree. | |
| TreeNode & | root () |
| Returns the root node of the tree. | |
| TreeNode & | getTreeNodeById (uint32_t id) |
| Finds a node by its numeric id. | |
| std::vector< TreeNode *, AllocatorPSRAM< TreeNode * > > | getAllFiles () |
| Collects all file nodes (non-directories) under the root. | |
| stringPSRAM | path (uint32_t id) |
| Convenience helper to get a path by node id. | |
| size_t | size () |
| Returns the total number of nodes in the tree. | |
Protected Member Functions | |
| void | collectAllFilesFrom (TreeNode &node, std::vector< TreeNode *, AllocatorPSRAM< TreeNode * > > &result) |
| void | buildTree (TreeNode &node) |
Static Protected Member Functions | |
| static void | onParsedCallback (SdFatFileInfo &info, void *ref) |
Protected Attributes | |
| SdFatParser | parser |
| FS * | p_sd = nullptr |
| std::vector< TreeNode *, AllocatorPSRAM< TreeNode * > > | tree_nodes |
| std::vector< TreeNode * > | parent_stack |
Simple in-memory directory tree built using SdFat recursive directory listing.
The tree is constructed by asking SdFat to list recursively (LS_R). Each line of output is parsed into a node, with indentation (two spaces per level) determining the hierarchy and a trailing '/' indicating directories.
| FS | Filesystem type that exposes chdir() and ls(Print*, uint8_t flags) compatible with SdFat's API. |
|
inline |
Initializes the tree by scanning from a starting path.
| SD | Filesystem instance (e.g., SdFs). |
| beginPath | Root path to start scanning from (defaults to "/"). |
|
inlineprotected |
|
inlineprotected |
|
inline |
Releases all dynamically allocated nodes and clears the tree.
|
inline |
Collects all file nodes (non-directories) under the root.
|
inline |
Finds a node by its numeric id.
| id | The node id assigned during tree construction. |
|
inlinestaticprotected |
|
inline |
Convenience helper to get a path by node id.
|
inline |
Returns the root node of the tree.
|
inline |
Returns the total number of nodes in the tree.
|
protected |
|
protected |
|
protected |
|
protected |