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