• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "extension_load_param.h"
17 
18 namespace OHOS::AbilityRuntime {
Marshalling(Parcel & parcel) const19 bool ExtensionLoadParam::Marshalling(Parcel &parcel) const
20 {
21     if (!parcel.WriteBool(networkEnableFlags)) {
22         return false;
23     }
24     if (!parcel.WriteBool(saEnableFlags)) {
25         return false;
26     }
27     if (!parcel.WriteBool(strictMode)) {
28         return false;
29     }
30     return true;
31 }
32 
ReadFromParcel(Parcel & parcel)33 bool ExtensionLoadParam::ReadFromParcel(Parcel &parcel)
34 {
35     networkEnableFlags = parcel.ReadBool();
36     saEnableFlags = parcel.ReadBool();
37     strictMode = parcel.ReadBool();
38     return true;
39 }
40 
Unmarshalling(Parcel & parcel)41 ExtensionLoadParam *ExtensionLoadParam::Unmarshalling(Parcel &parcel)
42 {
43     ExtensionLoadParam *param = new (std::nothrow) ExtensionLoadParam();
44     if (param && !param->ReadFromParcel(parcel)) {
45         delete param;
46         param = nullptr;
47     }
48     return param;
49 }
50 }