• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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)21 bool 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     return true;
31 }
32 
Marshalling(Parcel & parcel) const33 bool InsightIntentExecuteResult::Marshalling(Parcel &parcel) const
34 {
35     if (!parcel.WriteInt32(innerErr)) {
36         return false;
37     }
38     if (!parcel.WriteInt32(code)) {
39         return false;
40     }
41     if (!parcel.WriteParcelable(result.get())) {
42         return false;
43     }
44     if (!parcel.WriteStringVector(uris)) {
45         return false;
46     }
47     if (!parcel.WriteInt32(flags)) {
48         return false;
49     }
50     return true;
51 }
52 
Unmarshalling(Parcel & parcel)53 InsightIntentExecuteResult *InsightIntentExecuteResult::Unmarshalling(Parcel &parcel)
54 {
55     auto res = new (std::nothrow) InsightIntentExecuteResult();
56     if (res == nullptr) {
57         return nullptr;
58     }
59 
60     if (!res->ReadFromParcel(parcel)) {
61         delete res;
62         res = nullptr;
63     }
64     return res;
65 }
66 
CheckResult(std::shared_ptr<const WantParams> result)67 bool InsightIntentExecuteResult::CheckResult(std::shared_ptr<const WantParams> result)
68 {
69     return true;
70 }
71 } // namespace AppExecFwk
72 } // namespace OHOS
73