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