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 #ifndef PASTEBOARD_FFI_H 17 #define PASTEBOARD_FFI_H 18 19 #include "paste_data_impl.h" 20 #include "system_pasteboard_impl.h" 21 22 extern "C" { 23 #define OUT_OF_RANGE 12900001 24 25 typedef struct { 26 CArrString mimeTypes; 27 char* tag; 28 int64_t timestamp; 29 bool localOnly; 30 int32_t shareOption; 31 } CPasteDataProperty; 32 33 typedef struct { 34 char* htmlText; 35 char* mimeType; 36 char* plainText; 37 char* uri; 38 int64_t pixelMap; 39 } CPasteDataRecord; 40 41 FFI_EXPORT RetDataI64 FfiOHOSCreateStringPasteData(const char* mimeType, const char* value); 42 FFI_EXPORT RetDataI64 FfiOHOSCreatePixelMapPasteData(const char* mimeType, int64_t pixelMapId); 43 FFI_EXPORT RetDataI64 FfiOHOSCreateArrayBufPasteData(const char* mimeType, uint8_t *buffPtr, int64_t bufferSize); 44 FFI_EXPORT RetDataI64 FfiOHOSCreateStringPasteDataRecord(const char* mimeType, const char* value, 45 CPasteDataRecord *retPtr); 46 FFI_EXPORT RetDataI64 FfiOHOSCreatePixelMapPasteDataRecord(const char* mimeType, int64_t pixelMapId, 47 CPasteDataRecord *retPtr); 48 FFI_EXPORT RetDataI64 FfiOHOSCreateArrayBufPasteDataRecord(const char* mimeType, uint8_t *buffPtr, 49 int64_t bufferSize, CPasteDataRecord *retPtr); 50 FFI_EXPORT RetDataCString FfiOHOSPasteDataRecordToPlainText(int64_t id); 51 FFI_EXPORT RetDataCString FfiOHOSPasteDataGetPrimaryText(int64_t id); 52 FFI_EXPORT RetDataCString FfiOHOSPasteDataGetPrimaryHtml(int64_t id); 53 FFI_EXPORT RetDataCString FfiOHOSPasteDataGetPrimaryUri(int64_t id); 54 FFI_EXPORT RetDataI64 FfiOHOSPasteDataGetPrimaryPixelMap(int64_t id); 55 FFI_EXPORT RetDataCString FfiOHOSPasteDataGetPrimaryMimeType(int64_t id); 56 FFI_EXPORT int32_t FfiOHOSPasteDataGetProperty(int64_t id, CPasteDataProperty *retPtr); 57 FFI_EXPORT int32_t FfiOHOSPasteDataSetProperty(int64_t id, CArrString mimeTypes, const char* tag, 58 int64_t timestamp, bool localOnly, int32_t shareOption); 59 FFI_EXPORT RetDataCString FfiOHOSPasteDataGetTag(int64_t id); 60 FFI_EXPORT RetDataBool FfiOHOSPasteDataHasType(int64_t id, const char* mimeTypes); 61 FFI_EXPORT int32_t FfiOHOSPasteDataAddRecord(int64_t id, int64_t recordId); 62 FFI_EXPORT int32_t FfiOHOSPasteDataAddMimeTypeRecord(int64_t id, const char* mimeType, const char* value); 63 FFI_EXPORT int32_t FfiOHOSPasteDataAddPixelMapRecord(int64_t id, const char* mimeType, int64_t pixelMapId); 64 FFI_EXPORT int32_t FfiOHOSPasteDataAddArrayRecord(int64_t id, const char* mimeType, uint8_t *buffPtr, 65 int64_t bufferSize); 66 FFI_EXPORT RetDataCArrString FfiOHOSPasteDataGetMimeTypes(int64_t id); 67 FFI_EXPORT RetDataI64 FfiOHOSPasteDataGetRecord(int64_t id, int32_t index, CPasteDataRecord *retPtr); 68 FFI_EXPORT RetDataUI FfiOHOSPasteDataGetRecordCount(int64_t id); 69 FFI_EXPORT int32_t FfiOHOSPasteDataRemoveRecord(int64_t id, int32_t index); 70 FFI_EXPORT int32_t FfiOHOSPasteDataReplaceRecord(int64_t id, int64_t recordId, int32_t index); 71 FFI_EXPORT RetDataI64 FfiOHOSGetSystemPasteboard(); 72 FFI_EXPORT int32_t FfiOHOSSystemPasteboardSetData(int64_t id, int64_t pasteDataId); 73 FFI_EXPORT RetDataI64 FfiOHOSSystemPasteboardGetData(int64_t id); 74 FFI_EXPORT RetDataBool FfiOHOSSystemPasteboardHasData(int64_t id); 75 FFI_EXPORT void FfiOHOSSystemPasteboardClearData(int64_t id); 76 FFI_EXPORT RetDataBool FfiOHOSSystemPasteboardIsRemoteData(int64_t id); 77 FFI_EXPORT RetDataBool FfiOHOSSystemPasteboardHasDataType(int64_t id, const char* mimeType); 78 FFI_EXPORT RetDataCString FfiOHOSSystemPasteboardGetDataSource(int64_t id); 79 } 80 81 #endif