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
18 namespace OHOS::MiscServices {
Marshal(Serializable::json & node) const19 bool Config::Component::Marshal(Serializable::json &node) const
20 {
21 SetValue(node, description, GET_NAME(description));
22 SetValue(node, lib, GET_NAME(lib));
23 SetValue(node, constructor, GET_NAME(constructor));
24 SetValue(node, destructor, GET_NAME(destructor));
25 SetValue(node, params, GET_NAME(params));
26 return true;
27 }
28
Unmarshal(const Serializable::json & node)29 bool Config::Component::Unmarshal(const Serializable::json &node)
30 {
31 GetValue(node, GET_NAME(description), description);
32 GetValue(node, GET_NAME(lib), lib);
33 GetValue(node, GET_NAME(constructor), constructor);
34 GetValue(node, GET_NAME(destructor), destructor);
35 GetValue(node, GET_NAME(params), params);
36 return true;
37 }
38
Marshal(Serializable::json & node) const39 bool Config::Marshal(Serializable::json &node) const
40 {
41 SetValue(node, processLabel, GET_NAME(processLabel));
42 SetValue(node, version, GET_NAME(version));
43 SetValue(node, features, GET_NAME(features));
44 SetValue(node, plugins, GET_NAME(plugins));
45 SetValue(node, components, GET_NAME(components));
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(uid), uid);
58 return ret;
59 }
60 } // namespace OHOS::MiscServices