• 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 Describes the unified data type.
95  *
96  * @since 12
97  */
98 typedef struct OH_UdmfData OH_UdmfData;
99 
100 /**
101  * @brief Describes the record type in the unified data.
102  *
103  * @since 12
104  */
105 typedef struct OH_UdmfRecord OH_UdmfRecord;
106 
107 /**
108  * @brief Defines the data provider.
109  *
110  * @since 13
111  */
112 typedef struct OH_UdmfRecordProvider OH_UdmfRecordProvider;
113 
114 /**
115  * @brief Describes some property parameters of unified data.
116  *
117  * @since 12
118  */
119 typedef struct OH_UdmfProperty OH_UdmfProperty;
120 
121 /**
122  * @brief Creation a pointer to the instance of the {@link OH_UdmfData}.
123  *
124  * @return If the operation is successful, a pointer to the instance of the {@link OH_UdmfData}
125  * structure is returned. If the operation is failed, nullptr is returned.
126  * @see OH_UdmfData.
127  * @since 12
128  */
129 OH_UdmfData* OH_UdmfData_Create();
130 
131 /**
132  * @brief Destroy a pointer that points to the {@link OH_UdmfData} instance.
133  *
134  * @param pThis Represents a pointer to an instance of {@link OH_UdmfData}.
135  * @see OH_UdmfData.
136  * @since 12
137  */
138 void OH_UdmfData_Destroy(OH_UdmfData* pThis);
139 
140 /**
141  * @brief Add one {OH_UdmfRecord} record to the {@link OH_UdmfData} data.
142  *
143  * @param pThis Represents a pointer to an instance of {@link OH_UdmfData}.
144  * @param record Represents a pointer to an instance of {@link OH_UdmfRecord}.
145  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
146  *         {@link UDMF_E_OK} success.
147  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
148  * @see OH_UdmfData Udmf_ErrCode.
149  * @since 12
150  */
151 int OH_UdmfData_AddRecord(OH_UdmfData* pThis, OH_UdmfRecord* record);
152 
153 /**
154  * @brief Check whether the type exists in the {@link OH_UdmfData} data.
155  *
156  * @param pThis Represents a pointer to an instance of {@link OH_UdmfData}.
157  * @param type Represents a string pointer of the type.
158  * @return Returns the status of finding type.
159  *         {@code false} is not existed.
160  *         {@code true} is existed.
161  * @see OH_UdmfData.
162  * @since 12
163  */
164 bool OH_UdmfData_HasType(OH_UdmfData* pThis, const char* type);
165 
166 /**
167  * @brief Get all types in the {@link OH_UdmfData} data.
168  *
169  * @param pThis Represents a pointer to an instance of {@link OH_UdmfData}.
170  * @param count Represents the types count that is a output param.
171  * @return Returns string array that in {@link OH_UdmfData} when input parameters valid,
172  * otherwise return nullptr.
173  * @see OH_UdmfData.
174  * @since 12
175  */
176 char** OH_UdmfData_GetTypes(OH_UdmfData* pThis, unsigned int* count);
177 
178 /**
179  * @brief Get all records in the {@link OH_UdmfData} data.
180  *
181  * @param pThis Represents a pointer to an instance of {@link OH_UdmfData}.
182  * @param count Represents the records count that is a output param.
183  * @return Returns {@link OH_UdmfRecord} pointer array when input parameters valid, otherwise return nullptr.
184  * @see OH_UdmfData OH_UdmfRecord.
185  * @since 12
186  */
187 OH_UdmfRecord** OH_UdmfData_GetRecords(OH_UdmfData* pThis, unsigned int* count);
188 
189 /**
190  * @brief Defines the callback function used free the context.
191  * @param context Pointer to the context which is to be free.
192  * @since 13
193  */
194 typedef void (*UdmfData_Finalize)(void* context);
195 
196 /**
197  * @brief Creates an {@link OH_UdmfRecordProvider} instance.
198  *
199  * @return Returns the pointer to the {@link OH_UdmfRecordProvider} instance created if the operation is successful.
200  * Returns nullptr if the memory is not enough.
201  * @see OH_UdmfRecordProvider.
202  * @since 13
203  */
204 OH_UdmfRecordProvider* OH_UdmfRecordProvider_Create();
205 
206 /**
207  * @brief Destroy an {@link OH_UdmfRecordProvider} instance.
208  *
209  * @param subscriber Pointer to the {@link OH_UdmfRecordProvider} instance to destroy.
210  * @return Returns the status code of the execution. For details, see {@link Udmf_ErrCode}.
211  *         Returns {@link UDMF_E_OK} if the operation is successful.
212  *         Returns {@link UDMF_E_INVALID_PARAM} if invalid args are detected.
213  * @see OH_UdmfRecordProvider Udmf_ErrCode.
214  * @since 13
215  */
216 int OH_UdmfRecordProvider_Destroy(OH_UdmfRecordProvider* provider);
217 
218 /**
219  * @brief Defines a callback function used to obtain data by type.
220  *
221  * @param context Pointer to the context set by {@link OH_UdmfRecordProvider_SetData}.
222  * @param type Pointer to the type of data to obtain. For details, see {@link udmf_meta.h}.
223  * @return Returns the data content.
224  * @since 13
225  */
226 typedef void* (*OH_UdmfRecordProvider_GetData)(void* context, const char* type);
227 
228 /**
229  * @brief Sets a callback function to obtain data.
230  *
231  * @param provider Pointer to the {@link OH_UdmfRecordProvider} instance.
232  * @param context Pointer to the context set, which is the first parameter in OH_UdmfRecordProvider_GetData.
233  * @param callback Callback to set. For details, see {@link OH_UdmfRecordProvider_GetData}.
234  * @param finalize Optional callback that can free context when destroy provider.
235  *         For details, see {@link UdmfData_Finalize}.
236  * @return Returns the status code of the execution. For details, see {@link Udmf_ErrCode}.
237  *         Returns {@link UDMF_E_OK} if the operation is successful.
238  *         Returns {@link UDMF_E_INVALID_PARAM} if invalid args are detected.
239  * @see OH_UdmfRecordProvider OH_UdmfRecordProvider_GetData UdmfData_Finalize Udmf_ErrCode.
240  * @since 13
241  */
242 int OH_UdmfRecordProvider_SetData(OH_UdmfRecordProvider* provider, void* context,
243     const OH_UdmfRecordProvider_GetData callback, const UdmfData_Finalize finalize);
244 
245 /**
246  * @brief Get primary {@link OH_UdsPlainText} data from the {@link OH_UdmfData}.
247  *
248  * @param data Represents a pointer to an instance of {@link OH_UdmfData}.
249  * @param plainText Represents a pointer to an instance of {@link OH_UdsPlainText}.
250  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
251  *         {@link UDMF_E_OK} success.
252  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
253  * @see OH_UdmfData OH_UdsPlainText Udmf_ErrCode.
254  * @since 13
255  */
256 int OH_UdmfData_GetPrimaryPlainText(OH_UdmfData* data, OH_UdsPlainText* plainText);
257 
258 /**
259  * @brief Get one {@link OH_UdsHtml} data from the {@link OH_UdmfData}.
260  *
261  * @param data Represents a pointer to an instance of {@link OH_UdmfData}.
262  * @param html Represents a pointer to an instance of {@link OH_UdsHtml}.
263  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
264  *         {@link UDMF_E_OK} success.
265  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
266  * @see OH_UdmfData OH_UdsHtml Udmf_ErrCode.
267  * @since 13
268  */
269 int OH_UdmfData_GetPrimaryHtml(OH_UdmfData* data, OH_UdsHtml* html);
270 
271 /**
272  * @brief Get the count of {@link OH_UdmfRecord} in the {@link OH_UdmfData}.
273  *
274  * @param data Represents a pointer to an instance of {@link OH_UdmfData}.
275  * @return Returns the count of {@link OH_UdmfRecord}
276  * @see OH_UdmfData.
277  * @since 13
278  */
279 int OH_UdmfData_GetRecordCount(OH_UdmfData* data);
280 
281 /**
282  * @brief Get the record of the specified index from the {@link OH_UdmfData}.
283  *
284  * @param data Represents a pointer to an instance of {@link OH_UdmfData}.
285  * @param index Represents the index of {@link OH_UdmfRecord} in the {@link OH_UdmfData}.
286  * @return Returns the count of {@link OH_UdmfRecord}
287  * @see OH_UdmfData.
288  * @since 13
289  */
290 OH_UdmfRecord* OH_UdmfData_GetRecord(OH_UdmfData* data, unsigned int index);
291 
292 /**
293  * @brief Checks whether the UDMF data is from a local device.
294  *
295  * @param data Represents a pointer to an instance of {@link OH_UdmfData}.
296  * @return Returns the count of {@link OH_UdmfRecord}
297  * @see OH_UdmfData.
298  * @since 13
299  */
300 bool OH_UdmfData_IsLocal(OH_UdmfData* data);
301 
302 /**
303  * @brief Creation a pointer to the instance of the {@link OH_UdmfRecord}, it's relate with UDS data.
304  *
305  * @return If the operation is successful, a pointer to the instance of the {@link OH_UdmfRecord}
306  * structure is returned. If the operation is failed, nullptr is returned.
307  * @see OH_UdmfRecord.
308  * @since 12
309  */
310 OH_UdmfRecord* OH_UdmfRecord_Create();
311 
312 /**
313  * @brief Destroy a pointer that points to an instance of {@link OH_UdmfRecord}.
314  *
315  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
316  * @see OH_UdmfRecord.
317  * @since 12
318  */
319 void OH_UdmfRecord_Destroy(OH_UdmfRecord* pThis);
320 
321 /**
322  * @brief Add one custom data to the {@link OH_UdmfRecord} record.
323  *
324  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
325  * @param typeId Represents record type, reference udmf_meta.h.
326  * @param entry Represents custom data.
327  * @param count Represents the size of data param.
328  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
329  *         {@link UDMF_E_OK} success.
330  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
331  * @see OH_UdmfRecord Udmf_ErrCode.
332  * @since 12
333  */
334 int OH_UdmfRecord_AddGeneralEntry(OH_UdmfRecord* record, const char* typeId,
335                                   const unsigned char* entry, unsigned int count);
336 
337 /**
338  * @brief Add one {OH_UdsPlainText} data to the {@link OH_UdmfRecord} record.
339  *
340  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
341  * @param plainText Represents a pointer to an instance of {@link OH_UdsPlainText}.
342  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
343  *         {@link UDMF_E_OK} success.
344  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
345  * @see OH_UdmfRecord OH_UdsPlainText Udmf_ErrCode.
346  * @since 12
347  */
348 int OH_UdmfRecord_AddPlainText(OH_UdmfRecord* pThis, OH_UdsPlainText* plainText);
349 
350 /**
351  * @brief Add one {OH_UdsHyperlink} data to the {@link OH_UdmfRecord} record.
352  *
353  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
354  * @param hyperlink Represents a pointer to an instance of {@link OH_UdsHyperlink}.
355  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
356  *         {@link UDMF_E_OK} success.
357  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
358  * @see OH_UdmfRecord OH_UdsHyperlink Udmf_ErrCode.
359  * @since 12
360  */
361 int OH_UdmfRecord_AddHyperlink(OH_UdmfRecord* pThis, OH_UdsHyperlink* hyperlink);
362 
363 /**
364  * @brief Add one {OH_UdsHtml} data to the {@link OH_UdmfRecord} record.
365  *
366  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
367  * @param html Represents a pointer to an instance of {@link OH_UdsHtml}.
368  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
369  *         {@link UDMF_E_OK} success.
370  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
371  * @see OH_UdmfRecord OH_UdsHtml Udmf_ErrCode.
372  * @since 12
373  */
374 int OH_UdmfRecord_AddHtml(OH_UdmfRecord* pThis, OH_UdsHtml* html);
375 
376 /**
377  * @brief Add one {OH_UdsAppItem} data to the {@link OH_UdmfRecord} record.
378  *
379  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
380  * @param appItem Represents a pointer to an instance of {@link OH_UdsAppItem}.
381  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
382  *         {@link UDMF_E_OK} success.
383  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
384  * @see OH_UdmfRecord OH_UdsAppItem Udmf_ErrCode.
385  * @since 12
386  */
387 int OH_UdmfRecord_AddAppItem(OH_UdmfRecord* pThis, OH_UdsAppItem* appItem);
388 
389 /**
390  * @brief Add one {OH_UdsFileUri} data to the {@link OH_UdmfRecord} record.
391  *
392  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
393  * @param fileUri Represents a pointer to an instance of {@link OH_UdsFileUri}.
394  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
395  *         {@link UDMF_E_OK} success.
396  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
397  * @see OH_UdmfRecord OH_UdsFileUri Udmf_ErrCode.
398  * @since 13
399  */
400 int OH_UdmfRecord_AddFileUri(OH_UdmfRecord* pThis, OH_UdsFileUri* fileUri);
401 
402 /**
403  * @brief Add one {OH_UdsPixelMap} data to the {@link OH_UdmfRecord} record.
404  *
405  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
406  * @param pixelMap Represents a pointer to an instance of {@link OH_UdsPixelMap}.
407  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
408  *         {@link UDMF_E_OK} success.
409  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
410  * @see OH_UdmfRecord OH_UdsPixelMap Udmf_ErrCode.
411  * @since 13
412  */
413 int OH_UdmfRecord_AddPixelMap(OH_UdmfRecord* pThis, OH_UdsPixelMap* pixelMap);
414 
415 /**
416  * @brief Add one {@link OH_UdsArrayBuffer} data to the {@link OH_UdmfRecord} record.
417  *
418  * @param record Represents a pointer to an instance of {@link OH_UdmfRecord}.
419  * @param type Represents record type, reference udmf_meta.h.
420  * @param buffer Represents a pointer to an instance of {@link OH_UdsArrayBuffer}.
421  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
422  *         {@link UDMF_E_OK} success.
423  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
424  * @see OH_UdmfRecord OH_UdsArrayBuffer Udmf_ErrCode.
425  * @since 13
426  */
427 int OH_UdmfRecord_AddArrayBuffer(OH_UdmfRecord* record, const char* type, OH_UdsArrayBuffer* buffer);
428 
429 /**
430  * @brief Get all types in the {@link OH_UdmfRecord} record.
431  *
432  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
433  * @param count Represents the types count that is a output param.
434  * @return Returns string array that in {@link OH_UdmfRecord} when input parameters valid,
435  * otherwise return nullptr.
436  * @see OH_UdmfRecord.
437  * @since 12
438  */
439 char** OH_UdmfRecord_GetTypes(OH_UdmfRecord* pThis, unsigned int* count);
440 
441 /**
442  * @brief Get one entry data from the {@link OH_UdmfRecord} record.
443  *
444  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
445  * @param typeId Represents record type, reference udmf_meta.h.
446  * @param entry Represents a pointer to entry data that is a output param.
447  * @param count Represents the entry data length that is a output param.
448  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
449  *         {@link UDMF_E_OK} success.
450  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
451  * @see OH_UdmfRecord Udmf_ErrCode.
452  * @since 12
453  */
454 int OH_UdmfRecord_GetGeneralEntry(OH_UdmfRecord* pThis, const char* typeId,
455     unsigned char** entry, unsigned int* count);
456 
457 /**
458  * @brief Get one {OH_UdsPlainText} data from the {@link OH_UdmfRecord} record.
459  *
460  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
461  * @param plainText Represents a pointer to an instance of {@link OH_UdsPlainText}.
462  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
463  *         {@link UDMF_E_OK} success.
464  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
465  * @see OH_UdmfRecord OH_UdsPlainText Udmf_ErrCode.
466  * @since 12
467  */
468 int OH_UdmfRecord_GetPlainText(OH_UdmfRecord* pThis, OH_UdsPlainText* plainText);
469 
470 /**
471  * @brief Get one {OH_UdsHyperlink} data from the {@link OH_UdmfRecord} record.
472  *
473  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
474  * @param hyperlink Represents a pointer to an instance of {@link OH_UdsHyperlink}.
475  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
476  *         {@link UDMF_E_OK} success.
477  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
478  * @see OH_UdmfRecord OH_UdsHyperlink Udmf_ErrCode.
479  * @since 12
480  */
481 int OH_UdmfRecord_GetHyperlink(OH_UdmfRecord* pThis, OH_UdsHyperlink* hyperlink);
482 
483 /**
484  * @brief Get one {OH_UdsHtml} data from the {@link OH_UdmfRecord} record.
485  *
486  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
487  * @param html Represents a pointer to an instance of {@link OH_UdsHtml}.
488  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
489  *         {@link UDMF_E_OK} success.
490  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
491  * @see OH_UdmfRecord OH_UdsHtml Udmf_ErrCode.
492  * @since 12
493  */
494 int OH_UdmfRecord_GetHtml(OH_UdmfRecord* pThis, OH_UdsHtml* html);
495 
496 /**
497  * @brief Get one {OH_UdsAppItem} data from the {@link OH_UdmfRecord} record.
498  *
499  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
500  * @param appItem Represents a pointer to an instance of {@link OH_UdsAppItem}.
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  * @see OH_UdmfRecord OH_UdsAppItem Udmf_ErrCode.
505  * @since 12
506  */
507 int OH_UdmfRecord_GetAppItem(OH_UdmfRecord* pThis, OH_UdsAppItem* appItem);
508 
509 /**
510  * @brief Get one {OH_UdsFileUri} data from the {@link OH_UdmfRecord} record.
511  *
512  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
513  * @param fileUri Represents a pointer to an instance of {@link OH_UdsFileUri}.
514  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
515  *         {@link UDMF_E_OK} success.
516  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
517  * @see OH_UdmfRecord OH_UdsFileUri Udmf_ErrCode.
518  * @since 13
519  */
520 int OH_UdmfRecord_GetFileUri(OH_UdmfRecord* pThis, OH_UdsFileUri* fileUri);
521 
522 /**
523  * @brief Get one {OH_UdsPixelMap} data from the {@link OH_UdmfRecord} record.
524  *
525  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
526  * @param pixelMap Represents a pointer to an instance of {@link OH_UdsPixelMap}.
527  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
528  *         {@link UDMF_E_OK} success.
529  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
530  * @see OH_UdmfRecord OH_UdsPixelMap Udmf_ErrCode.
531  * @since 13
532  */
533 int OH_UdmfRecord_GetPixelMap(OH_UdmfRecord* pThis, OH_UdsPixelMap* pixelMap);
534 
535 /**
536  * @brief Set the data provider of the types.
537  *
538  * @param pThis Represents a pointer to an instance of {@link OH_UdmfRecord}.
539  * @param types Represents a pointer to a group of data types;
540  * @param count Represents the number of data types;
541  * @param provider Represents a pointer an instance of {@link OH_UdmfRecordProvider}.
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_UdmfRecordProvider Udmf_ErrCode.
546  * @since 13
547  */
548 int OH_UdmfRecord_SetProvider(OH_UdmfRecord* pThis, const char* const* types, unsigned int count,
549     OH_UdmfRecordProvider* provider);
550 
551 /**
552  * @brief Get one {@link OH_UdsArrayBuffer} data from the {@link OH_UdmfRecord} record.
553  *
554  * @param record Represents a pointer to an instance of {@link OH_UdmfRecord}.
555  * @param type Represents record type, reference udmf_meta.h.
556  * @param buffer Represents a pointer to an instance of {@link OH_UdsArrayBuffer}.
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_UdsArrayBuffer Udmf_ErrCode.
561  * @since 13
562  */
563 int OH_UdmfRecord_GetArrayBuffer(OH_UdmfRecord* record, const char* type, OH_UdsArrayBuffer* buffer);
564 
565 /**
566  * @brief Creation a pointer to the instance of the {@link OH_UdmfProperty}
567  * from a {@link OH_UdmfData} data.
568  *
569  * @param unifiedData Represents a pointer to an instance of {@link OH_UdmfData}.
570  * @return If the operation is successful, a pointer to the instance of the {@link OH_UdmfProperty}
571  * structure is returned. If the operation is failed, nullptr is returned.
572  * @see OH_UdmfData OH_UdmfProperty.
573  * @since 12
574  */
575 OH_UdmfProperty* OH_UdmfProperty_Create(OH_UdmfData* unifiedData);
576 
577 /**
578  * @brief Destroy a pointer that points to the {@link OH_UdmfProperty} instance.
579  *
580  * @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
581  * @see OH_UdmfProperty.
582  * @since 12
583  */
584 void OH_UdmfProperty_Destroy(OH_UdmfProperty* pThis);
585 
586 /**
587  * @brief Get tag value from the {@link OH_UdmfProperty}.
588  *
589  * @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
590  * @return Returns a pointer of the tag value string when input parameters valid, otherwise return nullptr.
591  * @see OH_UdmfProperty.
592  * @since 12
593  */
594 const char* OH_UdmfProperty_GetTag(OH_UdmfProperty* pThis);
595 
596 /**
597  * @brief Get timestamp value from the {@link OH_UdmfProperty}.
598  *
599  * @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
600  * @return Returns timestamp value.
601  * @see OH_UdmfProperty
602  * @since 12
603  */
604 int64_t OH_UdmfProperty_GetTimestamp(OH_UdmfProperty* pThis);
605 
606 /**
607  * @brief Get share option value from the {@link OH_UdmfProperty}.
608  *
609  * @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
610  * @return Returns {@link Udmf_ShareOption} value.
611  * @see OH_UdmfProperty Udmf_ShareOption
612  * @since 12
613  */
614 Udmf_ShareOption OH_UdmfProperty_GetShareOption(OH_UdmfProperty* pThis);
615 
616 /**
617  * @brief Get integer value by key from the {@link OH_UdmfProperty}.
618  *
619  * @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
620  * @param key Represents key-value pair's key
621  * @param defaultValue Represents when get value failure.
622  * @return Returns value associated with the key in successfully, otherwise return defaultValue.
623  * @see OH_UdmfProperty.
624  * @since 12
625  */
626 int OH_UdmfProperty_GetExtrasIntParam(OH_UdmfProperty* pThis,
627     const char* key, int defaultValue);
628 
629 /**
630  * @brief Get tag value from the {@link OH_UdmfProperty}.
631  *
632  * @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
633  * @param key Represents key-value pair's key.
634  * @return Returns a pointer of the key value string when input parameters valid, otherwise return nullptr.
635  * @see OH_UdmfProperty
636  * @since 12
637  */
638 const char* OH_UdmfProperty_GetExtrasStringParam(OH_UdmfProperty* pThis, const char* key);
639 
640 /**
641  * @brief Set tag value to {@link OH_UdmfProperty} .
642  *
643  * @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
644  * @param tag Represents new tag param.
645  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
646  *         {@link UDMF_E_OK} success.
647  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
648  * @see OH_UdmfProperty Udmf_ErrCode.
649  * @since 12
650  */
651 int OH_UdmfProperty_SetTag(OH_UdmfProperty* pThis, const char* tag);
652 
653 /**
654  * @brief Set Udmf_ShareOption value to {@link OH_UdmfProperty}.
655  *
656  * @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
657  * @param option Represents new {@link Udmf_ShareOption} param.
658  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
659  *         {@link UDMF_E_OK} success.
660  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
661  * @see OH_UdmfProperty Udmf_ShareOption Udmf_ErrCode.
662  * @since 12
663  */
664 int OH_UdmfProperty_SetShareOption(OH_UdmfProperty* pThis, Udmf_ShareOption option);
665 
666 /**
667  * @brief Set extras param to {@link OH_UdmfProperty}.
668  *
669  * @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
670  * @param key Represents extras param's key value.
671  * @param param Represents value of k-v pairs.
672  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
673  *         {@link UDMF_E_OK} success.
674  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
675  * @see OH_UdmfProperty Udmf_ErrCode.
676  * @since 12
677  */
678 int OH_UdmfProperty_SetExtrasIntParam(OH_UdmfProperty* pThis, const char* key, int param);
679 
680 /**
681  * @brief Set extras param to {@link OH_UdmfProperty}.
682  *
683  * @param pThis Represents a pointer to an instance of {@link OH_UdmfProperty}.
684  * @param key Represents extras param's key value.
685  * @param param Represents value of k-v pairs.
686  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
687  *         {@link UDMF_E_OK} success.
688  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
689  * @see OH_UdmfProperty Udmf_ErrCode.
690  * @since 12
691  */
692 int OH_UdmfProperty_SetExtrasStringParam(OH_UdmfProperty* pThis,
693     const char* key, const char* param);
694 
695 /**
696  * @brief Get {@link OH_UdmfData} data from udmf database.
697  *
698  * @param key Represents database store's key value.
699  * @param intention Represents data type {@link Udmf_Intention}
700  * @param unifiedData Represents output params of {@link OH_UdmfData};
701  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
702  *         {@link UDMF_E_OK} success.
703  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
704  * @see OH_UdmfProperty Udmf_Intention Udmf_ErrCode.
705  * @since 12
706  */
707 int OH_Udmf_GetUnifiedData(const char* key, Udmf_Intention intention, OH_UdmfData* unifiedData);
708 
709 /**
710  * @brief Set {@link OH_UdmfData} data to database.
711  *
712  * @param intention Represents data type {@link Udmf_Intention}.
713  * @param unifiedData Represents a pointer to an instance of {@link OH_UdmfData}.
714  * @param key Represents return value after set data to database successfully,
715  * it's memory size not less than {@link UDMF_KEY_BUFFER_LEN}.
716  * @param keyLen Represents size of key param.
717  * @return Returns the status code of the execution. See {@link Udmf_ErrCode}.
718  *         {@link UDMF_E_OK} success.
719  *         {@link UDMF_E_INVALID_PARAM} The error code for common invalid args.
720  * @see OH_UdmfProperty Udmf_Intention Udmf_ErrCode.
721  * @since 12
722  */
723 int OH_Udmf_SetUnifiedData(Udmf_Intention intention, OH_UdmfData* unifiedData,
724     char* key, unsigned int keyLen);
725 
726 #ifdef __cplusplus
727 };
728 #endif
729 
730 /** @} */
731 #endif
732