fix: improve doc link navigation and tree display

- Fix link resolution with proper relative/absolute path handling
- Improve link styling with underline decoration
- Hide leaf nodes from tree, only show directories
- Fix log file path for packaged app
This commit is contained in:
2026-03-19 12:44:08 +08:00
parent e003fe6513
commit 58a83f445a
1012 changed files with 56880 additions and 22 deletions

View File

@@ -0,0 +1,34 @@
# IResource::Initialize
```cpp
void Initialize(const ConstructParams& params)
```
使用构造参数初始化资源。将参数中的名称、路径、GUID 和内存大小写入对应成员变量,并将资源标记为有效状态。
**参数:**
- `params` - 包含资源名称、路径、GUID 和内存大小的构造参数结构体
**返回:**
**复杂度:** O(1)
**示例:**
```cpp
class MyResource : public IResource {
public:
MyResource() {
ConstructParams params;
params.name = "player_texture";
params.path = "textures/player.png";
params.guid = ResourceGUID::Generate(params.path);
params.memorySize = 1024 * 1024; // 1MB
Initialize(params);
}
};
```
## 相关文档
- [IResource 总览](iresource.md) - 返回类总览

View File

@@ -0,0 +1,57 @@
# IResource
**命名空间**: `XCEngine::Resources`
**类型**: `class` (abstract)
**描述**: 资源基类接口所有具体资源类型Texture、Mesh、Material 等)都必须继承自此类。
## 概述
`IResource` 是 XCEngine 资源管理系统的核心抽象基类。它定义了所有资源共有的基本属性和行为包括资源类型、名称、路径、GUID、内存大小和有效性状态。
## 公共方法
| 方法 | 描述 |
|------|------|
| `ResourceType GetType() const` | 获取资源类型 |
| `const Containers::String& GetName() const` | 获取资源名称 |
| `const Containers::String& GetPath() const` | 获取资源路径 |
| `ResourceGUID GetGUID() const` | 获取全局唯一标识符 |
| `bool IsValid() const` | 检查资源是否有效 |
| `size_t GetMemorySize() const` | 获取资源占用的内存大小(字节) |
| `void Release()` | 释放资源引用 |
| `void Initialize(const ConstructParams& params)` | 使用构造参数初始化资源 |
| `void SetInvalid()` | 将资源标记为无效 |
### 构造参数
| 成员 | 类型 | 描述 |
|------|------|------|
| `m_name` | `Containers::String` | 资源名称 |
| `m_path` | `Containers::String` | 资源路径 |
| `m_guid` | `ResourceGUID` | 全局唯一标识符 |
| `m_isValid` | `bool` | 资源是否有效 |
| `m_memorySize` | `size_t` | 内存占用大小 |
## 使用示例
```cpp
class MyResource : public IResource {
public:
ResourceType GetType() const override { return ResourceType::Custom; }
const Containers::String& GetName() const override { return m_name; }
const Containers::String& GetPath() const override { return m_path; }
ResourceGUID GetGUID() const override { return m_guid; }
bool IsValid() const override { return m_isValid; }
size_t GetMemorySize() const override { return m_memorySize; }
void Release() override { /* 释放逻辑 */ }
};
```
## 相关文档
- [ResourceHandle](../resourcehandle/resourcehandle.md) - 资源句柄
- [ResourceManager](../resourcemanager/resourcemanager.md) - 资源管理器
- [ResourceTypes](../resourcetypes/resourcetypes.md) - 资源类型定义
- [Resources 总览](../resources.md) - 返回模块总览

View File

@@ -0,0 +1,33 @@
# IResource::Release
```cpp
virtual void Release() = 0
```
释放资源引用。纯虚方法,由具体资源类实现,用于执行资源特有的清理逻辑(如释放 GPU 资源、释放内存等)。在 `ResourceHandle` 析构或调用 `Reset()` 时会自动触发。
**参数:**
**返回:**
**复杂度:** O(1) 或 O(n),取决于具体实现
**示例:**
```cpp
class Texture : public IResource {
public:
void Release() override {
if (m_rhiTexture) {
m_rhiTexture->Release();
m_rhiTexture = nullptr;
}
m_pixelData.Clear();
m_isValid = false;
}
};
```
## 相关文档
- [IResource 总览](iresource.md) - 返回类总览

View File

@@ -0,0 +1,28 @@
# IResource::SetInvalid
```cpp
void SetInvalid()
```
将资源标记为无效状态。此方法用于在加载失败或资源损坏时将 `m_isValid` 设为 false之后调用 `IsValid()` 将返回 false。
**参数:**
**返回:**
**复杂度:** O(1)
**示例:**
```cpp
void LoadFailed() {
texture->SetInvalid();
if (!texture->IsValid()) {
// 处理资源无效情况
}
}
```
## 相关文档
- [IResource 总览](iresource.md) - 返回类总览