文件节点片段 / File-node fragment
More...
#include <ramfs.hpp>
|
| bool | IsReadOnly () const |
| | 判断文件是否只读 / Check whether the file is read-only
|
| |
| bool | IsReadWrite () const |
| | 判断文件是否可写 / Check whether the file is writable
|
| |
| bool | IsExecutable () const |
| | 判断文件是否可执行 / Check whether the file is executable
|
| |
| int | Run (int argc, char **argv) |
| | 执行可执行文件 / Run an executable file
|
| |
| template<typename DataType , SizeLimitMode LimitMode = SizeLimitMode::MORE> |
| decltype(auto) | Data () |
| | 访问类型化数据 / Access typed data
|
| |
| template<typename DataType , SizeLimitMode LimitMode = SizeLimitMode::MORE> |
| decltype(auto) | Data () const |
| | 从 const 文件对象访问类型化只读数据 / Access typed read-only data from a const file object
|
| |
| RawData | Data () |
| | 访问可写原始数据,要求文件为 READ_WRITE / Access writable raw data; requires READ_WRITE
|
| |
| ConstRawData | Data () const |
| | 访问只读原始数据 / Access read-only raw data
|
| |
| FsNodeType | GetNodeType () const |
| | 获取节点类型 / Get the node type
|
| |
| const char * | GetName () const |
| | 获取节点名称 / Get the node name
|
| |
|
| | 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_ |
| | 父目录;根目录保持为空 / Parent directory; stays null for the root.
|
| |
| Tree::Node< FsNode * > | tree_node_ |
| |
文件节点片段 / File-node fragment
RamFS 的文件节点片段 / File-node fragment of RamFS
内存文件或可执行文件 / Memory file or executable file
Definition at line 9 of file ramfs.hpp.
◆ Data() [1/4]
template<typename DataType ,
SizeLimitMode LimitMode = SizeLimitMode::MORE>
| decltype(auto) LibXR::RamFS::File::Data |
( |
| ) |
|
|
inline |
访问类型化数据 / Access typed data
Data<T>() 返回可写引用并要求 READ_WRITE / Data<T>() returns a writable reference and requires READ_WRITE. Data<const T>() 返回只读引用 / Data<const T>() returns a read-only reference for both READ_ONLY and READ_WRITE.
- Template Parameters
-
| DataType | 数据类型;使用 const T 表示只读访问 / Data type; use const T for read-only access. |
| LimitMode | 大小检查模式 / Size-check mode |
- Returns
- 类型化数据引用 / Typed data reference
Definition at line 52 of file ramfs.hpp.
55 : uint8_t
56 {
57 READ_ONLY,
58 READ_WRITE,
59 EXEC,
60 };
61
◆ Data() [2/4]
| RawData LibXR::RamFS::File::Data |
( |
| ) |
|
|
inlinenodiscard |
访问可写原始数据,要求文件为 READ_WRITE / Access writable raw data; requires READ_WRITE
- Returns
- 可写原始数据视图 / Writable raw data view
Definition at line 95 of file ramfs.hpp.
◆ Data() [3/4]
template<typename DataType ,
SizeLimitMode LimitMode = SizeLimitMode::MORE>
| decltype(auto) LibXR::RamFS::File::Data |
( |
| ) |
const |
|
inline |
从 const 文件对象访问类型化只读数据 / Access typed read-only data from a const file object
- Template Parameters
-
| DataType | 数据类型 / Data type |
| LimitMode | 大小检查模式 / Size-check mode |
- Returns
- 类型化只读数据引用 / Typed read-only data reference
Definition at line 79 of file ramfs.hpp.
◆ Data() [4/4]
访问只读原始数据 / Access read-only raw data
- Returns
- 只读原始数据视图 / Read-only raw data view
Definition at line 101 of file ramfs.hpp.
◆ IsExecutable()
| bool LibXR::RamFS::File::IsExecutable |
( |
| ) |
const |
|
inlinenodiscard |
判断文件是否可执行 / Check whether the file is executable
- Returns
- 可执行返回 true / True if the file is executable
Definition at line 28 of file ramfs.hpp.
◆ IsReadOnly()
| bool LibXR::RamFS::File::IsReadOnly |
( |
| ) |
const |
|
inlinenodiscard |
判断文件是否只读 / Check whether the file is read-only
- Returns
- 只读返回 true / True if the file is read-only
Definition at line 16 of file ramfs.hpp.
◆ IsReadWrite()
| bool LibXR::RamFS::File::IsReadWrite |
( |
| ) |
const |
|
inlinenodiscard |
判断文件是否可写 / Check whether the file is writable
- Returns
- 可写返回 true / True if the file is writable
Definition at line 22 of file ramfs.hpp.
◆ Run()
| int RamFS::File::Run |
( |
int | argc, |
|
|
char ** | argv ) |
执行可执行文件 / Run an executable file
执行可执行文件节点 Run one executable file node
- Parameters
-
| argc | 参数数量 / Argument count |
| argv | 参数数组 / Argument vector |
- Returns
- 执行返回值 / Execution return value
Definition at line 74 of file ramfs.cpp.
75{
76 ASSERT(file_type_ == FileType::EXEC);
77 ASSERT(
exec_ !=
nullptr);
78 return exec_(arg_, argc, argv);
79}
ExecFun exec_
可执行入口函数 / Executable entry function.
◆ RamFS
◆ addr_
| void* LibXR::RamFS::File::addr_ |
可写数据地址 / Writable payload address.
Definition at line 184 of file ramfs.hpp.
◆ addr_const_
| const void* LibXR::RamFS::File::addr_const_ |
只读数据地址 / Read-only payload address.
Definition at line 185 of file ramfs.hpp.
◆ exec_
| ExecFun LibXR::RamFS::File::exec_ |
可执行入口函数 / Executable entry function.
Definition at line 186 of file ramfs.hpp.
The documentation for this class was generated from the following files: