• 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  * @brief Creation a pointer to the instance of the {@link OH_UdmfData}.
178  *
179  * @return If the operation is successful, a pointer to the instance of the {@link OH_UdmfData}
180  * structure is returned. If the operation is failed, nullptr is returned.
181  * @see OH_UdmfData.
182  * @since 12
183  */
184 OH_UdmfData* OH_UdmfData_Create();
185 
186 /**
187  * @brief Destroy a pointer that points to the {@link OH_UdmfData} instance.
188  *
189  * @param pThis Represents a pointer to an instance of {@link OH_UdmfData}.
190  * @see OH_UdmfData.
191  * @since 12
192  */
193 void OH_UdmfData_Destroy(OH_UdmfData* pThis);
194 
195 /**
196  * @brief Add one {OH_UdmfRecord} record to the {@link OH_UdmfData} data.
197  *
198  * @param pThis Represents a pointer to an instance of {@link OH_UdmfData}.
199  * @param record Represents a pointer to an instance of {@link OH_UdmfRecord}.
200  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
201  *         {@link UDMF_E_OK} success.
202  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
203  * @see OH_UdmfData Udmf_ErrCode.
204  * @since 12
205  */
206 int OH_UdmfData_AddRecord(OH_UdmfData* pThis, OH_UdmfRecord* record);
207 
208 /**
209  * @brief Check whether the type exists in the {@link OH_UdmfData} data.
210  *
211  * @param pThis Represents a pointer to an instance of {@link OH_UdmfData}.
212  * @param type Represents a string pointer of the type.
213  * @return Returns the status of finding type.
214  *         {@code false} is not existed.
215  *         {@code true} is existed.
216  * @see OH_UdmfData.
217  * @since 12
218  */
219 bool OH_UdmfData_HasType(OH_UdmfData* pThis, const char* type);
220 
221 /**
222  * @brief Get all types in the {@link OH_UdmfData} data.
223  *
224  * @param pThis Represents a pointer to an instance of {@link OH_UdmfData}.
225  * @param count Represents the types count that is a output param.
226  * @return Returns string array that in {@link OH_UdmfData} when input parameters valid,
227  * otherwise return nullptr.
228  * @see OH_UdmfData.
229  * @since 12
230  */
231 char** OH_UdmfData_GetTypes(OH_UdmfData* pThis, unsigned int* count);
232 
233 /**
234  * @brief Get all records in the {@link OH_UdmfData} data.
235  *
236  * @param pThis Represents a pointer to an instance of {@link OH_UdmfData}.
237  * @param count Represents the records count that is a output param.
238  * @return Returns {@link OH_UdmfRecord} pointer array when input parameters valid, otherwise return nullptr.
239  * @see OH_UdmfData OH_UdmfRecord.
240  * @since 12
241  */
242 OH_UdmfRecord** OH_UdmfData_GetRecords(OH_UdmfData* pThis, unsigned int* count);
243 
244 /**
245  * @brief Defines the callback function used free the context.
246  * @param context Pointer to the context which is to be free.
247  * @since 13
248  */
249 typedef void (*UdmfData_Finalize)(void* context);
250 
251 /**
252  * @brief Creates an {@link OH_UdmfRecordProvider} instance.
253  *
254  * @return Returns the pointer to the {@link OH_UdmfRecordProvider} instance created if the operation is successful.
255  * Returns nullptr if the memory is not enough.
256  * @see OH_UdmfRecordProvider.
257  * @since 13
258  */
259 OH_UdmfRecordProvider* OH_UdmfRecordProvider_Create();
260 
261 /**
262  * @brief Destroy an {@link OH_UdmfRecordProvider} instance.
263  *
264  * @param provider Pointer to the {@link OH_UdmfRecordProvider} instance to destroy.
265  * @return Returns the status code of the execution. For details, see {@link Udmf_ErrCode}.
266  *         Returns {@link UDMF_E_OK} if the operation is successful.
267  *         Returns {@link UDMF_E_INVALID_PARAM} if invalid args are detected.
268  * @see OH_UdmfRecordProvider Udmf_ErrCode.
269  * @since 13
270  */
271 int OH_UdmfRecordProvider_Destroy(OH_UdmfRecordProvider* provider);
272 
273 /**
274  * @brief Defines a callback function used to obtain data by type.
275  *
276  * @param context Pointer to the context set by {@link OH_UdmfRecordProvider_SetData}.
277  * @param type Pointer to the type of data to obtain. For details, see {@link udmf_meta.h}.
278  * @return Returns the data content.
279  * @since 13
280  */
281 typedef void* (*OH_UdmfRecordProvider_GetData)(void* context, const char* type);
282 
283 /**
284  * @brief Sets a callback function to obtain data.
285  *
286  * @param provider Pointer to the {@link OH_UdmfRecordProvider} instance.
287  * @param context Pointer to the context set, which is the first parameter in OH_UdmfRecordProvider_GetData.
288  * @param callback Callback to set. For details, see {@link OH_UdmfRecordProvider_GetData}.
289  * @param finalize Optional callback that can free context when destroy provider.
290  *         For details, see {@link UdmfData_Finalize}.
291  * @return Returns the status code of the execution. For details, see {@link Udmf_ErrCode}.
292  *         Returns {@link UDMF_E_OK} if the operation is successful.
293  *         Returns {@link UDMF_E_INVALID_PARAM} if invalid args are detected.
294  * @see OH_UdmfRecordProvider OH_UdmfRecordProvider_GetData UdmfData_Finalize Udmf_ErrCode.
295  * @since 13
296  */
297 int OH_UdmfRecordProvider_SetData(OH_UdmfRecordProvider* provider, void* context,
298     const OH_UdmfRecordProvider_GetData callback, const UdmfData_Finalize finalize);
299 
300 /**
301  * @brief Creation a pointer to the instance of the {@link OH_UdmfRecord}, it's relate with UDS data.
302  *
303  * @return If the operation is successful, a pointer to the instance of the {@link OH_UdmfRecord}
304  * structure is returned. If the operation is failed, nullptr is returned.
305  * @see OH_UdmfRecord.
306  * @since 12
307  */
308 OH_UdmfRecord* OH_UdmfRecord_Create();
309 
310 /**
311  * @brief Destroy a pointer that points to an instance of {@link OH_UdmfRecord}.
312  *
313  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
314  * @see OH_UdmfRecord.
315  * @since 12
316  */
317 void OH_UdmfRecord_Destroy(OH_UdmfRecord* pThis);
318 
319 /**
320  * @brief Add one custom data to the {@link OH_UdmfRecord} record.
321  *
322  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
323  * @param typeId Represents record type, reference udmf_meta.h.
324  * @param entry Represents custom data.
325  * @param count Represents the size of data param.
326  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
327  *         {@link UDMF_E_OK} success.
328  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
329  * @see OH_UdmfRecord Udmf_ErrCode.
330  * @since 12
331  */
332 int OH_UdmfRecord_AddGeneralEntry(OH_UdmfRecord* pThis, const char* typeId, unsigned char* entry, unsigned int count);
333 
334 /**
335  * @brief Add one {OH_UdsPlainText} data to the {@link OH_UdmfRecord} record.
336  *
337  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
338  * @param plainText Represents a pointer to an instance of {@link OH_UdsPlainText}.
339  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
340  *         {@link UDMF_E_OK} success.
341  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
342  * @see OH_UdmfRecord OH_UdsPlainText Udmf_ErrCode.
343  * @since 12
344  */
345 int OH_UdmfRecord_AddPlainText(OH_UdmfRecord* pThis, OH_UdsPlainText* plainText);
346 
347 /**
348  * @brief Add one {OH_UdsHyperlink} data to the {@link OH_UdmfRecord} record.
349  *
350  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
351  * @param hyperlink Represents a pointer to an instance of {@link OH_UdsHyperlink}.
352  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
353  *         {@link UDMF_E_OK} success.
354  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
355  * @see OH_UdmfRecord OH_UdsHyperlink Udmf_ErrCode.
356  * @since 12
357  */
358 int OH_UdmfRecord_AddHyperlink(OH_UdmfRecord* pThis, OH_UdsHyperlink* hyperlink);
359 
360 /**
361  * @brief Add one {OH_UdsHtml} data to the {@link OH_UdmfRecord} record.
362  *
363  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
364  * @param html Represents a pointer to an instance of {@link OH_UdsHtml}.
365  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
366  *         {@link UDMF_E_OK} success.
367  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
368  * @see OH_UdmfRecord OH_UdsHtml Udmf_ErrCode.
369  * @since 12
370  */
371 int OH_UdmfRecord_AddHtml(OH_UdmfRecord* pThis, OH_UdsHtml* html);
372 
373 /**
374  * @brief Add one {OH_UdsAppItem} data to the {@link OH_UdmfRecord} record.
375  *
376  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
377  * @param appItem Represents a pointer to an instance of {@link OH_UdsAppItem}.
378  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
379  *         {@link UDMF_E_OK} success.
380  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
381  * @see OH_UdmfRecord OH_UdsAppItem Udmf_ErrCode.
382  * @since 12
383  */
384 int OH_UdmfRecord_AddAppItem(OH_UdmfRecord* pThis, OH_UdsAppItem* appItem);
385 
386 /**
387  * @brief Add one {OH_UdsFileUri} data to the {@link OH_UdmfRecord} record.
388  *
389  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
390  * @param fileUri Represents a pointer to an instance of {@link OH_UdsFileUri}.
391  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
392  *         {@link UDMF_E_OK} success.
393  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
394  * @see OH_UdmfRecord OH_UdsFileUri Udmf_ErrCode.
395  * @since 13
396  */
397 int OH_UdmfRecord_AddFileUri(OH_UdmfRecord* pThis, OH_UdsFileUri* fileUri);
398 
399 /**
400  * @brief Add one {OH_UdsPixelMap} data to the {@link OH_UdmfRecord} record.
401  *
402  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
403  * @param pixelMap Represents a pointer to an instance of {@link OH_UdsPixelMap}.
404  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
405  *         {@link UDMF_E_OK} success.
406  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
407  * @see OH_UdmfRecord OH_UdsPixelMap Udmf_ErrCode.
408  * @since 13
409  */
410 int OH_UdmfRecord_AddPixelMap(OH_UdmfRecord* pThis, OH_UdsPixelMap* pixelMap);
411 
412 /**
413  * @brief Add one {@link OH_UdsArrayBuffer} data to the {@link OH_UdmfRecord} record.
414  *
415  * @param record Represents a pointer to an instance of {@link OH_UdmfRecord}.
416  * @param type Represents record type, reference udmf_meta.h.
417  * @param buffer Represents a pointer to an instance of {@link OH_UdsArrayBuffer}.
418  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
419  *         {@link UDMF_E_OK} success.
420  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
421  * @see OH_UdmfRecord OH_UdsArrayBuffer Udmf_ErrCode.
422  * @since 13
423  */
424 int OH_UdmfRecord_AddArrayBuffer(OH_UdmfRecord* record, const char* type, OH_UdsArrayBuffer* buffer);
425 
426 /**
427  * @brief Add one {@link OH_UdsContentForm} data to the {@link OH_UdmfRecord} record.
428  *
429  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
430  * @param contentForm Represents a pointer to an instance of {@link OH_UdsContentForm}.
431  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
432  *         {@link UDMF_E_OK} success.
433  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
434  * @see OH_UdmfRecord OH_UdsContentForm Udmf_ErrCode.
435  * @since 14
436  */
437 int OH_UdmfRecord_AddContentForm(OH_UdmfRecord* pThis, OH_UdsContentForm* contentForm);
438 
439 /**
440  * @brief Get all types in the {@link OH_UdmfRecord} record.
441  *
442  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
443  * @param count Represents the types count that is a output param.
444  * @return Returns string array that in {@link OH_UdmfRecord} when input parameters valid,
445  * otherwise return nullptr.
446  * @see OH_UdmfRecord.
447  * @since 12
448  */
449 char** OH_UdmfRecord_GetTypes(OH_UdmfRecord* pThis, unsigned int* count);
450 
451 /**
452  * @brief Get one entry data from the {@link OH_UdmfRecord} record.
453  *
454  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
455  * @param typeId Represents record type, reference udmf_meta.h.
456  * @param entry Represents a pointer to entry data that is a output param.
457  * @param count Represents the entry data length that is a output param.
458  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
459  *         {@link UDMF_E_OK} success.
460  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
461  *         {@link UDMF_ERR} Internal data error.
462  * @see OH_UdmfRecord Udmf_ErrCode.
463  * @since 12
464  */
465 int OH_UdmfRecord_GetGeneralEntry(OH_UdmfRecord* pThis, const char* typeId,
466     unsigned char** entry, unsigned int* count);
467 
468 /**
469  * @brief Get one {OH_UdsPlainText} data from the {@link OH_UdmfRecord} record.
470  *
471  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
472  * @param plainText Represents a pointer to an instance of {@link OH_UdsPlainText}.
473  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
474  *         {@link UDMF_E_OK} success.
475  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
476  *         {@link UDMF_ERR} Internal data error.
477  * @see OH_UdmfRecord OH_UdsPlainText Udmf_ErrCode.
478  * @since 12
479  */
480 int OH_UdmfRecord_GetPlainText(OH_UdmfRecord* pThis, OH_UdsPlainText* plainText);
481 
482 /**
483  * @brief Get one {OH_UdsHyperlink} data from the {@link OH_UdmfRecord} record.
484  *
485  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
486  * @param hyperlink Represents a pointer to an instance of {@link OH_UdsHyperlink}.
487  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
488  *         {@link UDMF_E_OK} success.
489  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
490  *         {@link UDMF_ERR} Internal data error.
491  * @see OH_UdmfRecord OH_UdsHyperlink Udmf_ErrCode.
492  * @since 12
493  */
494 int OH_UdmfRecord_GetHyperlink(OH_UdmfRecord* pThis, OH_UdsHyperlink* hyperlink);
495 
496 /**
497  * @brief Get one {OH_UdsHtml} data from the {@link OH_UdmfRecord} record.
498  *
499  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
500  * @param html Represents a pointer to an instance of {@link OH_UdsHtml}.
501  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
502  *         {@link UDMF_E_OK} success.
503  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
504  *         {@link UDMF_ERR} Internal data error.
505  * @see OH_UdmfRecord OH_UdsHtml Udmf_ErrCode.
506  * @since 12
507  */
508 int OH_UdmfRecord_GetHtml(OH_UdmfRecord* pThis, OH_UdsHtml* html);
509 
510 /**
511  * @brief Get one {OH_UdsAppItem} data from the {@link OH_UdmfRecord} record.
512  *
513  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
514  * @param appItem Represents a pointer to an instance of {@link OH_UdsAppItem}.
515  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
516  *         {@link UDMF_E_OK} success.
517  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
518  *         {@link UDMF_ERR} Internal data error.
519  * @see OH_UdmfRecord OH_UdsAppItem Udmf_ErrCode.
520  * @since 12
521  */
522 int OH_UdmfRecord_GetAppItem(OH_UdmfRecord* pThis, OH_UdsAppItem* appItem);
523 
524 /**
525  * @brief Get one {OH_UdsFileUri} data from the {@link OH_UdmfRecord} record.
526  *
527  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
528  * @param fileUri Represents a pointer to an instance of {@link OH_UdsFileUri}.
529  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
530  *         {@link UDMF_E_OK} success.
531  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
532  * @see OH_UdmfRecord OH_UdsFileUri Udmf_ErrCode.
533  * @since 13
534  */
535 int OH_UdmfRecord_GetFileUri(OH_UdmfRecord* pThis, OH_UdsFileUri* fileUri);
536 
537 /**
538  * @brief Get one {OH_UdsPixelMap} data from the {@link OH_UdmfRecord} record.
539  *
540  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
541  * @param pixelMap Represents a pointer to an instance of {@link OH_UdsPixelMap}.
542  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
543  *         {@link UDMF_E_OK} success.
544  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
545  * @see OH_UdmfRecord OH_UdsPixelMap Udmf_ErrCode.
546  * @since 13
547  */
548 int OH_UdmfRecord_GetPixelMap(OH_UdmfRecord* pThis, OH_UdsPixelMap* pixelMap);
549 
550 /**
551  * @brief Set the data provider of the types.
552  *
553  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
554  * @param types Represents a pointer to a group of data types;
555  * @param count Represents the number of data types;
556  * @param provider Represents a pointer an instance of {@link OH_UdmfRecordProvider}.
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_UdmfRecordProvider Udmf_ErrCode.
561  * @since 13
562  */
563 int OH_UdmfRecord_SetProvider(OH_UdmfRecord* pThis, const char* const* types, unsigned int count,
564     OH_UdmfRecordProvider* provider);
565 
566 /**
567  * @brief Get one {@link OH_UdsArrayBuffer} data from the {@link OH_UdmfRecord} record.
568  *
569  * @param record Represents a pointer to an instance of {@link OH_UdmfRecord}.
570  * @param type Represents record type, reference udmf_meta.h.
571  * @param buffer Represents a pointer to an instance of {@link OH_UdsArrayBuffer}.
572  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
573  *         {@link UDMF_E_OK} success.
574  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
575  * @see OH_UdmfRecord OH_UdsArrayBuffer Udmf_ErrCode.
576  * @since 13
577  */
578 int OH_UdmfRecord_GetArrayBuffer(OH_UdmfRecord* record, const char* type, OH_UdsArrayBuffer* buffer);
579 
580 /**
581  * @brief Get one {@link OH_UdsContentForm} data from the {@link OH_UdmfRecord} record.
582  *
583  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
584  * @param contentForm Represents a pointer to an instance of {@link OH_UdsContentForm}.
585  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
586  *         {@link UDMF_E_OK} success.
587  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
588  * @see OH_UdmfRecord OH_UdsContentForm Udmf_ErrCode.
589  * @since 14
590  */
591 int OH_UdmfRecord_GetContentForm(OH_UdmfRecord* pThis, OH_UdsContentForm* contentForm);
592 
593 /**
594  * @brief Get primary {@link OH_UdsPlainText} data from the {@link OH_UdmfData}.
595  *
596  * @param data Represents a pointer to an instance of {@link OH_UdmfData}.
597  * @param plainText Represents a pointer to an instance of {@link OH_UdsPlainText}.
598  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
599  *         {@link UDMF_E_OK} success.
600  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
601  * @see OH_UdmfData OH_UdsPlainText Udmf_ErrCode.
602  * @since 13
603  */
604 int OH_UdmfData_GetPrimaryPlainText(OH_UdmfData* data, OH_UdsPlainText* plainText);
605 
606 /**
607  * @brief Get one {@link OH_UdsHtml} data from the {@link OH_UdmfData}.
608  *
609  * @param data Represents a pointer to an instance of {@link OH_UdmfData}.
610  * @param html Represents a pointer to an instance of {@link OH_UdsHtml}.
611  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
612  *         {@link UDMF_E_OK} success.
613  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
614  * @see OH_UdmfData OH_UdsHtml Udmf_ErrCode.
615  * @since 13
616  */
617 int OH_UdmfData_GetPrimaryHtml(OH_UdmfData* data, OH_UdsHtml* html);
618 
619 /**
620  * @brief Get the count of {@link OH_UdmfRecord} in the {@link OH_UdmfData}.
621  *
622  * @param data Represents a pointer to an instance of {@link OH_UdmfData}.
623  * @return Returns the count of {@link OH_UdmfRecord}
624  * @see OH_UdmfData.
625  * @since 13
626  */
627 int OH_UdmfData_GetRecordCount(OH_UdmfData* data);
628 
629 /**
630  * @brief Get the record of the specified index from the {@link OH_UdmfData}.
631  *
632  * @param data Represents a pointer to an instance of {@link OH_UdmfData}.
633  * @param index Represents the index of {@link OH_UdmfRecord} in the {@link OH_UdmfData}.
634  * @return Returns {@link OH_UdmfRecord} pointer when input parameters valid, otherwise return nullptr.
635  * @see OH_UdmfData.
636  * @since 13
637  */
638 OH_UdmfRecord* OH_UdmfData_GetRecord(OH_UdmfData* data, unsigned int index);
639 
640 /**
641  * @brief Checks whether the UDMF data is from a local device.
642  *
643  * @param data Represents a pointer to an instance of {@link OH_UdmfData}.
644  * @return Returns a boolean value, which indicates whether the UDMF data is from a local device.
645  *         The value {@code true} means the data is from a local device.
646  *         The value {@code false} means the opposite.
647  * @see OH_UdmfData.
648  * @since 13
649  */
650 bool OH_UdmfData_IsLocal(OH_UdmfData* data);
651 
652 /**
653  * @brief Creation a pointer to the instance of the {@link OH_UdmfProperty}
654  * from a {@link OH_UdmfData} data.
655  *
656  * @param unifiedData Represents a pointer to an instance of {@link OH_UdmfData}.
657  * @return If the operation is successful, a pointer to the instance of the {@link OH_UdmfProperty}
658  * structure is returned. If the operation is failed, nullptr is returned.
659  * @see OH_UdmfData OH_UdmfProperty.
660  * @since 12
661  */
662 OH_UdmfProperty* OH_UdmfProperty_Create(OH_UdmfData* unifiedData);
663 
664 /**
665  * @brief Destroy a pointer that points to the {@link OH_UdmfProperty} instance.
666  *
667  * @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
668  * @see OH_UdmfProperty.
669  * @since 12
670  */
671 void OH_UdmfProperty_Destroy(OH_UdmfProperty* pThis);
672 
673 /**
674  * @brief Get tag value from the {@link OH_UdmfProperty}.
675  *
676  * @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
677  * @return Returns a pointer of the tag value string when input parameters valid, otherwise return nullptr.
678  * @see OH_UdmfProperty.
679  * @since 12
680  */
681 const char* OH_UdmfProperty_GetTag(OH_UdmfProperty* pThis);
682 
683 /**
684  * @brief Get timestamp value from the {@link OH_UdmfProperty}.
685  *
686  * @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
687  * @return Returns timestamp value.
688  * @see OH_UdmfProperty
689  * @since 12
690  */
691 int64_t OH_UdmfProperty_GetTimestamp(OH_UdmfProperty* pThis);
692 
693 /**
694  * @brief Get share option value from the {@link OH_UdmfProperty}.
695  *
696  * @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
697  * @return Returns {@link Udmf_ShareOption} value.
698  * @see OH_UdmfProperty Udmf_ShareOption
699  * @since 12
700  */
701 Udmf_ShareOption OH_UdmfProperty_GetShareOption(OH_UdmfProperty* pThis);
702 
703 /**
704  * @brief Get integer value by key from the {@link OH_UdmfProperty}.
705  *
706  * @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
707  * @param key Represents key-value pair's key
708  * @param defaultValue Represents when get value failure.
709  * @return Returns value associated with the key in successfully, otherwise return defaultValue.
710  * @see OH_UdmfProperty.
711  * @since 12
712  */
713 int OH_UdmfProperty_GetExtrasIntParam(OH_UdmfProperty* pThis,
714     const char* key, int defaultValue);
715 
716 /**
717  * @brief Get tag value from the {@link OH_UdmfProperty}.
718  *
719  * @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
720  * @param key Represents key-value pair's key.
721  * @return Returns a pointer of the key value string when input parameters valid, otherwise return nullptr.
722  * @see OH_UdmfProperty
723  * @since 12
724  */
725 const char* OH_UdmfProperty_GetExtrasStringParam(OH_UdmfProperty* pThis, const char* key);
726 
727 /**
728  * @brief Set tag value to {@link OH_UdmfProperty} .
729  *
730  * @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
731  * @param tag Represents new tag param.
732  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
733  *         {@link UDMF_E_OK} success.
734  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
735  * @see OH_UdmfProperty Udmf_ErrCode.
736  * @since 12
737  */
738 int OH_UdmfProperty_SetTag(OH_UdmfProperty* pThis, const char* tag);
739 
740 /**
741  * @brief Set Udmf_ShareOption value to {@link OH_UdmfProperty}.
742  *
743  * @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
744  * @param option Represents new {@link Udmf_ShareOption} param.
745  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
746  *         {@link UDMF_E_OK} success.
747  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
748  * @see OH_UdmfProperty Udmf_ShareOption Udmf_ErrCode.
749  * @since 12
750  */
751 int OH_UdmfProperty_SetShareOption(OH_UdmfProperty* pThis, Udmf_ShareOption option);
752 
753 /**
754  * @brief Set extras param to {@link OH_UdmfProperty}.
755  *
756  * @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
757  * @param key Represents extras param's key value.
758  * @param param Represents value of k-v pairs.
759  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
760  *         {@link UDMF_E_OK} success.
761  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
762  * @see OH_UdmfProperty Udmf_ErrCode.
763  * @since 12
764  */
765 int OH_UdmfProperty_SetExtrasIntParam(OH_UdmfProperty* pThis, const char* key, int param);
766 
767 /**
768  * @brief Set extras param to {@link OH_UdmfProperty}.
769  *
770  * @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
771  * @param key Represents extras param's key value.
772  * @param param Represents value of k-v pairs.
773  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
774  *         {@link UDMF_E_OK} success.
775  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
776  * @see OH_UdmfProperty Udmf_ErrCode.
777  * @since 12
778  */
779 int OH_UdmfProperty_SetExtrasStringParam(OH_UdmfProperty* pThis,
780     const char* key, const char* param);
781 
782 /**
783  * @brief Get {@link OH_UdmfData} data from udmf database.
784  *
785  * @param key Represents database store's key value.
786  * @param intention Represents data type {@link Udmf_Intention}
787  * @param unifiedData Represents output params of {@link OH_UdmfData};
788  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
789  *         {@link UDMF_E_OK} success.
790  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
791  *         {@link UDMF_ERR} Internal data error.
792  * @see OH_UdmfProperty Udmf_Intention Udmf_ErrCode.
793  * @since 12
794  */
795 int OH_Udmf_GetUnifiedData(const char* key, Udmf_Intention intention, OH_UdmfData* unifiedData);
796 
797 /**
798  * @brief Set {@link OH_UdmfData} data to database.
799  *
800  * @param intention Represents data type {@link Udmf_Intention}.
801  * @param unifiedData Represents a pointer to an instance of {@link OH_UdmfData}.
802  * @param key Represents return value after set data to database successfully,
803  * it's memory size not less than {@link UDMF_KEY_BUFFER_LEN}.
804  * @param keyLen Represents size of key param.
805  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
806  *         {@link UDMF_E_OK} success.
807  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
808  *         {@link UDMF_ERR} Internal data error.
809  * @see OH_UdmfProperty Udmf_Intention Udmf_ErrCode.
810  * @since 12
811  */
812 int OH_Udmf_SetUnifiedData(Udmf_Intention intention, OH_UdmfData* unifiedData,
813     char* key, unsigned int keyLen);
814 
815 /**
816  * @brief Gets the progress from the {@OH_Udmf_ProgressInfo}.
817  *
818  * @param progressInfo Represents a pointer to an instance of {@link OH_Udmf_ProgressInfo}.
819  * @return Returns the progress.
820  * @see OH_Udmf_ProgressInfo
821  * @since 15
822  */
823 int OH_UdmfProgressInfo_GetProgress(OH_Udmf_ProgressInfo* progressInfo);
824 
825 /**
826  * @brief Gets the status from the {@OH_Udmf_ProgressInfo}.
827  *
828  * @param progressInfo Represents a pointer to an instance of {@link OH_Udmf_ProgressInfo}.
829  * @return Returns the status code. See {@link Udmf_ListenerStatus}.
830  * @see OH_Udmf_ProgressInfo Udmf_ListenerStatus
831  * @since 15
832  */
833 int OH_UdmfProgressInfo_GetStatus(OH_Udmf_ProgressInfo* progressInfo);
834 
835 /**
836  * @brief Creation a pointer to the instance of the {@link OH_UdmfGetDataParams}.
837  *
838  * @return If the operation is successful, a pointer to the instance of the {@link OH_UdmfGetDataParams}
839  * structure is returned. If the operation is failed, nullptr is returned.
840  * @see OH_UdmfGetDataParams
841  * @since 15
842  */
843 OH_UdmfGetDataParams* OH_UdmfGetDataParams_Create();
844 
845 /**
846  * @brief Destroy a pointer that points to an instance of {@link OH_UdmfGetDataParams}.
847  *
848  * @param pThis Represents a pointer to an instance of {@link OH_UdmfGetDataParams}.
849  * @see OH_UdmfGetDataParams
850  * @since 15
851  */
852 void OH_UdmfGetDataParams_Destroy(OH_UdmfGetDataParams* pThis);
853 
854 /**
855  * @brief Sets the destination uri to the {@OH_UdmfGetDataParams}.
856  *
857  * @param params Represents a pointer to an instance of {@link OH_UdmfGetDataParams}.
858  * @param destUri Pointer to a destination uri.
859  * @see OH_UdmfGetDataParams
860  * @since 15
861  */
862 void OH_UdmfGetDataParams_SetDestUri(OH_UdmfGetDataParams* params, const char* destUri);
863 
864 /**
865  * @brief Sets the file conflict options to the {@OH_UdmfGetDataParams}.
866  *
867  * @param params Represents a pointer to an instance of {@link OH_UdmfGetDataParams}.
868  * @param options Represents to the file conflict options.
869  * @see OH_UdmfGetDataParams Udmf_FileConflictOptions
870  * @since 15
871  */
872 void OH_UdmfGetDataParams_SetFileConflictOptions(OH_UdmfGetDataParams* params, const Udmf_FileConflictOptions options);
873 
874 /**
875  * @brief Sets the progress indicator to the {@OH_UdmfGetDataParams}.
876  *
877  * @param params Represents a pointer to an instance of {@link OH_UdmfGetDataParams}.
878  * @param progressIndicator Represents to the progress indicator.
879  * @see OH_UdmfGetDataParams Udmf_ProgressIndicator
880  * @since 15
881  */
882 void OH_UdmfGetDataParams_SetProgressIndicator(OH_UdmfGetDataParams* params,
883     const Udmf_ProgressIndicator progressIndicator);
884 
885 /**
886  * @brief Sets the progress indicator to the {@OH_UdmfGetDataParams}.
887  *
888  * @param params Represents a pointer to an instance of {@link OH_UdmfGetDataParams}.
889  * @param dataProgressListener Represents to the data progress listener.
890  * @see OH_UdmfGetDataParams OH_Udmf_DataProgressListener
891  * @since 15
892  */
893 void OH_UdmfGetDataParams_SetDataProgressListener(OH_UdmfGetDataParams* params,
894     const OH_Udmf_DataProgressListener dataProgressListener);
895 
896 #ifdef __cplusplus
897 };
898 #endif
899 
900 /** @} */
901 #endif