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 "mission_info.h"
17 #include "utils.h"
18 
19 namespace OHOS {
20 namespace AbilitySlite {
~MissionInfo()21 MissionInfo::~MissionInfo()
22 {
23     AdapterFree(appName_);
24 }
25 
MissionInfo(const MissionInfo & missionInfo)26 MissionInfo::MissionInfo(const MissionInfo &missionInfo)
27 {
28     SetAppName(missionInfo.GetAppName());
29 }
30 
operator =(const MissionInfo & missionInfo)31 MissionInfo &MissionInfo::operator=(const MissionInfo &missionInfo)
32 {
33     if (this != &missionInfo) {
34         SetAppName(missionInfo.GetAppName());
35     }
36     return *this;
37 }
38 
SetAppName(const char * name)39 void MissionInfo::SetAppName(const char *name)
40 {
41     AdapterFree(appName_);
42     appName_ =  Utils::Strdup(name);
43 }
44 } // namespace AbilitySlite
45 } // namespace OHOS