1 /*
2  * Copyright (c) 2022 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 #ifndef DATASHARE_COMMON_ITYPES_UTIL_H
17 #define DATASHARE_COMMON_ITYPES_UTIL_H
18 
19 #include "datashare_operation_statement.h"
20 #include "datashare_predicates.h"
21 #include "datashare_template.h"
22 #include "datashare_values_bucket.h"
23 #include "itypes_util.h"
24 #include "uri.h"
25 
26 namespace OHOS::ITypesUtil {
27 using Predicates = DataShare::DataSharePredicates;
28 using Operation = DataShare::OperationItem;
29 using PublishedDataItem = DataShare::PublishedDataItem;
30 using Data = DataShare::Data;
31 using TemplateId = DataShare::TemplateId;
32 using PredicateTemplateNode = DataShare::PredicateTemplateNode;
33 using RdbChangeNode = DataShare::RdbChangeNode;
34 using PublishedDataChangeNode = DataShare::PublishedDataChangeNode;
35 using OperationResult = DataShare::OperationResult;
36 using DataShareValuesBucket = DataShare::DataShareValuesBucket;
37 using AshmemNode = DataShare::AshmemNode;
38 using OperationStatement = DataShare::OperationStatement;
39 using ExecResult = DataShare::ExecResult;
40 using ExecResultSet = DataShare::ExecResultSet;
41 using UpdateOperation = DataShare::UpdateOperation;
42 using BatchUpdateResult = DataShare::BatchUpdateResult;
43 
44 template<>
45 bool Marshalling(const BatchUpdateResult &result, MessageParcel &parcel);
46 
47 template<>
48 bool Unmarshalling(BatchUpdateResult &result, MessageParcel &parcel);
49 
50 template<>
51 bool Marshalling(const UpdateOperation &operation, MessageParcel &parcel);
52 
53 template<>
54 bool Unmarshalling(UpdateOperation &operation, MessageParcel &parcel);
55 
56 template<>
57 bool Marshalling(const Predicates &bucket, MessageParcel &parcel);
58 
59 template<>
60 bool Unmarshalling(Predicates &predicates, MessageParcel &parcel);
61 
62 template<>
63 bool Marshalling(const Operation &operation, MessageParcel &parcel);
64 
65 template<>
66 bool Unmarshalling(Operation &operation, MessageParcel &parcel);
67 
68 template<>
69 bool Unmarshalling(PublishedDataItem &dataItem, MessageParcel &parcel);
70 
71 template<>
72 bool Unmarshalling(PublishedDataItem &dataItem, MessageParcel &parcel);
73 
74 template<>
75 bool Marshalling(const PublishedDataItem &templateId, MessageParcel &parcel);
76 
77 template<>
78 bool Marshalling(const Data &data, MessageParcel &parcel);
79 
80 template<>
81 bool Unmarshalling(Data &data, MessageParcel &parcel);
82 
83 template<>
84 bool Marshalling(const DataShareValuesBucket &bucket, MessageParcel &parcel);
85 
86 template<>
87 bool Unmarshalling(DataShareValuesBucket &bucket, MessageParcel &parcel);
88 
89 template<>
90 bool Marshalling(const AshmemNode &node, MessageParcel &parcel);
91 
92 template<>
93 bool Unmarshalling(AshmemNode &node, MessageParcel &parcel);
94 
95 template<>
96 bool Marshalling(const Uri &node, MessageParcel &parcel);
97 
98 template<>
99 bool Unmarshalling(Uri &node, MessageParcel &parcel);
100 
101 template<>
102 bool Unmarshalling(TemplateId &templateId, MessageParcel &parcel);
103 
104 template<>
105 bool Marshalling(const PredicateTemplateNode &predicateTemplateNode, MessageParcel &parcel);
106 
107 template<>
108 bool Unmarshalling(PredicateTemplateNode &predicateTemplateNode, MessageParcel &parcel);
109 
110 template<>
111 bool Marshalling(const RdbChangeNode &changeNode, MessageParcel &parcel);
112 
113 template<>
114 bool Unmarshalling(RdbChangeNode &changeNode, MessageParcel &parcel);
115 
116 template<>
117 bool Marshalling(const PublishedDataChangeNode &changeNode, MessageParcel &parcel);
118 
119 template<>
120 bool Unmarshalling(PublishedDataChangeNode &changeNode, MessageParcel &parcel);
121 
122 template<>
123 bool Marshalling(const OperationResult &operationResult, MessageParcel &parcel);
124 
125 template<>
126 bool Unmarshalling(OperationResult &predicateTemplateNode, MessageParcel &parcel);
127 
128 template<>
129 bool Marshalling(const TemplateId &changeNode, MessageParcel &parcel);
130 
131 template<>
132 bool Marshalling(const OperationStatement &operationStatement, MessageParcel &parcel);
133 
134 template<>
135 bool Unmarshalling(OperationStatement &operationStatement, MessageParcel &parcel);
136 
137 template<>
138 bool Marshalling(const ExecResult &execResult, MessageParcel &parcel);
139 
140 template<>
141 bool Unmarshalling(ExecResult &execResult, MessageParcel &parcel);
142 
143 template<>
144 bool Marshalling(const ExecResultSet &execResultSet, MessageParcel &parcel);
145 
146 template<>
147 bool Unmarshalling(ExecResultSet &execResultSet, MessageParcel &parcel);
148 }
149 #endif
150