属性字符串序列化和反序列化CAPI

Signed-off-by: zyx0121 <zhangyingxiang2@huawei.com>
This commit is contained in:
zyx0121 2024-10-16 09:22:03 +08:00
parent a1545586b2
commit b7a702d01f
2 changed files with 38 additions and 0 deletions

View File

@ -2374,5 +2374,13 @@
{
"first_introduced": "14",
"name": "OH_ArkUI_ConvertToHtml"
},
{
"first_introduced": "14",
"name": "OH_ArkUI_MarshallStyledStringDescriptor"
},
{
"first_introduced": "14",
"name": "OH_ArkUI_UnmarshallStyledStringDescriptor"
}
]

View File

@ -144,6 +144,36 @@ void OH_ArkUI_StyledString_Descriptor_Destroy(ArkUI_StyledString_Descriptor* str
*/
const char* OH_ArkUI_ConvertToHtml(ArkUI_StyledString_Descriptor* str);
/**
* @brief Deserializes a byte array containing styled string information into a styled string.
*
* @param buffer Byte array to be deserialized.
* @param bufferSize Length of the byte array.
* @param descriptor Pointer to an <b>ArkUI_StyledString_Descriptor</b> object.
* @return Returns the result code.
* Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
* @since 14
*/
int32_t OH_ArkUI_UnmarshallStyledStringDescriptor(
uint8_t* buffer, size_t bufferSize, ArkUI_StyledString_Descriptor* descriptor);
/**
* @brief Serializes the styled string information into a byte array.
*
* @param buffer Byte array where the serialized data will be stored.
* @param bufferSize Length of the byte array.
* @param descriptor Pointer to an <b>ArkUI_StyledString_Descriptor</b> object.
* @param resultSize Actual length of the byte array.
* @return Returns the result code.
* Returns {@link ARKUI_ERROR_CODE_NO_ERROR} if the operation is successful.
* Returns {@link ARKUI_ERROR_CODE_PARAM_INVALID} if a parameter error occurs.
* Returns {@link ARKUI_ERROR_CODE_INVALID_STYLED_STRING} if the styled string is invalid.
* @since 14
*/
int32_t OH_ArkUI_MarshallStyledStringDescriptor(
uint8_t* buffer, size_t bufferSize, ArkUI_StyledString_Descriptor* descriptor, size_t* resultSize);
#ifdef __cplusplus
};
#endif