docs: 重构 API 文档结构并修正源码准确性
- 重组文档目录结构: 每个模块的概述页移动到模块子目录 - 重命名 index.md 为 main.md - 修正所有模块文档中的错误: - math: FromEuler→FromEulerAngles, TransformDirection 包含缩放, Box 是 OBB, Color::ToRGBA 格式 - containers: 新增 operator==/!= 文档, 补充 std::hash DJB 算法细节 - core: 修复 types 链接错误 - debug: LogLevelToString 返回大写, timestamp 是秒, Profiler 空实现标注, Windows API vs ANSI - memory: 修复头文件路径, malloc vs operator new, 新增方法文档 - resources: 修复 Shader/Texture 链接错误 - threading: TaskSystem::Wait 空实现标注, ReadWriteLock 重入描述, LambdaTask 链接 - 验证: fix_links.py 确认 0 个断裂引用
This commit is contained in:
94
docs/api/containers/array/array.md
Normal file
94
docs/api/containers/array/array.md
Normal file
@@ -0,0 +1,94 @@
|
||||
# Array
|
||||
|
||||
**命名空间**: `XCEngine::Containers`
|
||||
|
||||
**类型**: `class` (template)
|
||||
|
||||
**描述**: 模板动态数组容器,提供自动扩容的数组实现。
|
||||
|
||||
## 概述
|
||||
|
||||
`Array<T>` 是一个模板动态数组容器,提供了类似 `std::vector` 的功能,但针对游戏引擎进行了优化。
|
||||
|
||||
## 类型别名
|
||||
|
||||
| 别名 | 类型 | 描述 |
|
||||
|------|------|------|
|
||||
| `Iterator` | `T*` | 迭代器类型 |
|
||||
| `ConstIterator` | `const T*` | 常量迭代器类型 |
|
||||
|
||||
## 公共方法
|
||||
|
||||
### 构造/析构
|
||||
|
||||
| 方法 | 描述 |
|
||||
|------|------|
|
||||
| [Constructor](constructor.md) | 构造数组实例 |
|
||||
| [Copy/Move Constructor](copy-move-constructor.md) | 拷贝或移动构造 |
|
||||
| [Destructor](destructor.md) | 析构函数 |
|
||||
| [operator=](operator-assign.md) | 赋值运算符 |
|
||||
|
||||
### 元素访问
|
||||
|
||||
| 方法 | 描述 |
|
||||
|------|------|
|
||||
| [operator[]](./operator-subscript.md) | 下标访问 |
|
||||
| [Data](data.md) | 获取原始数据指针 |
|
||||
| [Front/Back](front-back.md) | 获取首/尾元素引用 |
|
||||
|
||||
### 容量管理
|
||||
|
||||
| 方法 | 描述 |
|
||||
|------|------|
|
||||
| [Size/Capacity/Empty](size.md) | 获取尺寸信息 |
|
||||
| [Clear](clear.md) | 清空所有元素 |
|
||||
| [Reserve](reserve.md) | 预留容量 |
|
||||
| [Resize](resize.md) | 调整大小 |
|
||||
|
||||
### 元素操作
|
||||
|
||||
| 方法 | 描述 |
|
||||
|------|------|
|
||||
| [PushBack](pushback.md) | 尾部添加(拷贝/移动) |
|
||||
| [EmplaceBack](emplaceback.md) | 就地构造尾部添加 |
|
||||
| [PopBack](popback.md) | 尾部移除 |
|
||||
|
||||
### 迭代器
|
||||
|
||||
| 方法 | 描述 |
|
||||
|------|------|
|
||||
| [begin/end](iterator.md) | 获取迭代器 |
|
||||
|
||||
### 内存分配器
|
||||
|
||||
| 方法 | 描述 |
|
||||
|------|------|
|
||||
| [SetAllocator](setallocator.md) | 设置内存分配器 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Containers/Array.h>
|
||||
|
||||
// 基本用法
|
||||
Containers::Array<int> arr;
|
||||
arr.PushBack(1);
|
||||
arr.PushBack(2);
|
||||
arr.PushBack(3);
|
||||
|
||||
// 使用 initializer_list
|
||||
Containers::Array<int> arr2 = {1, 2, 3, 4, 5};
|
||||
|
||||
// 迭代
|
||||
for (auto& elem : arr) {
|
||||
printf("%d\n", elem);
|
||||
}
|
||||
|
||||
// 使用 EmplaceBack
|
||||
arr.EmplaceBack(4);
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [HashMap](../hashmap/hashmap.md) - 哈希表容器
|
||||
- [Memory 模块](../../memory/memory.md) - 内存分配器
|
||||
Reference in New Issue
Block a user