docs: update resources API docs
This commit is contained in:
53
docs/api/resources/resource-package/isvalid.md
Normal file
53
docs/api/resources/resource-package/isvalid.md
Normal file
@@ -0,0 +1,53 @@
|
||||
# IsValid
|
||||
|
||||
检查资源包当前是否有效。
|
||||
|
||||
## 方法签名
|
||||
|
||||
```cpp
|
||||
bool IsValid() const;
|
||||
```
|
||||
|
||||
## 详细描述
|
||||
|
||||
返回一个布尔值,表示资源包当前是否处于有效状态。当包成功打开且未被关闭时返回 `true`。
|
||||
|
||||
## 参数
|
||||
|
||||
无
|
||||
|
||||
## 返回值
|
||||
|
||||
| 类型 | 描述 |
|
||||
|------|------|
|
||||
| `bool` | 包有效返回 `true`,无效返回 `false` |
|
||||
|
||||
## 示例
|
||||
|
||||
```cpp
|
||||
ResourcePackage package;
|
||||
|
||||
// 打开前
|
||||
if (!package.IsValid()) {
|
||||
printf("Package is not valid yet\n");
|
||||
}
|
||||
|
||||
package.Open("assets/resources.xcp");
|
||||
|
||||
// 打开后
|
||||
if (package.IsValid()) {
|
||||
printf("Package is valid and ready to use\n");
|
||||
}
|
||||
|
||||
package.Close();
|
||||
|
||||
// 关闭后
|
||||
if (!package.IsValid()) {
|
||||
printf("Package has been closed\n");
|
||||
}
|
||||
```
|
||||
|
||||
## 相关方法
|
||||
|
||||
- [Open](open.md) - 打开资源包
|
||||
- [Close](close.md) - 关闭资源包
|
||||
Reference in New Issue
Block a user