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 "model/global_config.h"
17 namespace OHOS {
18 namespace DistributedData {
Marshal(json & node) const19 bool GlobalConfig::Marshal(json &node) const
20 {
21     SetValue(node[GET_NAME(processLabel)], processLabel);
22     SetValue(node[GET_NAME(metaData)], metaData);
23     SetValue(node[GET_NAME(version)], version);
24     SetValue(node[GET_NAME(features)], features);
25     SetValue(node[GET_NAME(components)], components);
26     SetValue(node[GET_NAME(bundleChecker)], bundleChecker);
27     SetValue(node[GET_NAME(networks)], networks);
28     SetValue(node[GET_NAME(directory)], directory);
29     SetValue(node[GET_NAME(backup)], backup);
30     SetValue(node[GET_NAME(cloud)], cloud);
31     SetValue(node[GET_NAME(appIdMapping)], appIdMapping);
32     return true;
33 }
34 
Unmarshal(const json & node)35 bool GlobalConfig::Unmarshal(const json &node)
36 {
37     GetValue(node, GET_NAME(processLabel), processLabel);
38     GetValue(node, GET_NAME(metaData), metaData);
39     GetValue(node, GET_NAME(version), version);
40     GetValue(node, GET_NAME(features), features);
41     GetValue(node, GET_NAME(components), components);
42     GetValue(node, GET_NAME(bundleChecker), bundleChecker);
43     GetValue(node, GET_NAME(networks), networks);
44     GetValue(node, GET_NAME(directory), directory);
45     GetValue(node, GET_NAME(backup), backup);
46     GetValue(node, GET_NAME(cloud), cloud);
47     GetValue(node, GET_NAME(appIdMapping), appIdMapping);
48     return true;
49 }
50 
~GlobalConfig()51 GlobalConfig::~GlobalConfig()
52 {
53     delete components;
54     delete bundleChecker;
55     delete networks;
56     delete directory;
57     delete backup;
58     delete cloud;
59     delete appIdMapping;
60 }
61 } // namespace DistributedData
62 } // namespace OHOS
63