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 if (!parcel.ReadStringVector(&uris)) { 27 return false; 28 } 29 flags = parcel.ReadInt32(); 30 isDecorator = parcel.ReadBool(); 31 return true; 32 } 33 Marshalling(Parcel & parcel) const34bool InsightIntentExecuteResult::Marshalling(Parcel &parcel) const 35 { 36 if (!parcel.WriteInt32(innerErr)) { 37 return false; 38 } 39 if (!parcel.WriteInt32(code)) { 40 return false; 41 } 42 if (!parcel.WriteParcelable(result.get())) { 43 return false; 44 } 45 if (!parcel.WriteStringVector(uris)) { 46 return false; 47 } 48 if (!parcel.WriteInt32(flags)) { 49 return false; 50 } 51 if (!parcel.WriteBool(isDecorator)) { 52 return false; 53 } 54 return true; 55 } 56 Unmarshalling(Parcel & parcel)57InsightIntentExecuteResult *InsightIntentExecuteResult::Unmarshalling(Parcel &parcel) 58 { 59 auto res = new (std::nothrow) InsightIntentExecuteResult(); 60 if (res == nullptr) { 61 return nullptr; 62 } 63 64 if (!res->ReadFromParcel(parcel)) { 65 delete res; 66 res = nullptr; 67 } 68 return res; 69 } 70 CheckResult(std::shared_ptr<const WantParams> result)71bool InsightIntentExecuteResult::CheckResult(std::shared_ptr<const WantParams> result) 72 { 73 return true; 74 } 75 } // namespace AppExecFwk 76 } // namespace OHOS 77