• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 UDMF
18  * @{
19  *
20  * @brief The Unified Data Management Framework(UDMF) aims to define various standards
21  * for data across applications, devices, and platforms, providing a unified OpenHarmony
22  * data language and standardized data access and reading paths.
23  *
24  * @since 12
25  */
26 
27 /**
28  * @file udmf.h
29  *
30  * @brief Provides unified data management framework related functions and enumerations.
31  *
32  * @kit ArkData
33  * @library libudmf.so
34  * @syscap SystemCapability.DistributedDataManager.UDMF.Core
35  *
36  * @since 12
37  */
38 
39 #ifndef UDMF_H
40 #define UDMF_H
41 
42 #include <inttypes.h>
43 #include <stdbool.h>
44 #include "uds.h"
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
50 /**
51  * @brief The key minimum memory space size of Unified Data.
52  *
53  * @since 12
54  */
55 #define UDMF_KEY_BUFFER_LEN (512)
56 
57 /**
58  * @brief Describe the intention type of the udmf.
59  *
60  * @since 12
61  */
62 typedef enum Udmf_Intention {
63     /**
64      * @brief The intention is drag.
65      */
66     UDMF_INTENTION_DRAG,
67     /**
68      * @brief The intention is pasteboard.
69      */
70     UDMF_INTENTION_PASTEBOARD,
71 } Udmf_Intention;
72 
73 /**
74  * @brief Describe intra-device usage range type enumeration.
75  *
76  * @since 12
77  */
78 typedef enum Udmf_ShareOption {
79     /**
80      * @brief Invalid share option.
81      */
82     SHARE_OPTIONS_INVALID,
83     /**
84      * @brief Allowed to be used in the same application on this device.
85      */
86     SHARE_OPTIONS_IN_APP,
87     /**
88      * @brief Allowed to be used in the cross application on this device.
89      */
90     SHARE_OPTIONS_CROSS_APP
91 } Udmf_ShareOption;
92 
93 /**
94  * @brief Describe the types of file conflict options when getting data from the udmf.
95  *
96  * @since 15
97  */
98 typedef enum Udmf_FileConflictOptions {
99     /**
100      * @brief Overwrite when dest uri has file with same name.
101      */
102     UDMF_OVERWRITE = 0,
103     /**
104      * @brief Skip when dest uri has file with same name.
105      */
106     UDMF_SKIP = 1,
107 } Udmf_FileConflictOptions;
108 
109 /**
110  * @brief Describe the types of progress indicator when getting data from the udmf.
111  *
112  * @since 15
113 */
114 typedef enum Udmf_ProgressIndicator {
115     /**
116      * @brief Getting data without system default progress indicator.
117     */
118     UDMF_NONE = 0,
119     /**
120      * @brief Getting data with system default progress indicator.
121     */
122     UDMF_DEFAULT = 1
123 } Udmf_ProgressIndicator;
124 
125 /**
126  * @brief Describes the unified data type.
127  *
128  * @since 12
129  */
130 typedef struct OH_UdmfData OH_UdmfData;
131 
132 /**
133  * @brief Describes the record type in the unified data.
134  *
135  * @since 12
136  */
137 typedef struct OH_UdmfRecord OH_UdmfRecord;
138 
139 /**
140  * @brief Defines the data provider.
141  *
142  * @since 13
143  */
144 typedef struct OH_UdmfRecordProvider OH_UdmfRecordProvider;
145 
146 /**
147  * @brief Describes some property parameters of unified data.
148  *
149  * @since 12
150  */
151 typedef struct OH_UdmfProperty OH_UdmfProperty;
152 
153 /**
154  * @brief Represents the udmf progress information.
155  *
156  * @since 15
157 */
158 typedef struct OH_Udmf_ProgressInfo OH_Udmf_ProgressInfo;
159 
160 /**
161  * @brief Represents the parameters of udmf get data with progress info.
162  *
163  * @since 15
164 */
165 typedef struct OH_UdmfGetDataParams OH_UdmfGetDataParams;
166 
167 /**
168  * @brief Defines the callback function used to return the progress information and data.
169  *
170  * @param progressInfo The progress information notified to Application.
171  * @param data Represents the unified data.
172  * @since 15
173 */
174 typedef void (*OH_Udmf_DataProgressListener)(OH_Udmf_ProgressInfo* progressInfo, OH_UdmfData* data);
175 
176 
177 /**
178  * @brief Creation a pointer to the instance of the {@link OH_UdmfData}.
179  *
180  * @return If the operation is successful, a pointer to the instance of the {@link OH_UdmfData}
181  * structure is returned. If the operation is failed, nullptr is returned.
182  * @see OH_UdmfData.
183  * @since 12
184  */
185 OH_UdmfData* OH_UdmfData_Create();
186 
187 /**
188  * @brief Destroy a pointer that points to the {@link OH_UdmfData} instance.
189  *
190  * @param pThis Represents a pointer to an instance of {@link OH_UdmfData}.
191  * @see OH_UdmfData.
192  * @since 12
193  */
194 void OH_UdmfData_Destroy(OH_UdmfData* pThis);
195 
196 /**
197  * @brief Add one {OH_UdmfRecord} record to the {@link OH_UdmfData} data.
198  *
199  * @param pThis Represents a pointer to an instance of {@link OH_UdmfData}.
200  * @param record Represents a pointer to an instance of {@link OH_UdmfRecord}.
201  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
202  *         {@link UDMF_E_OK} success.
203  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
204  * @see OH_UdmfData Udmf_ErrCode.
205  * @since 12
206  */
207 int OH_UdmfData_AddRecord(OH_UdmfData* pThis, OH_UdmfRecord* record);
208 
209 /**
210  * @brief Check whether the type exists in the {@link OH_UdmfData} data.
211  *
212  * @param pThis Represents a pointer to an instance of {@link OH_UdmfData}.
213  * @param type Represents a string pointer of the type.
214  * @return Returns the status of finding type.
215  *         {@code false} is not existed.
216  *         {@code true} is existed.
217  * @see OH_UdmfData.
218  * @since 12
219  */
220 bool OH_UdmfData_HasType(OH_UdmfData* pThis, const char* type);
221 
222 /**
223  * @brief Get all types in the {@link OH_UdmfData} data.
224  *
225  * @param pThis Represents a pointer to an instance of {@link OH_UdmfData}.
226  * @param count Represents the types count that is a output param.
227  * @return Returns string array that in {@link OH_UdmfData} when input parameters valid,
228  * otherwise return nullptr.
229  * @see OH_UdmfData.
230  * @since 12
231  */
232 char** OH_UdmfData_GetTypes(OH_UdmfData* pThis, unsigned int* count);
233 
234 /**
235  * @brief Get all records in the {@link OH_UdmfData} data.
236  *
237  * @param pThis Represents a pointer to an instance of {@link OH_UdmfData}.
238  * @param count Represents the records count that is a output param.
239  * @return Returns {@link OH_UdmfRecord} pointer array when input parameters valid, otherwise return nullptr.
240  * @see OH_UdmfData OH_UdmfRecord.
241  * @since 12
242  */
243 OH_UdmfRecord** OH_UdmfData_GetRecords(OH_UdmfData* pThis, unsigned int* count);
244 
245 /**
246  * @brief Defines the callback function used free the context.
247  * @param context Pointer to the context which is to be free.
248  * @since 13
249  */
250 typedef void (*UdmfData_Finalize)(void* context);
251 
252 /**
253  * @brief Creates an {@link OH_UdmfRecordProvider} instance.
254  *
255  * @return Returns the pointer to the {@link OH_UdmfRecordProvider} instance created if the operation is successful.
256  * Returns nullptr if the memory is not enough.
257  * @see OH_UdmfRecordProvider.
258  * @since 13
259  */
260 OH_UdmfRecordProvider* OH_UdmfRecordProvider_Create();
261 
262 /**
263  * @brief Destroy an {@link OH_UdmfRecordProvider} instance.
264  *
265  * @param subscriber Pointer to the {@link OH_UdmfRecordProvider} instance to destroy.
266  * @return Returns the status code of the execution. For details, see {@link Udmf_ErrCode}.
267  *         Returns {@link UDMF_E_OK} if the operation is successful.
268  *         Returns {@link UDMF_E_INVALID_PARAM} if invalid args are detected.
269  * @see OH_UdmfRecordProvider Udmf_ErrCode.
270  * @since 13
271  */
272 int OH_UdmfRecordProvider_Destroy(OH_UdmfRecordProvider* provider);
273 
274 /**
275  * @brief Defines a callback function used to obtain data by type.
276  *
277  * @param context Pointer to the context set by {@link OH_UdmfRecordProvider_SetData}.
278  * @param type Pointer to the type of data to obtain. For details, see {@link udmf_meta.h}.
279  * @return Returns the data content.
280  * @since 13
281  */
282 typedef void* (*OH_UdmfRecordProvider_GetData)(void* context, const char* type);
283 
284 /**
285  * @brief Sets a callback function to obtain data.
286  *
287  * @param provider Pointer to the {@link OH_UdmfRecordProvider} instance.
288  * @param context Pointer to the context set, which is the first parameter in OH_UdmfRecordProvider_GetData.
289  * @param callback Callback to set. For details, see {@link OH_UdmfRecordProvider_GetData}.
290  * @param finalize Optional callback that can free context when destroy provider.
291  *         For details, see {@link UdmfData_Finalize}.
292  * @return Returns the status code of the execution. For details, see {@link Udmf_ErrCode}.
293  *         Returns {@link UDMF_E_OK} if the operation is successful.
294  *         Returns {@link UDMF_E_INVALID_PARAM} if invalid args are detected.
295  * @see OH_UdmfRecordProvider OH_UdmfRecordProvider_GetData UdmfData_Finalize Udmf_ErrCode.
296  * @since 13
297  */
298 int OH_UdmfRecordProvider_SetData(OH_UdmfRecordProvider* provider, void* context,
299     const OH_UdmfRecordProvider_GetData callback, const UdmfData_Finalize finalize);
300 
301 /**
302  * @brief Get primary {@link OH_UdsPlainText} data from the {@link OH_UdmfData}.
303  *
304  * @param data Represents a pointer to an instance of {@link OH_UdmfData}.
305  * @param plainText Represents a pointer to an instance of {@link OH_UdsPlainText}.
306  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
307  *         {@link UDMF_E_OK} success.
308  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
309  * @see OH_UdmfData OH_UdsPlainText Udmf_ErrCode.
310  * @since 13
311  */
312 int OH_UdmfData_GetPrimaryPlainText(OH_UdmfData* data, OH_UdsPlainText* plainText);
313 
314 /**
315  * @brief Get one {@link OH_UdsHtml} data from the {@link OH_UdmfData}.
316  *
317  * @param data Represents a pointer to an instance of {@link OH_UdmfData}.
318  * @param html Represents a pointer to an instance of {@link OH_UdsHtml}.
319  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
320  *         {@link UDMF_E_OK} success.
321  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
322  * @see OH_UdmfData OH_UdsHtml Udmf_ErrCode.
323  * @since 13
324  */
325 int OH_UdmfData_GetPrimaryHtml(OH_UdmfData* data, OH_UdsHtml* html);
326 
327 /**
328  * @brief Get the count of {@link OH_UdmfRecord} in the {@link OH_UdmfData}.
329  *
330  * @param data Represents a pointer to an instance of {@link OH_UdmfData}.
331  * @return Returns the count of {@link OH_UdmfRecord}
332  * @see OH_UdmfData.
333  * @since 13
334  */
335 int OH_UdmfData_GetRecordCount(OH_UdmfData* data);
336 
337 /**
338  * @brief Get the record of the specified index from the {@link OH_UdmfData}.
339  *
340  * @param data Represents a pointer to an instance of {@link OH_UdmfData}.
341  * @param index Represents the index of {@link OH_UdmfRecord} in the {@link OH_UdmfData}.
342  * @return Returns the count of {@link OH_UdmfRecord}
343  * @see OH_UdmfData.
344  * @since 13
345  */
346 OH_UdmfRecord* OH_UdmfData_GetRecord(OH_UdmfData* data, unsigned int index);
347 
348 /**
349  * @brief Checks whether the UDMF data is from a local device.
350  *
351  * @param data Represents a pointer to an instance of {@link OH_UdmfData}.
352  * @return Returns the count of {@link OH_UdmfRecord}
353  * @see OH_UdmfData.
354  * @since 13
355  */
356 bool OH_UdmfData_IsLocal(OH_UdmfData* data);
357 
358 /**
359  * @brief Creation a pointer to the instance of the {@link OH_UdmfRecord}, it's relate with UDS data.
360  *
361  * @return If the operation is successful, a pointer to the instance of the {@link OH_UdmfRecord}
362  * structure is returned. If the operation is failed, nullptr is returned.
363  * @see OH_UdmfRecord.
364  * @since 12
365  */
366 OH_UdmfRecord* OH_UdmfRecord_Create();
367 
368 /**
369  * @brief Destroy a pointer that points to an instance of {@link OH_UdmfRecord}.
370  *
371  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
372  * @see OH_UdmfRecord.
373  * @since 12
374  */
375 void OH_UdmfRecord_Destroy(OH_UdmfRecord* pThis);
376 
377 /**
378  * @brief Add one custom data to the {@link OH_UdmfRecord} record.
379  *
380  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
381  * @param typeId Represents record type, reference udmf_meta.h.
382  * @param entry Represents custom data.
383  * @param count Represents the size of data param.
384  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
385  *         {@link UDMF_E_OK} success.
386  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
387  * @see OH_UdmfRecord Udmf_ErrCode.
388  * @since 12
389  */
390 int OH_UdmfRecord_AddGeneralEntry(OH_UdmfRecord* record, const char* typeId,
391                                   const unsigned char* entry, unsigned int count);
392 
393 /**
394  * @brief Add one {@link OH_UdsPlainText} data to the {@link OH_UdmfRecord} record.
395  *
396  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
397  * @param plainText Represents a pointer to an instance of {@link OH_UdsPlainText}.
398  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
399  *         {@link UDMF_E_OK} success.
400  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
401  * @see OH_UdmfRecord OH_UdsPlainText Udmf_ErrCode.
402  * @since 12
403  */
404 int OH_UdmfRecord_AddPlainText(OH_UdmfRecord* pThis, OH_UdsPlainText* plainText);
405 
406 /**
407  * @brief Add one {@link OH_UdsHyperlink} data to the {@link OH_UdmfRecord} record.
408  *
409  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
410  * @param hyperlink Represents a pointer to an instance of {@link OH_UdsHyperlink}.
411  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
412  *         {@link UDMF_E_OK} success.
413  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
414  * @see OH_UdmfRecord OH_UdsHyperlink Udmf_ErrCode.
415  * @since 12
416  */
417 int OH_UdmfRecord_AddHyperlink(OH_UdmfRecord* pThis, OH_UdsHyperlink* hyperlink);
418 
419 /**
420  * @brief Add one {@link OH_UdsHtml} data to the {@link OH_UdmfRecord} record.
421  *
422  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
423  * @param html Represents a pointer to an instance of {@link OH_UdsHtml}.
424  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
425  *         {@link UDMF_E_OK} success.
426  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
427  * @see OH_UdmfRecord OH_UdsHtml Udmf_ErrCode.
428  * @since 12
429  */
430 int OH_UdmfRecord_AddHtml(OH_UdmfRecord* pThis, OH_UdsHtml* html);
431 
432 /**
433  * @brief Add one {@link OH_UdsAppItem} data to the {@link OH_UdmfRecord} record.
434  *
435  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
436  * @param appItem Represents a pointer to an instance of {@link OH_UdsAppItem}.
437  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
438  *         {@link UDMF_E_OK} success.
439  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
440  * @see OH_UdmfRecord OH_UdsAppItem Udmf_ErrCode.
441  * @since 12
442  */
443 int OH_UdmfRecord_AddAppItem(OH_UdmfRecord* pThis, OH_UdsAppItem* appItem);
444 
445 /**
446  * @brief Add one {@link OH_UdsFileUri} data to the {@link OH_UdmfRecord} record.
447  *
448  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
449  * @param fileUri Represents a pointer to an instance of {@link OH_UdsFileUri}.
450  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
451  *         {@link UDMF_E_OK} success.
452  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
453  * @see OH_UdmfRecord OH_UdsFileUri Udmf_ErrCode.
454  * @since 13
455  */
456 int OH_UdmfRecord_AddFileUri(OH_UdmfRecord* pThis, OH_UdsFileUri* fileUri);
457 
458 /**
459  * @brief Add one {@link OH_UdsPixelMap} data to the {@link OH_UdmfRecord} record.
460  *
461  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
462  * @param pixelMap Represents a pointer to an instance of {@link OH_UdsPixelMap}.
463  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
464  *         {@link UDMF_E_OK} success.
465  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
466  * @see OH_UdmfRecord OH_UdsPixelMap Udmf_ErrCode.
467  * @since 13
468  */
469 int OH_UdmfRecord_AddPixelMap(OH_UdmfRecord* pThis, OH_UdsPixelMap* pixelMap);
470 
471 /**
472  * @brief Add one {@link OH_UdsArrayBuffer} data to the {@link OH_UdmfRecord} record.
473  *
474  * @param record Represents a pointer to an instance of {@link OH_UdmfRecord}.
475  * @param type Represents record type, reference udmf_meta.h.
476  * @param buffer Represents a pointer to an instance of {@link OH_UdsArrayBuffer}.
477  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
478  *         {@link UDMF_E_OK} success.
479  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
480  * @see OH_UdmfRecord OH_UdsArrayBuffer Udmf_ErrCode.
481  * @since 13
482  */
483 int OH_UdmfRecord_AddArrayBuffer(OH_UdmfRecord* record, const char* type, OH_UdsArrayBuffer* buffer);
484 
485 /**
486  * @brief Add one {@link OH_UdsContentForm} data to the {@link OH_UdmfRecord} record.
487  *
488  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
489  * @param contentForm Represents a pointer to an instance of {@link OH_UdsContentForm}.
490  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
491  *         {@link UDMF_E_OK} success.
492  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
493  * @see OH_UdmfRecord OH_UdsContentForm Udmf_ErrCode.
494  * @since 14
495  */
496 int OH_UdmfRecord_AddContentForm(OH_UdmfRecord* pThis, OH_UdsContentForm* contentForm);
497 
498 /**
499  * @brief Get all types in the {@link OH_UdmfRecord} record.
500  *
501  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
502  * @param count Represents the types count that is a output param.
503  * @return Returns string array that in {@link OH_UdmfRecord} when input parameters valid,
504  * otherwise return nullptr.
505  * @see OH_UdmfRecord.
506  * @since 12
507  */
508 char** OH_UdmfRecord_GetTypes(OH_UdmfRecord* pThis, unsigned int* count);
509 
510 /**
511  * @brief Get one entry data from the {@link OH_UdmfRecord} record.
512  *
513  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
514  * @param typeId Represents record type, reference udmf_meta.h.
515  * @param entry Represents a pointer to entry data that is a output param.
516  * @param count Represents the entry data length that is a output param.
517  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
518  *         {@link UDMF_E_OK} success.
519  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
520  * @see OH_UdmfRecord Udmf_ErrCode.
521  * @since 12
522  */
523 int OH_UdmfRecord_GetGeneralEntry(OH_UdmfRecord* pThis, const char* typeId,
524     unsigned char** entry, unsigned int* count);
525 
526 /**
527  * @brief Get one {@link OH_UdsPlainText} data from the {@link OH_UdmfRecord} record.
528  *
529  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
530  * @param plainText Represents a pointer to an instance of {@link OH_UdsPlainText}.
531  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
532  *         {@link UDMF_E_OK} success.
533  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
534  * @see OH_UdmfRecord OH_UdsPlainText Udmf_ErrCode.
535  * @since 12
536  */
537 int OH_UdmfRecord_GetPlainText(OH_UdmfRecord* pThis, OH_UdsPlainText* plainText);
538 
539 /**
540  * @brief Get one {@link OH_UdsHyperlink} data from the {@link OH_UdmfRecord} record.
541  *
542  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
543  * @param hyperlink Represents a pointer to an instance of {@link OH_UdsHyperlink}.
544  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
545  *         {@link UDMF_E_OK} success.
546  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
547  * @see OH_UdmfRecord OH_UdsHyperlink Udmf_ErrCode.
548  * @since 12
549  */
550 int OH_UdmfRecord_GetHyperlink(OH_UdmfRecord* pThis, OH_UdsHyperlink* hyperlink);
551 
552 /**
553  * @brief Get one {@link OH_UdsHtml} data from the {@link OH_UdmfRecord} record.
554  *
555  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
556  * @param html Represents a pointer to an instance of {@link OH_UdsHtml}.
557  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
558  *         {@link UDMF_E_OK} success.
559  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
560  * @see OH_UdmfRecord OH_UdsHtml Udmf_ErrCode.
561  * @since 12
562  */
563 int OH_UdmfRecord_GetHtml(OH_UdmfRecord* pThis, OH_UdsHtml* html);
564 
565 /**
566  * @brief Get one {@link OH_UdsAppItem} data from the {@link OH_UdmfRecord} record.
567  *
568  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
569  * @param appItem Represents a pointer to an instance of {@link OH_UdsAppItem}.
570  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
571  *         {@link UDMF_E_OK} success.
572  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
573  * @see OH_UdmfRecord OH_UdsAppItem Udmf_ErrCode.
574  * @since 12
575  */
576 int OH_UdmfRecord_GetAppItem(OH_UdmfRecord* pThis, OH_UdsAppItem* appItem);
577 
578 /**
579  * @brief Get one {@link OH_UdsFileUri} data from the {@link OH_UdmfRecord} record.
580  *
581  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
582  * @param fileUri Represents a pointer to an instance of {@link OH_UdsFileUri}.
583  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
584  *         {@link UDMF_E_OK} success.
585  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
586  * @see OH_UdmfRecord OH_UdsFileUri Udmf_ErrCode.
587  * @since 13
588  */
589 int OH_UdmfRecord_GetFileUri(OH_UdmfRecord* pThis, OH_UdsFileUri* fileUri);
590 
591 /**
592  * @brief Get one {@link OH_UdsPixelMap} data from the {@link OH_UdmfRecord} record.
593  *
594  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
595  * @param pixelMap Represents a pointer to an instance of {@link OH_UdsPixelMap}.
596  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
597  *         {@link UDMF_E_OK} success.
598  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
599  * @see OH_UdmfRecord OH_UdsPixelMap Udmf_ErrCode.
600  * @since 13
601  */
602 int OH_UdmfRecord_GetPixelMap(OH_UdmfRecord* pThis, OH_UdsPixelMap* pixelMap);
603 
604 /**
605  * @brief Get one {@link OH_UdsArrayBuffer} data from the {@link OH_UdmfRecord} record.
606  *
607  * @param record Represents a pointer to an instance of {@link OH_UdmfRecord}.
608  * @param type Represents record type, reference udmf_meta.h.
609  * @param buffer Represents a pointer to an instance of {@link OH_UdsArrayBuffer}.
610  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
611  *         {@link UDMF_E_OK} success.
612  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
613  * @see OH_UdmfRecord OH_UdsArrayBuffer Udmf_ErrCode.
614  * @since 13
615  */
616 int OH_UdmfRecord_GetArrayBuffer(OH_UdmfRecord* record, const char* type, OH_UdsArrayBuffer* buffer);
617 
618 /**
619  * @brief Get one {@link OH_UdsContentForm} data from the {@link OH_UdmfRecord} record.
620  *
621  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
622  * @param contentForm Represents a pointer to an instance of {@link OH_UdsContentForm}.
623  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
624  *         {@link UDMF_E_OK} success.
625  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
626  * @see OH_UdmfRecord OH_UdsContentForm Udmf_ErrCode.
627  * @since 14
628  */
629 int OH_UdmfRecord_GetContentForm(OH_UdmfRecord* pThis, OH_UdsContentForm* contentForm);
630 
631 /**
632  * @brief Set the data provider of the types.
633  *
634  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
635  * @param types Represents a pointer to a group of data types;
636  * @param count Represents the number of data types;
637  * @param provider Represents a pointer an instance of {@link OH_UdmfRecordProvider}.
638  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
639  *         {@link UDMF_E_OK} success.
640  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
641  * @see OH_UdmfRecord OH_UdmfRecordProvider Udmf_ErrCode.
642  * @since 13
643  */
644 int OH_UdmfRecord_SetProvider(OH_UdmfRecord* pThis, const char* const* types, unsigned int count,
645     OH_UdmfRecordProvider* provider);
646 
647 /**
648  * @brief Creation a pointer to the instance of the {@link OH_UdmfProperty}
649  * from a {@link OH_UdmfData} data.
650  *
651  * @param unifiedData Represents a pointer to an instance of {@link OH_UdmfData}.
652  * @return If the operation is successful, a pointer to the instance of the {@link OH_UdmfProperty}
653  * structure is returned. If the operation is failed, nullptr is returned.
654  * @see OH_UdmfData OH_UdmfProperty.
655  * @since 12
656  */
657 OH_UdmfProperty* OH_UdmfProperty_Create(OH_UdmfData* unifiedData);
658 
659 /**
660  * @brief Destroy a pointer that points to the {@link OH_UdmfProperty} instance.
661  *
662  * @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
663  * @see OH_UdmfProperty.
664  * @since 12
665  */
666 void OH_UdmfProperty_Destroy(OH_UdmfProperty* pThis);
667 
668 /**
669  * @brief Get tag value from the {@link OH_UdmfProperty}.
670  *
671  * @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
672  * @return Returns a pointer of the tag value string when input parameters valid, otherwise return nullptr.
673  * @see OH_UdmfProperty.
674  * @since 12
675  */
676 const char* OH_UdmfProperty_GetTag(OH_UdmfProperty* pThis);
677 
678 /**
679  * @brief Get timestamp value from the {@link OH_UdmfProperty}.
680  *
681  * @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
682  * @return Returns timestamp value.
683  * @see OH_UdmfProperty
684  * @since 12
685  */
686 int64_t OH_UdmfProperty_GetTimestamp(OH_UdmfProperty* pThis);
687 
688 /**
689  * @brief Get share option value from the {@link OH_UdmfProperty}.
690  *
691  * @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
692  * @return Returns {@link Udmf_ShareOption} value.
693  * @see OH_UdmfProperty Udmf_ShareOption
694  * @since 12
695  */
696 Udmf_ShareOption OH_UdmfProperty_GetShareOption(OH_UdmfProperty* pThis);
697 
698 /**
699  * @brief Get integer value by key from the {@link OH_UdmfProperty}.
700  *
701  * @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
702  * @param key Represents key-value pair's key
703  * @param defaultValue Represents when get value failure.
704  * @return Returns value associated with the key in successfully, otherwise return defaultValue.
705  * @see OH_UdmfProperty.
706  * @since 12
707  */
708 int OH_UdmfProperty_GetExtrasIntParam(OH_UdmfProperty* pThis,
709     const char* key, int defaultValue);
710 
711 /**
712  * @brief Get tag value from the {@link OH_UdmfProperty}.
713  *
714  * @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
715  * @param key Represents key-value pair's key.
716  * @return Returns a pointer of the key value string when input parameters valid, otherwise return nullptr.
717  * @see OH_UdmfProperty
718  * @since 12
719  */
720 const char* OH_UdmfProperty_GetExtrasStringParam(OH_UdmfProperty* pThis, const char* key);
721 
722 /**
723  * @brief Set tag value to {@link OH_UdmfProperty} .
724  *
725  * @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
726  * @param tag Represents new tag param.
727  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
728  *         {@link UDMF_E_OK} success.
729  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
730  * @see OH_UdmfProperty Udmf_ErrCode.
731  * @since 12
732  */
733 int OH_UdmfProperty_SetTag(OH_UdmfProperty* pThis, const char* tag);
734 
735 /**
736  * @brief Set Udmf_ShareOption value to {@link OH_UdmfProperty}.
737  *
738  * @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
739  * @param option Represents new {@link Udmf_ShareOption} param.
740  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
741  *         {@link UDMF_E_OK} success.
742  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
743  * @see OH_UdmfProperty Udmf_ShareOption Udmf_ErrCode.
744  * @since 12
745  */
746 int OH_UdmfProperty_SetShareOption(OH_UdmfProperty* pThis, Udmf_ShareOption option);
747 
748 /**
749  * @brief Set extras param to {@link OH_UdmfProperty}.
750  *
751  * @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
752  * @param key Represents extras param's key value.
753  * @param param Represents value of k-v pairs.
754  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
755  *         {@link UDMF_E_OK} success.
756  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
757  * @see OH_UdmfProperty Udmf_ErrCode.
758  * @since 12
759  */
760 int OH_UdmfProperty_SetExtrasIntParam(OH_UdmfProperty* pThis, const char* key, int param);
761 
762 /**
763  * @brief Set extras param to {@link OH_UdmfProperty}.
764  *
765  * @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
766  * @param key Represents extras param's key value.
767  * @param param Represents value of k-v pairs.
768  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
769  *         {@link UDMF_E_OK} success.
770  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
771  * @see OH_UdmfProperty Udmf_ErrCode.
772  * @since 12
773  */
774 int OH_UdmfProperty_SetExtrasStringParam(OH_UdmfProperty* pThis,
775     const char* key, const char* param);
776 
777 /**
778  * @brief Get {@link OH_UdmfData} data from udmf database.
779  *
780  * @param key Represents database store's key value.
781  * @param intention Represents data type {@link Udmf_Intention}
782  * @param unifiedData Represents output params of {@link OH_UdmfData};
783  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
784  *         {@link UDMF_E_OK} success.
785  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
786  * @see OH_UdmfProperty Udmf_Intention Udmf_ErrCode.
787  * @since 12
788  */
789 int OH_Udmf_GetUnifiedData(const char* key, Udmf_Intention intention, OH_UdmfData* unifiedData);
790 
791 /**
792  * @brief Set {@link OH_UdmfData} data to database.
793  *
794  * @param intention Represents data type {@link Udmf_Intention}.
795  * @param unifiedData Represents a pointer to an instance of {@link OH_UdmfData}.
796  * @param key Represents return value after set data to database successfully,
797  * it's memory size not less than {@link UDMF_KEY_BUFFER_LEN}.
798  * @param keyLen Represents size of key param.
799  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
800  *         {@link UDMF_E_OK} success.
801  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
802  * @see OH_UdmfProperty Udmf_Intention Udmf_ErrCode.
803  * @since 12
804  */
805 int OH_Udmf_SetUnifiedData(Udmf_Intention intention, OH_UdmfData* unifiedData,
806     char* key, unsigned int keyLen);
807 
808 /**
809  * @brief Gets the progress from the {@OH_Udmf_ProgressInfo}.
810  *
811  * @param progressInfo Represents a pointer to an instance of {@link OH_Udmf_ProgressInfo}.
812  * @return Returns the progress.
813  * @see OH_Udmf_ProgressInfo
814  * @since 15
815  */
816 int OH_UdmfProgressInfo_GetProgress(OH_Udmf_ProgressInfo* progressInfo);
817 
818 /**
819  * @brief Gets the status from the {@OH_Udmf_ProgressInfo}.
820  *
821  * @param progressInfo Represents a pointer to an instance of {@link OH_Udmf_ProgressInfo}.
822  * @return Returns the status code. See {@link Udmf_ListenerStatus}.
823  * @see OH_Udmf_ProgressInfo Udmf_ListenerStatus
824  * @since 15
825  */
826 int OH_UdmfProgressInfo_GetStatus(OH_Udmf_ProgressInfo* progressInfo);
827 
828 /**
829  * @brief Creation a pointer to the instance of the {@link OH_UdmfGetDataParams}.
830  *
831  * @return If the operation is successful, a pointer to the instance of the {@link OH_UdmfGetDataParams}
832  * structure is returned. If the operation is failed, nullptr is returned.
833  * @see OH_UdmfGetDataParams
834  * @since 15
835  */
836 OH_UdmfGetDataParams* OH_UdmfGetDataParams_Create();
837 
838 /**
839  * @brief Destroy a pointer that points to an instance of {@link OH_UdmfGetDataParams}.
840  *
841  * @param pThis Represents a pointer to an instance of {@link OH_UdmfGetDataParams}.
842  * @see OH_UdmfGetDataParams
843  * @since 15
844  */
845 void OH_UdmfGetDataParams_Destroy(OH_UdmfGetDataParams* pThis);
846 
847 /**
848  * @brief Sets the destination uri to the {@OH_UdmfGetDataParams}.
849  *
850  * @param params Represents a pointer to an instance of {@link OH_UdmfGetDataParams}.
851  * @param destUri Pointer to a destination uri.
852  * @see OH_UdmfGetDataParams
853  * @since 15
854  */
855 void OH_UdmfGetDataParams_SetDestUri(OH_UdmfGetDataParams* params, const char* destUri);
856 
857 /**
858  * @brief Sets the file conflict options to the {@OH_UdmfGetDataParams}.
859  *
860  * @param params Represents a pointer to an instance of {@link OH_UdmfGetDataParams}.
861  * @param options Represents to the file conflict options.
862  * @see OH_UdmfGetDataParams Udmf_FileConflictOptions
863  * @since 15
864  */
865 void OH_UdmfGetDataParams_SetFileConflictOptions(OH_UdmfGetDataParams* params, const Udmf_FileConflictOptions options);
866 
867 /**
868  * @brief Sets the progress indicator to the {@OH_UdmfGetDataParams}.
869  *
870  * @param params Represents a pointer to an instance of {@link OH_UdmfGetDataParams}.
871  * @param options Represents to the progress indicator.
872  * @see OH_UdmfGetDataParams Udmf_ProgressIndicator
873  * @since 15
874  */
875 void OH_UdmfGetDataParams_SetProgressIndicator(OH_UdmfGetDataParams* params,
876     const Udmf_ProgressIndicator progressIndicator);
877 
878 /**
879  * @brief Sets the progress indicator to the {@OH_UdmfGetDataParams}.
880  *
881  * @param params Represents a pointer to an instance of {@link OH_UdmfGetDataParams}.
882  * @param options Represents to the data progress listener.
883  * @see OH_UdmfGetDataParams OH_Udmf_DataProgressListener
884  * @since 15
885  */
886 void OH_UdmfGetDataParams_SetDataProgressListener(OH_UdmfGetDataParams* params,
887     const OH_Udmf_DataProgressListener dataProgressListener);
888 
889 #ifdef __cplusplus
890 };
891 #endif
892 
893 /** @} */
894 #endif