docs: update resources API docs
This commit is contained in:
42
docs/api/resources/resource-package/close.md
Normal file
42
docs/api/resources/resource-package/close.md
Normal file
@@ -0,0 +1,42 @@
|
||||
# Close
|
||||
|
||||
关闭资源包并释放相关资源。
|
||||
|
||||
## 方法签名
|
||||
|
||||
```cpp
|
||||
void Close();
|
||||
```
|
||||
|
||||
## 详细描述
|
||||
|
||||
关闭当前打开的资源包,重置所有内部状态并释放相关资源。调用此方法后,包将变为无效状态,任何尝试读取文件的行为都将失败。
|
||||
|
||||
此方法在析构函数中会被自动调用,确保资源正确释放。
|
||||
|
||||
## 参数
|
||||
|
||||
无
|
||||
|
||||
## 返回值
|
||||
|
||||
无
|
||||
|
||||
## 示例
|
||||
|
||||
```cpp
|
||||
ResourcePackage package;
|
||||
if (package.Open("assets/resources.xcp")) {
|
||||
// 使用包...
|
||||
|
||||
// 显式关闭
|
||||
package.Close();
|
||||
}
|
||||
|
||||
// 或者当 package 超出作用域时会自动关闭
|
||||
```
|
||||
|
||||
## 相关方法
|
||||
|
||||
- [Open](open.md) - 打开资源包
|
||||
- [IsValid](isvalid.md) - 检查包有效性
|
||||
Reference in New Issue
Block a user