RamFS 的目录节点片段 / Directory-node fragment of RamFS
More...
#include <dir.hpp>
|
| void | Add (File &file) |
| | 添加直属文件节点 / Add a direct child file node
|
| |
| void | Add (Dir &dir) |
| | 添加直属目录节点 / Add a direct child directory node
|
| |
| void | Add (Custom &custom) |
| | 添加直属自定义节点 / Add a direct child custom node
|
| |
| FsNode * | FindNode (const char *name) |
| | 查找直属子节点 / Find a direct child node
|
| |
| File * | FindFile (const char *name) |
| | 查找直属文件 / Find a direct child file
|
| |
| File * | FindFileRev (const char *name) |
| | 递归查找文件 / Find a file recursively
|
| |
| Dir * | FindDir (const char *name) |
| | 查找直属目录,支持 "." 和 ".." / Find a direct child directory, supporting "." and ".."
|
| |
| Dir * | FindDirRev (const char *name) |
| | 递归查找目录,支持 "." 和 ".." / Find a directory recursively, supporting "." and ".."
|
| |
| Custom * | FindCustom (const char *name) |
| | 查找直属自定义节点 / Find a direct child custom node
|
| |
| Custom * | FindCustomRev (const char *name) |
| | 递归查找自定义节点 / Find a custom node recursively
|
| |
| template<typename Func > |
| ErrorCode | Foreach (Func func) |
| | 遍历直属子节点 / Iterate over direct child nodes
|
| |
| FsNodeType | GetNodeType () const |
| | 获取节点类型 / Get the node type
|
| |
| const char * | GetName () const |
| | 获取节点名称 / Get the node name
|
| |
|
|
| Dir () |
| | 构造一个空目录壳 / Construct one empty directory shell
|
| |
| | Dir (const char *name) |
| | 构造一个具名目录壳 / Construct one named directory shell
|
| |
| void | AddNode (FsNode &node) |
| | 把一个节点挂到当前目录下 / Attach one node under the current directory
|
| |
| FsNode * | FindNodeByType (const char *name, FsNodeType type) |
| | 在当前目录按类型查找直属节点 / Find one direct child node of a given type
|
| |
| FsNode * | FindNodeRevByType (const char *name, FsNodeType type) |
| | 递归查找指定类型节点 / Find one node of a given type recursively
|
| |
|
| Tree | rbt_ |
| | 当前目录直属子节点的名称索引树 / Name index tree of direct child nodes.
|
| |
|
| | FsNode (FsNodeType node_type) |
| | 用指定节点类型构造基类部分 / Construct the base node with a given node type
|
| |
| | FsNode (const FsNode &other) |
| | 拷贝构造节点基类部分 / Copy-construct the base-node portion
|
| |
|
FsNode & | operator= (const FsNode &)=delete |
| |
| const char * | name_ = nullptr |
| | 节点名称缓冲区 / Retained node-name buffer.
|
| |
| FsNodeType | type_ |
| | 节点运行时类型 / Runtime node type.
|
| |
| Dir * | parent_ = nullptr |
| | 父目录;根目录保持为空 / Parent directory; stays null for the root.
|
| |
| Tree::Node< FsNode * > | tree_node_ |
| | 当前节点挂进目录树时使用的树节点包装 / Tree node wrapper used when inserted into a directory tree.
|
| |
RamFS 的目录节点片段 / Directory-node fragment of RamFS
目录节点,管理直属子节点 / Directory node that owns a child namespace
Definition at line 8 of file dir.hpp.
◆ Dir()
| Dir::Dir |
( |
const char * | name | ) |
|
|
explicitprivate |
构造一个具名目录壳 / Construct one named directory shell
- Parameters
-
| name | 目录名称 / Directory name |
◆ Add() [1/3]
| void Dir::Add |
( |
Custom & | custom | ) |
|
|
inline |
添加直属自定义节点 / Add a direct child custom node
- Parameters
-
Definition at line 27 of file dir.hpp.
void AddNode(FsNode &node)
把一个节点挂到当前目录下 / Attach one node under the current directory
◆ Add() [2/3]
| void Dir::Add |
( |
Dir & | dir | ) |
|
|
inline |
添加直属目录节点 / Add a direct child directory node
- Parameters
-
Definition at line 21 of file dir.hpp.
◆ Add() [3/3]
| void Dir::Add |
( |
File & | file | ) |
|
|
inline |
添加直属文件节点 / Add a direct child file node
- Parameters
-
Definition at line 15 of file dir.hpp.
◆ AddNode()
| void Dir::AddNode |
( |
FsNode & | node | ) |
|
|
private |
把一个节点挂到当前目录下 / Attach one node under the current directory
- Parameters
-
| node | 待挂接节点 / Node to attach |
◆ FindCustom()
| Custom * Dir::FindCustom |
( |
const char * | name | ) |
|
查找直属自定义节点 / Find a direct child custom node
- Parameters
-
- Returns
- 自定义节点指针;未找到返回 nullptr / Custom node pointer, or nullptr
◆ FindCustomRev()
| Custom * Dir::FindCustomRev |
( |
const char * | name | ) |
|
递归查找自定义节点 / Find a custom node recursively
- Parameters
-
- Returns
- 自定义节点指针;未找到返回 nullptr / Custom node pointer, or nullptr
◆ FindDir()
| Dir * Dir::FindDir |
( |
const char * | name | ) |
|
查找直属目录,支持 "." 和 ".." / Find a direct child directory, supporting "." and ".."
- Parameters
-
- Returns
- 目录指针;未找到返回 nullptr / Directory pointer, or nullptr
◆ FindDirRev()
| Dir * Dir::FindDirRev |
( |
const char * | name | ) |
|
递归查找目录,支持 "." 和 ".." / Find a directory recursively, supporting "." and ".."
- Parameters
-
- Returns
- 目录指针;未找到返回 nullptr / Directory pointer, or nullptr
◆ FindFile()
| File * Dir::FindFile |
( |
const char * | name | ) |
|
查找直属文件 / Find a direct child file
- Parameters
-
- Returns
- 文件指针;未找到返回 nullptr / File pointer, or nullptr
◆ FindFileRev()
| File * Dir::FindFileRev |
( |
const char * | name | ) |
|
递归查找文件 / Find a file recursively
- Parameters
-
- Returns
- 文件指针;未找到返回 nullptr / File pointer, or nullptr
◆ FindNode()
| FsNode * Dir::FindNode |
( |
const char * | name | ) |
|
查找直属子节点 / Find a direct child node
- Parameters
-
- Returns
- 子节点指针;未找到返回 nullptr / Child node pointer, or nullptr
◆ FindNodeByType()
| FsNode * Dir::FindNodeByType |
( |
const char * | name, |
|
|
FsNodeType | type ) |
|
private |
在当前目录按类型查找直属节点 / Find one direct child node of a given type
- Parameters
-
| name | 节点名称 / Node name |
| type | 目标节点类型 / Desired node type |
- Returns
- 找到的节点;未找到返回 nullptr / Matching node, or nullptr
◆ FindNodeRevByType()
| FsNode * Dir::FindNodeRevByType |
( |
const char * | name, |
|
|
FsNodeType | type ) |
|
private |
递归查找指定类型节点 / Find one node of a given type recursively
- Parameters
-
| name | 节点名称 / Node name |
| type | 目标节点类型 / Desired node type |
- Returns
- 找到的节点;未找到返回 nullptr / Matching node, or nullptr
◆ Foreach()
template<typename Func >
| ErrorCode Dir::Foreach |
( |
Func | func | ) |
|
|
inline |
遍历直属子节点 / Iterate over direct child nodes
- Template Parameters
-
- Parameters
-
| func | 回调函数,返回非 OK 时停止遍历 / Callback; non-OK stops iteration |
- Returns
- 遍历结果 / Iteration result
Definition at line 87 of file dir.hpp.
88 {
89 return rbt_.Foreach<
FsNode*>([&](Tree::Node<FsNode*>& node)
90 { return func(*node.data_); });
91 }
Tree rbt_
当前目录直属子节点的名称索引树 / Name index tree of direct child nodes.
RamFS 的公共节点基类片段 / Common node-base fragment of RamFS
◆ RamFS
◆ rbt_
当前目录直属子节点的名称索引树 / Name index tree of direct child nodes.
Definition at line 127 of file dir.hpp.
The documentation for this class was generated from the following file: