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