35 int Run(
int argc,
char** argv);
50 template <
typename DataType, SizeLimitMode LimitMode = SizeLimitMode::MORE>
53 using RequestedType = std::remove_reference_t<DataType>;
54 using StoredType = std::remove_cv_t<RequestedType>;
55 static_assert(!std::is_reference_v<DataType>);
56 static_assert(!std::is_volatile_v<RequestedType>);
59 if constexpr (std::is_const_v<RequestedType>)
77 template <
typename DataType, SizeLimitMode LimitMode = SizeLimitMode::MORE>
78 decltype(
auto)
Data()
const
80 using RequestedType = std::remove_reference_t<DataType>;
81 using StoredType = std::remove_cv_t<RequestedType>;
82 static_assert(!std::is_reference_v<DataType>);
83 static_assert(!std::is_volatile_v<RequestedType>);
94 [[nodiscard]] RawData
Data()
103 [[nodiscard]] ConstRawData
Data()
const
112 using ExecFun = int (*)(
void* raw,
int argc,
char** argv);
136 template <
typename DataType>
141 return static_cast<const DataType*
>(
addr_);
156 template <
typename DataType>
163 return static_cast<DataType*
>(
addr_);
175 explicit File(
const char* name);
RamFS 的文件节点片段 / File-node fragment of RamFS
const void * addr_const_
只读数据地址 / Read-only payload address.
int Run(int argc, char **argv)
执行可执行文件 / Run an executable file
int(*)(void *raw, int argc, char **argv) ExecFun
可执行文件调用入口类型 / Executable entry function type
void * arg_
可执行文件上下文块 / Executable context block.
FileType file_type_
当前文件存储形态 / Current file storage kind.
void * addr_
可写数据地址 / Writable payload address.
bool IsExecutable() const
判断文件是否可执行 / Check whether the file is executable
static void DataAccessPanic()
处理不应到达的 File 数据访问路径 Handle one File data-access path that should be unreachable
bool IsReadWrite() const
判断文件是否可写 / Check whether the file is writable
decltype(auto) Data()
访问类型化数据 / Access typed data
ConstRawData Data() const
访问只读原始数据 / Access read-only raw data
DataType * WritableDataPtr()
获取可写数据地址 Get the writable data pointer
ExecFun exec_
可执行入口函数 / Executable entry function.
File(const char *name)
构造一个具名文件壳 / Construct one named file shell
bool IsReadOnly() const
判断文件是否只读 / Check whether the file is read-only
const DataType * ReadableDataPtr() const
获取只读数据地址 Get the readable data pointer
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
size_t size_
数据负载字节数 / Payload size in bytes.
File()
构造一个空文件壳 / Construct one empty file shell
RamFS 的公共节点基类片段 / Common node-base fragment of RamFS
constexpr bool SizeLimitCheck(SizeLimitMode mode, size_t limit, size_t size) noexcept
尺寸约束的纯判断函数