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 #ifndef OH_PASTEBOARD_COMMON_H 16 #define OH_PASTEBOARD_COMMON_H 17 #include <cstdint> 18 #include <map> 19 #include "pasteboard_observer.h" 20 #include "oh_pasteboard.h" 21 #include "pasteboard_error.h" 22 #include "oh_pasteboard_err_code.h" 23 24 namespace OHOS { 25 namespace MiscServices { 26 static constexpr uint32_t MAX_MIMETYPES_NUM = 10000; 27 28 const std::map<PasteboardError, PASTEBOARD_ErrCode> errCodeMap = { 29 {PasteboardError::PERMISSION_VERIFICATION_ERROR, ERR_PERMISSION_ERROR}, 30 {PasteboardError::INVALID_PARAM_ERROR, ERR_INVALID_PARAMETER}, 31 {PasteboardError::TASK_PROCESSING, ERR_BUSY}, 32 }; 33 34 class PasteboardObserverCapiImpl; 35 } 36 } 37 38 enum PasteboardNdkStructId : std::int64_t { 39 SUBSCRIBER_STRUCT_ID = 1002950, 40 PASTEBOARD_STRUCT_ID, 41 }; 42 43 struct OH_Pasteboard { 44 const int64_t cid = PASTEBOARD_STRUCT_ID; 45 std::mutex mutex; 46 std::map<const OH_PasteboardObserver*, OHOS::sptr<OHOS::MiscServices::PasteboardObserverCapiImpl>> observers_; 47 std::vector<std::string> mimeTypes_; 48 char **mimeTypesPtr = nullptr; 49 }; 50 51 /** @} */ 52 #endif