oh_pasteboard.h
概述
提供访问系统剪贴板的接口、数据结构、枚举类型。
库: libpasteboard.so
引用文件: <database/pasteboard/oh_pasteboard.h>
系统能力: SystemCapability.MiscServices.Pasteboard
起始版本: 13
相关模块:Pasteboard
汇总
类型定义
| 名称 | 描述 |
|---|---|
| typedef enum Pasteboard_NotifyType Pasteboard_NotifyType | 剪贴板的数据变更类型。 |
| typedef void(* Pasteboard_Notify) (void *context, Pasteboard_NotifyType type) | 定义剪贴板内容变更时触发的回调函数。 |
| typedef void(* Pasteboard_Finalize) (void *context) | 定义用于释放上下文的回调函数,剪贴板数据变更观察者对象销毁时触发。 |
| typedef struct OH_PasteboardObserver OH_PasteboardObserver | 定义剪贴板数据变更观察者。 |
| typedef struct OH_Pasteboard OH_Pasteboard | 定义剪贴板对象,用以操作系统剪贴板。 |
枚举
| 名称 | 描述 |
|---|---|
| Pasteboard_NotifyType { NOTIFY_LOCAL_DATA_CHANGE = 1, NOTIFY_REMOTE_DATA_CHANGE = 2 } | 剪贴板的数据变更类型。 |
函数
| 名称 | 描述 |
|---|---|
| OH_PasteboardObserver * OH_PasteboardObserver_Create () | 创建一个剪贴板数据变更观察者OH_PasteboardObserver指针及实例对象。 |
| int OH_PasteboardObserver_Destroy (OH_PasteboardObserver *observer) | 销毁剪贴板数据变更观察者OH_PasteboardObserver指针指向的实例对象。 |
| int OH_PasteboardObserver_SetData (OH_PasteboardObserver *observer, void *context, const Pasteboard_Notify callback, const Pasteboard_Finalize finalize) | 向剪贴板数据变更观察者设置回调函数。 |
| OH_Pasteboard * OH_Pasteboard_Create () | 创建剪贴板OH_Pasteboard指针及实例对象。 |
| void OH_Pasteboard_Destroy (OH_Pasteboard *pasteboard) | 销毁剪贴板OH_Pasteboard实例对象。 |
| int OH_Pasteboard_Subscribe (OH_Pasteboard *pasteboard, int type, const OH_PasteboardObserver *observer) | 订阅剪贴板的数据变更事件。 |
| int OH_Pasteboard_Unsubscribe (OH_Pasteboard *pasteboard, int type, const OH_PasteboardObserver *observer) | 取消对剪贴板数据变更事件的订阅。 |
| bool OH_Pasteboard_IsRemoteData (OH_Pasteboard *pasteboard) | 判断剪贴板中的数据是否来自远端设备。 |
| int OH_Pasteboard_GetDataSource (OH_Pasteboard *pasteboard, char *source, unsigned int len) | 获取剪贴板中数据的数据源。 |
| bool OH_Pasteboard_HasType (OH_Pasteboard *pasteboard, const char *type) | 判断剪贴板中是否有指定类型的数据。 |
| bool OH_Pasteboard_HasData (OH_Pasteboard *pasteboard) | 判断剪贴板中是否有数据。 |
| OH_UdmfData * OH_Pasteboard_GetData (OH_Pasteboard *pasteboard, int *status) | 获取剪贴板中的数据。 |
| int OH_Pasteboard_SetData (OH_Pasteboard *pasteboard, OH_UdmfData *data) | 将统一数据对象数据写入剪贴板。 |
| int OH_Pasteboard_ClearData (OH_Pasteboard *pasteboard) | 清空剪贴板中的数据。 |
| char ** OH_Pasteboard_GetMimeTypes (OH_Pasteboard *pasteboard, unsigned int *count) | 获取剪切板中的MIME类型。 |