Arduino DLNA Server
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
tiny_dlna::TreeNode Class Reference

Node in the directory tree representing either a file or a directory. More...

#include <TreeNode.h>

Public Member Functions

 TreeNode ()=default
 
std::string getMime () const
 Very basic MIME inference based on file extension.
 
std::string path () const
 Computes the full path from the root to this node.
 
int level () const
 Returns the nesting level from the root.
 

Static Public Member Functions

static void * operator new (std::size_t size)
 
static void operator delete (void *ptr)
 
static void setMimeRules (const std::vector< std::pair< std::string, std::string > > &rules)
 Replace all MIME rules.
 
static void addMimeRule (const std::string &ext, const std::string &mime)
 Add one MIME rule mapping extension -> MIME type.
 

Public Attributes

uint32_t id = 0
 
stringPSRAM file_name
 
std::vector< TreeNode *, AllocatorPSRAM< TreeNode * > > children
 
TreeNodeparent = nullptr
 
uint32_t size = 0
 
bool is_expanded = false
 
bool is_dir = false
 

Detailed Description

Node in the directory tree representing either a file or a directory.

Constructor & Destructor Documentation

◆ TreeNode()

tiny_dlna::TreeNode::TreeNode ( )
default

Member Function Documentation

◆ addMimeRule()

static void tiny_dlna::TreeNode::addMimeRule ( const std::string &  ext,
const std::string &  mime 
)
inlinestatic

Add one MIME rule mapping extension -> MIME type.

◆ getMime()

std::string tiny_dlna::TreeNode::getMime ( ) const
inline

Very basic MIME inference based on file extension.

Returns
A MIME type string for known audio formats, or empty string if unknown or directory.

◆ level()

int tiny_dlna::TreeNode::level ( ) const
inline

Returns the nesting level from the root.

Returns
0 for the root, otherwise number of parents to reach the root.

◆ operator delete()

static void tiny_dlna::TreeNode::operator delete ( void *  ptr)
inlinestatic

◆ operator new()

static void * tiny_dlna::TreeNode::operator new ( std::size_t  size)
inlinestatic

◆ path()

std::string tiny_dlna::TreeNode::path ( ) const
inline

Computes the full path from the root to this node.

Returns
Path string where directory components are separated by '/'.

◆ setMimeRules()

static void tiny_dlna::TreeNode::setMimeRules ( const std::vector< std::pair< std::string, std::string > > &  rules)
inlinestatic

Replace all MIME rules.

Extensions are matched case-insensitively against the file name and should include the leading dot (e.g. ".mp3"). If provided without a dot or with uppercase letters, they will be normalized.

Member Data Documentation

◆ children

std::vector<TreeNode*, AllocatorPSRAM<TreeNode*> > tiny_dlna::TreeNode::children

◆ file_name

stringPSRAM tiny_dlna::TreeNode::file_name

◆ id

uint32_t tiny_dlna::TreeNode::id = 0

◆ is_dir

bool tiny_dlna::TreeNode::is_dir = false

◆ is_expanded

bool tiny_dlna::TreeNode::is_expanded = false

◆ parent

TreeNode* tiny_dlna::TreeNode::parent = nullptr

◆ size

uint32_t tiny_dlna::TreeNode::size = 0

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