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 PASTE_DATA_IMPL_H 17 #define PASTE_DATA_IMPL_H 18 19 #include "paste_data_record_impl.h" 20 #include "pasteboard_error.h" 21 22 namespace OHOS { 23 namespace MiscServicesCj { 24 class PasteDataImpl : public OHOS::FFI::FFIData { 25 public: 26 PasteDataImpl(); 27 explicit PasteDataImpl(std::shared_ptr<MiscServices::PasteData> pasteData); 28 PasteDataImpl(std::string mimeType, const CJValueType &value); 29 std::shared_ptr<MiscServices::PasteData> GetRealPasteData(); GetRuntimeType()30 OHOS::FFI::RuntimeType *GetRuntimeType() override 31 { 32 return GetClassType(); 33 } 34 35 private: 36 friend class OHOS::FFI::RuntimeType; 37 friend class OHOS::FFI::TypeBase; 38 static OHOS::FFI::RuntimeType *GetClassType(); 39 void CreateHtmlData(std::string mimeType, const CJValueType &value); 40 void CreatePlainTextData(std::string mimeType, const CJValueType &value); 41 void CreateUriData(std::string mimeType, const CJValueType &value); 42 void CreatePixelMapData(std::string mimeType, const CJValueType &value); 43 void CreateWantData(std::string mimeType, CJValueType value); 44 45 std::shared_ptr<MiscServices::PasteData> value_ = nullptr; 46 }; 47 48 int64_t CreateCjPasteDataObject(std::string mimeType, CJValueType value); 49 50 } // namespace MiscServicesCj 51 } // namespace OHOS 52 53 #endif