1 /* 2 * Copyright (c) 2023 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 #include "insight_intent_execute_result.h" 17 18 namespace OHOS { 19 namespace AppExecFwk { 20 using WantParams = OHOS::AAFwk::WantParams; ReadFromParcel(Parcel & parcel)21bool InsightIntentExecuteResult::ReadFromParcel(Parcel &parcel) 22 { 23 innerErr = parcel.ReadInt32(); 24 code = parcel.ReadInt32(); 25 result = std::shared_ptr<WantParams>(parcel.ReadParcelable<WantParams>()); 26 return true; 27 } 28 Marshalling(Parcel & parcel) const29bool InsightIntentExecuteResult::Marshalling(Parcel &parcel) const 30 { 31 if (!parcel.WriteInt32(innerErr)) { 32 return false; 33 } 34 if (!parcel.WriteInt32(code)) { 35 return false; 36 } 37 if (!parcel.WriteParcelable(result.get())) { 38 return false; 39 } 40 return true; 41 } 42 Unmarshalling(Parcel & parcel)43InsightIntentExecuteResult *InsightIntentExecuteResult::Unmarshalling(Parcel &parcel) 44 { 45 auto res = new (std::nothrow) InsightIntentExecuteResult(); 46 if (res == nullptr) { 47 return nullptr; 48 } 49 50 if (!res->ReadFromParcel(parcel)) { 51 delete res; 52 res = nullptr; 53 } 54 return res; 55 } 56 CheckResult(std::shared_ptr<const WantParams> result)57bool InsightIntentExecuteResult::CheckResult(std::shared_ptr<const WantParams> result) 58 { 59 return true; 60 } 61 } // namespace AppExecFwk 62 } // namespace OHOS 63