1 /* 2 * Copyright (c) 2021 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 "start_options.h" 17 18 namespace OHOS { 19 namespace AAFwk { StartOptions(const StartOptions & other)20StartOptions::StartOptions(const StartOptions &other) 21 { 22 windowMode_ = other.windowMode_; 23 displayId_ = other.displayId_; 24 } 25 operator =(const StartOptions & other)26StartOptions &StartOptions::operator=(const StartOptions &other) 27 { 28 if (this != &other) { 29 windowMode_ = other.windowMode_; 30 displayId_ = other.displayId_; 31 } 32 return *this; 33 } 34 ReadFromParcel(Parcel & parcel)35bool StartOptions::ReadFromParcel(Parcel &parcel) 36 { 37 SetWindowMode(parcel.ReadInt32()); 38 SetDisplayID(parcel.ReadInt32()); 39 return true; 40 } 41 Unmarshalling(Parcel & parcel)42StartOptions *StartOptions::Unmarshalling(Parcel &parcel) 43 { 44 StartOptions *option = new (std::nothrow) StartOptions(); 45 if (option == nullptr) { 46 return nullptr; 47 } 48 49 if (!option->ReadFromParcel(parcel)) { 50 delete option; 51 option = nullptr; 52 } 53 54 return option; 55 } 56 Marshalling(Parcel & parcel) const57bool StartOptions::Marshalling(Parcel &parcel) const 58 { 59 parcel.WriteInt32(GetWindowMode()); 60 parcel.WriteInt32(GetDisplayID()); 61 return true; 62 } 63 SetWindowMode(int32_t windowMode)64void StartOptions::SetWindowMode(int32_t windowMode) 65 { 66 windowMode_ = windowMode; 67 } 68 GetWindowMode() const69int32_t StartOptions::GetWindowMode() const 70 { 71 return windowMode_; 72 } 73 SetDisplayID(int32_t id)74void StartOptions::SetDisplayID(int32_t id) 75 { 76 displayId_ = id; 77 } 78 GetDisplayID() const79int32_t StartOptions::GetDisplayID() const 80 { 81 return displayId_; 82 } 83 } // namespace AAFwk 84 } // namespace OHOS 85