1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 /** 17 * @addtogroup ArkUI_NativeModule 18 * @{ 19 * 20 * @brief 提供ArkUI在Native侧的UI能力,如UI组件创建销毁、树节点操作,属性设置,事件监听等。 21 * 22 * @since 12 23 */ 24 25 /** 26 * @file native_styled_string_descriptor.h 27 * 28 * @brief 提供ArkUI在Native侧的属性字符串数据存储及转换的能力。 29 * 30 * @library libace_ndk.z.so 31 * @syscap SystemCapability.ArkUI.ArkUI.Full 32 * @since 14 33 */ 34 35 #ifndef ARKUI_NATIVE_STYLED_STRING_DESCRIPTOR_H 36 #define ARKUI_NATIVE_STYLED_STRING_DESCRIPTOR_H 37 38 // should be careful this path is not same in SDK. 39 #include "native_type.h" 40 41 #include "core/interfaces/arkoala/arkoala_api.h" 42 43 #ifdef __cplusplus 44 extern "C" { 45 #endif 46 47 /** 48 * @brief Create a ArkUI_StyledString_Descriptor object. 49 * 50 * @return Pointer to the ArkUI_StyledString_Descriptor object.。 51 * @since 14 52 */ 53 ArkUI_StyledString_Descriptor* OH_ArkUI_StyledString_Descriptor_Create(); 54 55 /** 56 * @brief Release the memory occupied by the ArkUI_StyledString_Descriptor object. 57 * 58 * @param descriptor Pointer to the ArkUI_StyledString_Descriptor object. 59 * @since 14 60 */ 61 void OH_ArkUI_StyledString_Descriptor_Destroy(ArkUI_StyledString_Descriptor* descriptor); 62 63 /** 64 * @brief Unmarshall the byte array that stores styled string information into a styled string. 65 * 66 * @param buffer The byte array that stores the unmarshalled information of the styled string. 67 * @param bufferSize Indicate the length of the byte array. 68 * @param descriptor Pointer to the ArkUI_StyledString_Descriptor object. 69 * @return Error code.。 70 * {@link ARKUI_ERROR_CODE_NO_ERROR} Success. 71 * {@link ARKUI_ERROR_CODE_PARAM_INVALID} Function parameter exception. 72 * @since 14 73 */ 74 int32_t OH_ArkUI_UnmarshallStyledStringDescriptor( 75 uint8_t* buffer, size_t bufferSize, ArkUI_StyledString_Descriptor* descriptor); 76 77 /** 78 * @brief Marshall the styled string into a byte array。 79 * 80 * @param buffer The byte array that stores the unmarshalled information of the styled string. 81 * @param bufferSize Indicate the length of the byte array. 82 * @param descriptor Pointer to the ArkUI_StyledString_Descriptor object.。 83 * @return Error code. 84 * {@link ARKUI_ERROR_CODE_NO_ERROR} Success. 85 * {@link ARKUI_ERROR_CODE_PARAM_INVALID} Function parameter exception. 86 * {@link ARKUI_ERROR_CODE_INVALID_STYLED_STRING} Invalid styled string 87 * @since 14 88 */ 89 int32_t OH_ArkUI_MarshallStyledStringDescriptor( 90 uint8_t* buffer, size_t bufferSize, ArkUI_StyledString_Descriptor* descriptor, size_t* resultSize); 91 92 /** 93 * @brief Convert the styled string into html. 94 * 95 * @param descriptor Pointer to the ArkUI_StyledString_Descriptor object. 96 * @return The converted html. 97 * @since 14 98 */ 99 const char* OH_ArkUI_ConvertToHtml(ArkUI_StyledString_Descriptor* descriptor); 100 101 #ifdef __cplusplus 102 }; 103 #endif 104 105 #endif // ARKUI_NATIVE_STYLED_STRING_DESCRIPTOR_H