docs(scripting): add baseline api reference and guide
This commit is contained in:
39
docs/api/XCEngine/Scripting/ScriptComponent/Serialize.md
Normal file
39
docs/api/XCEngine/Scripting/ScriptComponent/Serialize.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# ScriptComponent::Serialize
|
||||
|
||||
**命名空间**: `XCEngine::Scripting`
|
||||
|
||||
**类型**: `method`
|
||||
|
||||
**头文件**: `XCEngine/Scripting/ScriptComponent.h`
|
||||
|
||||
## 签名
|
||||
|
||||
```cpp
|
||||
void Serialize(std::ostream& os) const override;
|
||||
```
|
||||
|
||||
## 作用
|
||||
|
||||
把脚本组件的原生数据状态写到文本流。
|
||||
|
||||
## 当前实现行为
|
||||
|
||||
当前会按键值对形式写出:
|
||||
|
||||
- `scriptComponentUUID`
|
||||
- `assembly`
|
||||
- `namespace`
|
||||
- `class`
|
||||
- `fields`
|
||||
|
||||
字符串内容会经过 `EscapeScriptString()` 转义,字段存储则通过 `ScriptFieldStorage::SerializeToString()` 序列化后再整体转义。
|
||||
|
||||
## 注意事项
|
||||
|
||||
- 这是引擎私有格式,不承诺对外通用。
|
||||
- `fields` 本身是嵌套序列化文本,因此二次转义是必须的。
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [Deserialize](Deserialize.md)
|
||||
- [ScriptField::EscapeScriptString](../ScriptField/EscapeScriptString.md)
|
||||
Reference in New Issue
Block a user