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 SetValue(node[GET_NAME(thread)], thread);
33 return true;
34 }
35
Unmarshal(const json & node)36 bool GlobalConfig::Unmarshal(const json &node)
37 {
38 GetValue(node, GET_NAME(processLabel), processLabel);
39 GetValue(node, GET_NAME(metaData), metaData);
40 GetValue(node, GET_NAME(version), version);
41 GetValue(node, GET_NAME(features), features);
42 GetValue(node, GET_NAME(components), components);
43 GetValue(node, GET_NAME(bundleChecker), bundleChecker);
44 GetValue(node, GET_NAME(networks), networks);
45 GetValue(node, GET_NAME(directory), directory);
46 GetValue(node, GET_NAME(backup), backup);
47 GetValue(node, GET_NAME(cloud), cloud);
48 GetValue(node, GET_NAME(appIdMapping), appIdMapping);
49 GetValue(node, GET_NAME(thread), thread);
50 return true;
51 }
52
~GlobalConfig()53 GlobalConfig::~GlobalConfig()
54 {
55 delete components;
56 delete bundleChecker;
57 delete networks;
58 delete directory;
59 delete backup;
60 delete cloud;
61 delete appIdMapping;
62 delete thread;
63 }
64 } // namespace DistributedData
65 } // namespace OHOS