17777dab0Sopenharmony_ci/*
27777dab0Sopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd.
37777dab0Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
47777dab0Sopenharmony_ci * you may not use this file except in compliance with the License.
57777dab0Sopenharmony_ci * You may obtain a copy of the License at
67777dab0Sopenharmony_ci *
77777dab0Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
87777dab0Sopenharmony_ci *
97777dab0Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
107777dab0Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
117777dab0Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
127777dab0Sopenharmony_ci * See the License for the specific language governing permissions and
137777dab0Sopenharmony_ci * limitations under the License.
147777dab0Sopenharmony_ci */
157777dab0Sopenharmony_ci
167777dab0Sopenharmony_ci/**
177777dab0Sopenharmony_ci * @addtogroup UDMF
187777dab0Sopenharmony_ci * @{
197777dab0Sopenharmony_ci *
207777dab0Sopenharmony_ci * @brief The Unified Data Management Framework(UDMF) aims to define various standards
217777dab0Sopenharmony_ci * for data across applications, devices, and platforms, providing a unified OpenHarmony
227777dab0Sopenharmony_ci * data language and standardized data access and reading paths.
237777dab0Sopenharmony_ci *
247777dab0Sopenharmony_ci * @syscap SystemCapability.DistributedDataManager.UDMF.Core
257777dab0Sopenharmony_ci * @since 12
267777dab0Sopenharmony_ci */
277777dab0Sopenharmony_ci
287777dab0Sopenharmony_ci/**
297777dab0Sopenharmony_ci * @file utd.h
307777dab0Sopenharmony_ci *
317777dab0Sopenharmony_ci * @brief Provides uniform type descriptor(UTD) related functions and struct.
327777dab0Sopenharmony_ci *
337777dab0Sopenharmony_ci * @kit ArkData
347777dab0Sopenharmony_ci * @library libudmf.so
357777dab0Sopenharmony_ci * @syscap SystemCapability.DistributedDataManager.UDMF.Core
367777dab0Sopenharmony_ci * @since 12
377777dab0Sopenharmony_ci */
387777dab0Sopenharmony_ci
397777dab0Sopenharmony_ci#ifndef UTD_H
407777dab0Sopenharmony_ci#define UTD_H
417777dab0Sopenharmony_ci
427777dab0Sopenharmony_ci#include <stdbool.h>
437777dab0Sopenharmony_ci
447777dab0Sopenharmony_ci#ifdef __cplusplus
457777dab0Sopenharmony_ciextern "C" {
467777dab0Sopenharmony_ci#endif
477777dab0Sopenharmony_ci
487777dab0Sopenharmony_ci/**
497777dab0Sopenharmony_ci * @brief Describes the unified data type descriptor.
507777dab0Sopenharmony_ci *
517777dab0Sopenharmony_ci * @since 12
527777dab0Sopenharmony_ci */
537777dab0Sopenharmony_citypedef struct OH_Utd OH_Utd;
547777dab0Sopenharmony_ci
557777dab0Sopenharmony_ci/**
567777dab0Sopenharmony_ci * @brief Prouct a pointer to the instance of the {@link OH_Utd}.
577777dab0Sopenharmony_ci *
587777dab0Sopenharmony_ci * @param typeId Represents type of UTD, reference udmf_meta.h.
597777dab0Sopenharmony_ci * @return If the operation is successful, a pointer to the instance of the {@link OH_Utd}
607777dab0Sopenharmony_ci * structure is returned.If the operation is failed, nullptr is returned.
617777dab0Sopenharmony_ci * Must be destroyed with {@link OH_Utd_DestroyTypeDescriptor} when not needed.
627777dab0Sopenharmony_ci * @see OH_Utd.
637777dab0Sopenharmony_ci * @since 12
647777dab0Sopenharmony_ci */
657777dab0Sopenharmony_ciOH_Utd* OH_Utd_Create(const char* typeId);
667777dab0Sopenharmony_ci
677777dab0Sopenharmony_ci/**
687777dab0Sopenharmony_ci * @brief Destroy a pointer that points to the {@link OH_Utd} instance.
697777dab0Sopenharmony_ci *
707777dab0Sopenharmony_ci * @param pThis Represents a pointer to an instance of {@link OH_Utd}.
717777dab0Sopenharmony_ci * @see OH_Utd.
727777dab0Sopenharmony_ci * @since 12
737777dab0Sopenharmony_ci */
747777dab0Sopenharmony_civoid OH_Utd_Destroy(OH_Utd* pThis);
757777dab0Sopenharmony_ci
767777dab0Sopenharmony_ci/**
777777dab0Sopenharmony_ci * @brief Get type id from the {@link OH_Utd}.
787777dab0Sopenharmony_ci *
797777dab0Sopenharmony_ci * @param pThis Represents a pointer to an instance of {@link OH_Utd}.
807777dab0Sopenharmony_ci * @return Returns a string pointer when input args normally, otherwise return nullptr.
817777dab0Sopenharmony_ci * @see OH_Utd.
827777dab0Sopenharmony_ci * @since 12
837777dab0Sopenharmony_ci */
847777dab0Sopenharmony_ciconst char* OH_Utd_GetTypeId(OH_Utd* pThis);
857777dab0Sopenharmony_ci
867777dab0Sopenharmony_ci/**
877777dab0Sopenharmony_ci * @brief Get description from the {@link OH_Utd}.
887777dab0Sopenharmony_ci *
897777dab0Sopenharmony_ci * @param pThis Represents a pointer to an instance of {@link OH_Utd}.
907777dab0Sopenharmony_ci * @return Returns a string pointer when input args normally, otherwise return nullptr.
917777dab0Sopenharmony_ci * @see OH_Utd.
927777dab0Sopenharmony_ci * @since 12
937777dab0Sopenharmony_ci */
947777dab0Sopenharmony_ciconst char* OH_Utd_GetDescription(OH_Utd* pThis);
957777dab0Sopenharmony_ci
967777dab0Sopenharmony_ci/**
977777dab0Sopenharmony_ci * @brief Get url from the {@link OH_Utd}.
987777dab0Sopenharmony_ci *
997777dab0Sopenharmony_ci * @param pThis Represents a pointer to an instance of {@link OH_Utd}.
1007777dab0Sopenharmony_ci * @return Returns a string pointer when input args normally, otherwise return nullptr.
1017777dab0Sopenharmony_ci * @see OH_Utd.
1027777dab0Sopenharmony_ci * @since 12
1037777dab0Sopenharmony_ci */
1047777dab0Sopenharmony_ciconst char* OH_Utd_GetReferenceUrl(OH_Utd* pThis);
1057777dab0Sopenharmony_ci
1067777dab0Sopenharmony_ci/**
1077777dab0Sopenharmony_ci * @brief Get icon file from the {@link OH_Utd}.
1087777dab0Sopenharmony_ci *
1097777dab0Sopenharmony_ci * @param pThis Represents a pointer to an instance of {@link OH_Utd}.
1107777dab0Sopenharmony_ci * @return Returns a string pointer when input args normally, otherwise return nullptr.
1117777dab0Sopenharmony_ci * @see OH_Utd.
1127777dab0Sopenharmony_ci * @since 12
1137777dab0Sopenharmony_ci */
1147777dab0Sopenharmony_ciconst char* OH_Utd_GetIconFile(OH_Utd* pThis);
1157777dab0Sopenharmony_ci
1167777dab0Sopenharmony_ci/**
1177777dab0Sopenharmony_ci * @brief Get belong to type id of the current {@link OH_Utd}.
1187777dab0Sopenharmony_ci *
1197777dab0Sopenharmony_ci * @param pThis Represents a pointer to an instance of {@link OH_Utd}.
1207777dab0Sopenharmony_ci * @param count Represents the return types count.
1217777dab0Sopenharmony_ci * @return Returns string array when input args normally, otherwise return nullptr.
1227777dab0Sopenharmony_ci * @see OH_Utd.
1237777dab0Sopenharmony_ci * @since 12
1247777dab0Sopenharmony_ci */
1257777dab0Sopenharmony_ciconst char** OH_Utd_GetBelongingToTypes(OH_Utd* pThis, unsigned int* count);
1267777dab0Sopenharmony_ci
1277777dab0Sopenharmony_ci/**
1287777dab0Sopenharmony_ci * @brief Get filename extensions of the current {@link OH_Utd}.
1297777dab0Sopenharmony_ci *
1307777dab0Sopenharmony_ci * @param pThis Represents a pointer to an instance of {@link OH_Utd}.
1317777dab0Sopenharmony_ci * @param count Represents the return file extensions count.
1327777dab0Sopenharmony_ci * @return Returns string array when input args normally, otherwise return nullptr.
1337777dab0Sopenharmony_ci * @see OH_Utd.
1347777dab0Sopenharmony_ci * @since 12
1357777dab0Sopenharmony_ci */
1367777dab0Sopenharmony_ciconst char** OH_Utd_GetFilenameExtensions(OH_Utd* pThis, unsigned int* count);
1377777dab0Sopenharmony_ci
1387777dab0Sopenharmony_ci/**
1397777dab0Sopenharmony_ci * @brief Get mime types of the current {@link OH_Utd}.
1407777dab0Sopenharmony_ci *
1417777dab0Sopenharmony_ci * @param pThis Represents a pointer to an instance of {@link OH_Utd}.
1427777dab0Sopenharmony_ci * @param count Represents the mime types count.
1437777dab0Sopenharmony_ci * @return Returns string array when input args normally, otherwise return nullptr.
1447777dab0Sopenharmony_ci * @see OH_Utd.
1457777dab0Sopenharmony_ci * @since 12
1467777dab0Sopenharmony_ci */
1477777dab0Sopenharmony_ciconst char** OH_Utd_GetMimeTypes(OH_Utd* pThis, unsigned int* count);
1487777dab0Sopenharmony_ci
1497777dab0Sopenharmony_ci/**
1507777dab0Sopenharmony_ci * @brief Get type id by file name extension.
1517777dab0Sopenharmony_ci *
1527777dab0Sopenharmony_ci * @param extension Represents file name extension.
1537777dab0Sopenharmony_ci * @param count Represents the types count.
1547777dab0Sopenharmony_ci * @return Returns string list of types. Must be destroyed with {@link OH_Utd_DestroyStringList} when not needed.
1557777dab0Sopenharmony_ci * @since 12
1567777dab0Sopenharmony_ci */
1577777dab0Sopenharmony_ciconst char** OH_Utd_GetTypesByFilenameExtension(const char* extension, unsigned int* count);
1587777dab0Sopenharmony_ci
1597777dab0Sopenharmony_ci/**
1607777dab0Sopenharmony_ci * @brief Get type id by mime type.
1617777dab0Sopenharmony_ci *
1627777dab0Sopenharmony_ci * @param mimeType Represents mime type
1637777dab0Sopenharmony_ci * @param count Represents the types count.
1647777dab0Sopenharmony_ci * @return Returns string list of types. Must be destroyed with {@link OH_Utd_DestroyStringList} when not needed.
1657777dab0Sopenharmony_ci * @since 12
1667777dab0Sopenharmony_ci */
1677777dab0Sopenharmony_ciconst char** OH_Utd_GetTypesByMimeType(const char* mimeType, unsigned int* count);
1687777dab0Sopenharmony_ci
1697777dab0Sopenharmony_ci/**
1707777dab0Sopenharmony_ci * @brief Calculate relationships of two types.
1717777dab0Sopenharmony_ci *
1727777dab0Sopenharmony_ci * @param srcTypeId Represents source type id.
1737777dab0Sopenharmony_ci * @param destTypeId Represents target type id.
1747777dab0Sopenharmony_ci * @return Returns the status code of the execution.
1757777dab0Sopenharmony_ci *         {@code false} Represents srcTypeId not belongs to destTypeId.
1767777dab0Sopenharmony_ci *         {@code true} Represents srcTypeId belongs to destTypeId.
1777777dab0Sopenharmony_ci * @since 12
1787777dab0Sopenharmony_ci */
1797777dab0Sopenharmony_cibool OH_Utd_BelongsTo(const char* srcTypeId, const char* destTypeId);
1807777dab0Sopenharmony_ci
1817777dab0Sopenharmony_ci/**
1827777dab0Sopenharmony_ci * @brief Calculate relationships of two types.
1837777dab0Sopenharmony_ci *
1847777dab0Sopenharmony_ci * @param srcTypeId Represents source type id.
1857777dab0Sopenharmony_ci * @param destTypeId Represents target type id.
1867777dab0Sopenharmony_ci * @return Returns the status code of the execution.
1877777dab0Sopenharmony_ci *         {@code false} Represents srcTypeId not lower level to destTypeId.
1887777dab0Sopenharmony_ci *         {@code true} Represents srcTypeId lower level to destTypeId.
1897777dab0Sopenharmony_ci * @since 12
1907777dab0Sopenharmony_ci */
1917777dab0Sopenharmony_cibool OH_Utd_IsLower(const char* srcTypeId, const char* destTypeId);
1927777dab0Sopenharmony_ci
1937777dab0Sopenharmony_ci/**
1947777dab0Sopenharmony_ci * @brief Calculate relationships of two types.
1957777dab0Sopenharmony_ci *
1967777dab0Sopenharmony_ci * @param srcTypeId Represents source type id.
1977777dab0Sopenharmony_ci * @param destTypeId Represents target type id.
1987777dab0Sopenharmony_ci * @return Returns the status code of the execution.
1997777dab0Sopenharmony_ci *         {@code false} Represents srcTypeId not higher level to destTypeId.
2007777dab0Sopenharmony_ci *         {@code true} Represents srcTypeId higher level to destTypeId.
2017777dab0Sopenharmony_ci * @since 12
2027777dab0Sopenharmony_ci */
2037777dab0Sopenharmony_cibool OH_Utd_IsHigher(const char* srcTypeId, const char* destTypeId);
2047777dab0Sopenharmony_ci
2057777dab0Sopenharmony_ci/**
2067777dab0Sopenharmony_ci * @brief Calculate two {@link OH_Utd}s are equal.
2077777dab0Sopenharmony_ci *
2087777dab0Sopenharmony_ci * @param utd1 Represents a pointer to {@link OH_Utd} instance.
2097777dab0Sopenharmony_ci * @param utd2 Represents a pointer to {@link OH_Utd} instance.
2107777dab0Sopenharmony_ci * @return Returns the status code of the execution.
2117777dab0Sopenharmony_ci *         {@code false} Represents utd1 and utd2 are not equal.
2127777dab0Sopenharmony_ci *         {@code true} Represents utd1 and utd2 are equal.
2137777dab0Sopenharmony_ci * @since 12
2147777dab0Sopenharmony_ci */
2157777dab0Sopenharmony_cibool OH_Utd_Equals(OH_Utd* utd1, OH_Utd* utd2);
2167777dab0Sopenharmony_ci
2177777dab0Sopenharmony_ci/**
2187777dab0Sopenharmony_ci * @brief Destroy string list memory.
2197777dab0Sopenharmony_ci *
2207777dab0Sopenharmony_ci * @param list Represents a point to string list.
2217777dab0Sopenharmony_ci * @param count Represents string count in list.
2227777dab0Sopenharmony_ci * @since 12
2237777dab0Sopenharmony_ci */
2247777dab0Sopenharmony_civoid OH_Utd_DestroyStringList(const char** list, unsigned int count);
2257777dab0Sopenharmony_ci
2267777dab0Sopenharmony_ci#ifdef __cplusplus
2277777dab0Sopenharmony_ci};
2287777dab0Sopenharmony_ci#endif
2297777dab0Sopenharmony_ci
2307777dab0Sopenharmony_ci/** @} */
2317777dab0Sopenharmony_ci#endif