1 /*
2  * Copyright (c) 2024 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 #include "metadata/store_debug_info.h"
16 #include "utils/constant.h"
17 namespace OHOS::DistributedData {
Marshal(Serializable::json & node) const18 bool StoreDebugInfo::FileInfo::Marshal(Serializable::json &node) const
19 {
20     SetValue(node[GET_NAME(inode)], inode);
21     SetValue(node[GET_NAME(size)], size);
22     SetValue(node[GET_NAME(dev)], dev);
23     SetValue(node[GET_NAME(mode)], mode);
24     SetValue(node[GET_NAME(uid)], uid);
25     SetValue(node[GET_NAME(gid)], gid);
26     return true;
27 }
28 
Unmarshal(const Serializable::json & node)29 bool StoreDebugInfo::FileInfo::Unmarshal(const Serializable::json &node)
30 {
31     GetValue(node, GET_NAME(inode), inode);
32     GetValue(node, GET_NAME(size), size);
33     GetValue(node, GET_NAME(dev), dev);
34     GetValue(node, GET_NAME(mode), mode);
35     GetValue(node, GET_NAME(uid), uid);
36     GetValue(node, GET_NAME(gid), gid);
37     return true;
38 }
39 
Marshal(Serializable::json & node) const40 bool StoreDebugInfo::Marshal(Serializable::json &node) const
41 {
42     SetValue(node[GET_NAME(fileInfos)], fileInfos);
43     return true;
44 }
45 
Unmarshal(const Serializable::json & node)46 bool StoreDebugInfo::Unmarshal(const Serializable::json &node)
47 {
48     GetValue(node, GET_NAME(fileInfos), fileInfos);
49     return true;
50 }
51 
GetPrefix(const std::initializer_list<std::string> & fields)52 std::string StoreDebugInfo::GetPrefix(const std::initializer_list<std::string> &fields)
53 {
54     return Constant::Join(KEY_PREFIX, Constant::KEY_SEPARATOR, fields);
55 }
56 }