udmf.h
Overview
Defines the APIs, data structs, and enums for accessing the UDMF.
File to include: <database/udmf/udmf.h>
Library: libudmf.so
System capability: SystemCapability.DistributedDataManager.UDMF.Core
Since: 12
Related module: UDMF
Summary
Macros
| Name | Description |
|---|---|
| UDMF_KEY_BUFFER_LEN (512) | Minimum length of the buffer that holds the key (unique identifier) of a uniform data object. |
Types
| Name | Description |
|---|---|
| typedef enum Udmf_Intention Udmf_Intention | Defines an enum for UDMF data channel types. |
| typedef enum Udmf_ShareOption Udmf_ShareOption | Defines an enum for the scopes of the uniform data to be used on a device. |
| typedef struct OH_UdmfData OH_UdmfData | Defines a struct for a uniform data object. |
| typedef struct OH_UdmfRecord OH_UdmfRecord | Defines a struct for a data record in a uniform data object. |
| typedef struct OH_UdmfRecordProvider OH_UdmfRecordProvider | Defines a struct for the data record provider in a uniform data object. |
| typedef struct OH_UdmfProperty OH_UdmfProperty | Defines a struct for a data record property in a uniform data object. |
| typedef void(* UdmfData_Finalize) (void *context) | Defines a callback function used to release the context. This callback is invoked when the OH_UdmfRecordProvider instance is destroyed. |
| typedef void *(* OH_UdmfRecordProvider_GetData) (void *context, const char *type) | Defines a callback function used to obtain data by type. This callback is invoked when data is obtained from OH_UdmfRecord. It returns the data obtained. |
Enums
| Name | Description |
|---|---|
| Udmf_Intention { UDMF_INTENTION_DRAG, UDMF_INTENTION_PASTEBOARD } | Enumerates the UDMF data channel types. |
| Udmf_ShareOption { SHARE_OPTIONS_INVALID, SHARE_OPTIONS_IN_APP, SHARE_OPTIONS_CROSS_APP } | Enumerates the scopes of the uniform data to be used on a device. |
Functions
| Name | Description |
|---|---|
| int OH_UdmfRecord_AddContentForm (OH_UdmfRecord *pThis, OH_UdsContentForm *contentForm) | Adds data of the OH_UdsContentForm type to an OH_UdmfRecord instance. |
| int OH_UdmfRecord_GetContentForm (OH_UdmfRecord *pThis, OH_UdsContentForm *contentForm) | Obtains data of the OH_UdsContentForm type from an OH_UdmfRecord instance. |
| OH_UdmfData * OH_UdmfData_Create () | Creates an OH_UdmfData instance and a pointer to it. If this pointer is no longer required, use OH_UdmfData_Destroy to destroy it. Otherwise, memory leaks may occur. |
| void OH_UdmfData_Destroy (OH_UdmfData *pThis) | Destroys an OH_UdmfData instance. |
| int OH_UdmfData_AddRecord (OH_UdmfData *pThis, OH_UdmfRecord *record) | Adds an OH_UdmfRecord to an OH_UdmfData instance. |
| bool OH_UdmfData_HasType (OH_UdmfData *pThis, const char *type) | Checks whether the specified type exists in an OH_UdmfData instance. |
| char ** OH_UdmfData_GetTypes (OH_UdmfData *pThis, unsigned int *count) | Obtains all data types in an OH_UdmfData instance. |
| OH_UdmfRecord ** OH_UdmfData_GetRecords (OH_UdmfData *pThis, unsigned int *count) | Obtains all records contained in an OH_UdmfData instance. |
| OH_UdmfRecordProvider * OH_UdmfRecordProvider_Create () | Creates an OH_UdmfRecordProvider instance. If this pointer is no longer required, use OH_UdmfRecordProvider_Destroy to destroy it. Otherwise, memory leaks may occur. |
| int OH_UdmfRecordProvider_Destroy (OH_UdmfRecordProvider *provider) | Destroys an OH_UdmfRecordProvider instance. |
| int OH_UdmfRecordProvider_SetData (OH_UdmfRecordProvider *provider, void *context, const OH_UdmfRecordProvider_GetData callback, const UdmfData_Finalize finalize) | Sets a callback for an OH_UdmfRecordProvider instance to provide data. |
| OH_UdmfRecord * OH_UdmfRecord_Create () | Creates an OH_UdmfRecord instance and a pointer to it. If this pointer is no longer required, use OH_UdmfRecord_Destroy to destroy it. Otherwise, memory leaks may occur. |
| void OH_UdmfRecord_Destroy (OH_UdmfRecord *pThis) | Destroys an OH_UdmfRecord instance. |
| int OH_UdmfRecord_AddGeneralEntry (OH_UdmfRecord *pThis, const char *typeId, unsigned char *entry, unsigned int count) | Adds customized uniform data to an OH_UdmfRecord instance. |
| int OH_UdmfRecord_AddPlainText (OH_UdmfRecord *pThis, OH_UdsPlainText *plainText) | Adds data of the OH_UdsPlainText type to an OH_UdmfRecord instance. |
| int OH_UdmfRecord_AddHyperlink (OH_UdmfRecord *pThis, OH_UdsHyperlink *hyperlink) | Adds data of the hyperlink type OH_UdsHyperlink type to an OH_UdmfRecord instance. |
| int OH_UdmfRecord_AddHtml (OH_UdmfRecord *pThis, OH_UdsHtml *html) | Adds data of the OH_UdsHtml type to an OH_UdmfRecord instance. |
| int OH_UdmfRecord_AddAppItem (OH_UdmfRecord *pThis, OH_UdsAppItem *appItem) | Adds data of the OH_UdsAppItem type to an OH_UdmfRecord instance. |
| int OH_UdmfRecord_AddFileUri (OH_UdmfRecord *pThis, OH_UdsFileUri *fileUri) | Adds a data record of the OH_UdsFileUri type to an OH_UdmfRecord instance. |
| int OH_UdmfRecord_AddPixelMap (OH_UdmfRecord *pThis, OH_UdsPixelMap *pixelMap) | Adds a data record of the OH_UdsPixelMap type to an OH_UdmfRecord instance. |
| int OH_UdmfRecord_AddArrayBuffer (OH_UdmfRecord *record, const char *type, OH_UdsArrayBuffer *buffer) | Adds a data record of the OH_UdsArrayBuffer type to an OH_UdmfRecord instance. |
| char ** OH_UdmfRecord_GetTypes (OH_UdmfRecord *pThis, unsigned int *count) | Obtains all data types in an OH_UdmfRecord instance. |
| int OH_UdmfRecord_GetGeneralEntry (OH_UdmfRecord *pThis, const char *typeId, unsigned char **entry, unsigned int *count) | Obtains the data of the specified type in an OH_UdmfRecord instance. |
| int OH_UdmfRecord_GetPlainText (OH_UdmfRecord *pThis, OH_UdsPlainText *plainText) | Obtains OH_UdsPlainText data from an OH_UdmfRecord instance. |
| int OH_UdmfRecord_GetHyperlink (OH_UdmfRecord *pThis, OH_UdsHyperlink *hyperlink) | Obtains OH_UdsHyperlink data from an OH_UdmfRecord instance. |
| int OH_UdmfRecord_GetHtml (OH_UdmfRecord *pThis, OH_UdsHtml *html) | Obtains OH_UdsHtml data from an OH_UdmfRecord instance. |
| int OH_UdmfRecord_GetAppItem (OH_UdmfRecord *pThis, OH_UdsAppItem *appItem) | Obtains OH_UdsAppItem data from an OH_UdmfRecord instance. |
| int OH_UdmfRecord_SetProvider (OH_UdmfRecord *pThis, const char *const *types, unsigned int count, OH_UdmfRecordProvider *provider) | Sets the OH_UdmfRecordProvider in an OH_UdmfRecord instance. |
| int OH_UdmfRecord_GetFileUri (OH_UdmfRecord *pThis, OH_UdsFileUri *fileUri) | Obtains the OH_UdsFileUri data from an OH_UdmfRecord instance. |
| int OH_UdmfRecord_GetPixelMap (OH_UdmfRecord *pThis, OH_UdsPixelMap *pixelMap) | Obtains the OH_UdsPixelMap data from an OH_UdmfRecord instance. |
| int OH_UdmfRecord_GetArrayBuffer (OH_UdmfRecord *record, const char *type, OH_UdsArrayBuffer *buffer) | Obtains the OH_UdsArrayBuffer data from an OH_UdmfRecord instance. |
| int OH_UdmfData_GetPrimaryPlainText (OH_UdmfData *data, OH_UdsPlainText *plainText) | Obtains the first OH_UdsPlainText data from an OH_UdmfData instance. |
| int OH_UdmfData_GetPrimaryHtml (OH_UdmfData *data, OH_UdsHtml *html) | Obtains the first OH_UdsHtml data from an OH_UdmfData instance. |
| int OH_UdmfData_GetRecordCount (OH_UdmfData *data) | Obtains the number of data records contained in an OH_UdmfData instance. |
| OH_UdmfRecord * OH_UdmfData_GetRecord (OH_UdmfData *data, unsigned int index) | Obtains the specified data record from an OH_UdmfData instance. |
| bool OH_UdmfData_IsLocal (OH_UdmfData *data) | Checks whether an OH_UdmfData instance is from the local device. |
| OH_UdmfProperty * OH_UdmfProperty_Create (OH_UdmfData *unifiedData) | Creates an OH_UdmfProperty instance and a pointer to it. If this pointer is no longer required, use OH_UdmfProperty_Destroy to destroy it. Otherwise, memory leaks may occur. |
| void OH_UdmfProperty_Destroy (OH_UdmfProperty *pThis) | Destroys an OH_UdmfProperty instance. |
| const char * OH_UdmfProperty_GetTag (OH_UdmfProperty *pThis) | Obtains the custom tag value from an OH_UdmfProperty instance. |
| int64_t OH_UdmfProperty_GetTimestamp (OH_UdmfProperty *pThis) | Obtains the timestamp from an OH_UdmfProperty instance. |
| Udmf_ShareOptionOH_UdmfProperty_GetShareOption (OH_UdmfProperty *pThis) | Obtains the share option from an OH_UdmfProperty instance. |
| int OH_UdmfProperty_GetExtrasIntParam (OH_UdmfProperty *pThis, const char *key, int defaultValue) | Obtains the customized extra integer parameter from an OH_UdmfProperty instance. |
| const char * OH_UdmfProperty_GetExtrasStringParam (OH_UdmfProperty *pThis, const char *key) | Obtains the customized extra string parameter from an OH_UdmfProperty instance. |
| int OH_UdmfProperty_SetTag (OH_UdmfProperty *pThis, const char *tag) | Sets the tag value for an OH_UdmfProperty instance. |
| int OH_UdmfProperty_SetShareOption (OH_UdmfProperty *pThis, Udmf_ShareOption option) | Sets OH_Udmf_ShareOption for an OH_UdmfProperty instance. |
| int OH_UdmfProperty_SetExtrasIntParam (OH_UdmfProperty *pThis, const char *key, int param) | Sets the extra integer parameter for an OH_UdmfProperty instance. |
| int OH_UdmfProperty_SetExtrasStringParam (OH_UdmfProperty *pThis, const char *key, const char *param) | Sets the extra string parameter for an OH_UdmfProperty instance. |
| int OH_Udmf_GetUnifiedData (const char *key, Udmf_Intention intention, OH_UdmfData *unifiedData) | Obtains an OH_UdmfData instance from the UDMF database. |
| int OH_Udmf_SetUnifiedData (Udmf_Intention intention, OH_UdmfData *unifiedData, char *key, unsigned int keyLen) | Sets an OH_UdmfData instance in the UDMF database. |