1 /*
2  * Copyright (c) 2022-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 "ent_info.h"
17 #include "edm_log.h"
18 #include "string_ex.h"
19 #include "parcel_macro.h"
20 
21 namespace OHOS {
22 namespace EDM {
EntInfo(const std::string & enterpriseName,const std::string & description)23 EntInfo::EntInfo(const std::string &enterpriseName, const std::string &description)
24     : enterpriseName(enterpriseName), description(description)
25 {
26     EDMLOGD("ent info instance is created with parameters");
27 }
28 
EntInfo()29 EntInfo::EntInfo()
30 {
31     EDMLOGD("ent info instance is created without parameter");
32 }
33 
~EntInfo()34 EntInfo::~EntInfo()
35 {
36     EDMLOGD("ent info instance is destroyed");
37 }
38 
Marshalling(MessageParcel & parcel) const39 bool EntInfo::Marshalling(MessageParcel &parcel) const
40 {
41     WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String, parcel, enterpriseName);
42     WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(String, parcel, description);
43     return true;
44 }
45 
Unmarshalling(MessageParcel & parcel,EntInfo & entInfo)46 bool EntInfo::Unmarshalling(MessageParcel &parcel, EntInfo &entInfo)
47 {
48     return entInfo.ReadFromParcel(parcel);
49 }
50 
ReadFromParcel(MessageParcel & parcel)51 bool EntInfo::ReadFromParcel(MessageParcel &parcel)
52 {
53     enterpriseName = parcel.ReadString();
54     description = parcel.ReadString();
55     return true;
56 }
57 } // namespace EDM
58 } // namespace OHOS
59