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 "config.h"
17 namespace OHOS::MiscServices {
Marshal(Serializable::json & node) const18 bool Config::Component::Marshal(Serializable::json &node) const
19 {
20     SetValue(node, description, GET_NAME(description));
21     SetValue(node, lib, GET_NAME(lib));
22     SetValue(node, constructor, GET_NAME(constructor));
23     SetValue(node, destructor, GET_NAME(destructor));
24     SetValue(node, params, GET_NAME(params));
25     return true;
26 }
27 
Unmarshal(const Serializable::json & node)28 bool Config::Component::Unmarshal(const Serializable::json &node)
29 {
30     GetValue(node, GET_NAME(description), description);
31     GetValue(node, GET_NAME(lib), lib);
32     GetValue(node, GET_NAME(constructor), constructor);
33     GetValue(node, GET_NAME(destructor), destructor);
34     GetValue(node, GET_NAME(params), params);
35     return true;
36 }
37 
Marshal(Serializable::json & node) const38 bool Config::Marshal(Serializable::json &node) const
39 {
40     SetValue(node, processLabel, GET_NAME(processLabel));
41     SetValue(node, version, GET_NAME(version));
42     SetValue(node, features, GET_NAME(features));
43     SetValue(node, plugins, GET_NAME(plugins));
44     SetValue(node, components, GET_NAME(components));
45     SetValue(node, bundles, GET_NAME(bundles));
46     SetValue(node, uid, GET_NAME(uid));
47     return true;
48 }
49 
Unmarshal(const Serializable::json & node)50 bool Config::Unmarshal(const Serializable::json &node)
51 {
52     auto ret = GetValue(node, GET_NAME(processLabel), processLabel);
53     ret = GetValue(node, GET_NAME(version), version) && ret;
54     GetValue(node, GET_NAME(features), features);
55     GetValue(node, GET_NAME(plugins), plugins);
56     GetValue(node, GET_NAME(components), components);
57     GetValue(node, GET_NAME(bundles), bundles);
58     GetValue(node, GET_NAME(uid), uid);
59     return ret;
60 }
61 } // namespace OHOS::MiscServices