|
libxr
1.0
Want to be the best embedded framework
|
RamFS 的文件节点片段 / File-node fragment of RamFS
More...
#include <file.hpp>
Public Member Functions | |
| 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 | |
Public Member Functions inherited from FsNode | |
| FsNodeType | GetNodeType () const |
| 获取节点类型 / Get the node type | |
| const char * | GetName () const |
| 获取节点名称 / Get the node name | |
Private Types | |
| using | ExecFun = int (*)(void* raw, int argc, char** argv) |
| 可执行文件调用入口类型 / Executable entry function type | |
Private Member Functions | |
| template<typename DataType > | |
| const DataType * | ReadableDataPtr () const |
| 获取只读数据地址 Get the readable data pointer | |
| template<typename DataType > | |
| DataType * | WritableDataPtr () |
| 获取可写数据地址 Get the writable data pointer | |
| File () | |
| 构造一个空文件壳 / Construct one empty file shell | |
| File (const char *name) | |
| 构造一个具名文件壳 / Construct one named file shell | |
Static Private Member Functions | |
| static void | DataAccessPanic () |
| 处理不应到达的 File 数据访问路径 Handle one File data-access path that should be unreachable | |
Private Attributes | ||
| union { | ||
| void * addr_ | ||
| 可写数据地址 / Writable payload address. More... | ||
| const void * addr_const_ | ||
| 只读数据地址 / Read-only payload address. More... | ||
| ExecFun exec_ | ||
| 可执行入口函数 / Executable entry function. More... | ||
| }; | ||
| 文件负载联合体 / File payload union | ||
| void * | arg_ = nullptr | |
| 可执行文件上下文块 / Executable context block. | ||
| size_t | size_ = 0 | |
| 数据负载字节数 / Payload size in bytes. | ||
| FileType | file_type_ = FileType::READ_ONLY | |
| 当前文件存储形态 / Current file storage kind. | ||
Friends | |
| class | RamFS |
Additional Inherited Members | |
Protected Member Functions inherited from FsNode | |
| 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 |
Protected Attributes inherited from FsNode | |
| 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 的文件节点片段 / File-node fragment of RamFS
内存文件或可执行文件 / Memory file or executable file
|
private |
|
explicitprivate |
构造一个具名文件壳 / Construct one named file shell
| name | 文件名 / File name |
|
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.
| DataType | 数据类型;使用 const T 表示只读访问 / Data type; use const T for read-only access. |
| LimitMode | 大小检查模式 / Size-check mode |
Definition at line 51 of file file.hpp.
|
inlinenodiscard |
访问可写原始数据,要求文件为 READ_WRITE / Access writable raw data; requires READ_WRITE
|
inline |
从 const 文件对象访问类型化只读数据 / Access typed read-only data from a const file object
| DataType | 数据类型 / Data type |
| LimitMode | 大小检查模式 / Size-check mode |
Definition at line 78 of file file.hpp.
|
inlinenodiscard |
访问只读原始数据 / Access read-only raw data
|
inlinestaticprivate |
处理不应到达的 File 数据访问路径 Handle one File data-access path that should be unreachable
Definition at line 124 of file file.hpp.
|
inlinenodiscard |
|
inlinenodiscard |
|
inlinenodiscard |
|
inlineprivate |
获取只读数据地址 Get the readable data pointer
| DataType | 目标数据类型 / Target data type |
Definition at line 137 of file file.hpp.
| int File::Run | ( | int | argc, |
| char ** | argv ) |
执行可执行文件 / Run an executable file
| argc | 参数数量 / Argument count |
| argv | 参数数组 / Argument vector |
|
inlineprivate |
获取可写数据地址 Get the writable data pointer
| DataType | 目标数据类型 / Target data type |
| union { ... } File |
文件负载联合体 / File payload union
The same storage is interpreted either as mutable data, const data, or an executable entry depending on file_type_. 这块存储会根据 file_type_ 被解释成可写数据、只读数据或可执行入口。
| const void* File::addr_const_ |
|
private |
|
private |
|
private |