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 42 template<> 43 bool Marshalling(const Predicates &bucket, MessageParcel &parcel); 44 45 template<> 46 bool Unmarshalling(Predicates &predicates, MessageParcel &parcel); 47 48 template<> 49 bool Marshalling(const Operation &operation, MessageParcel &parcel); 50 51 template<> 52 bool Unmarshalling(Operation &operation, MessageParcel &parcel); 53 54 template<> 55 bool Unmarshalling(PublishedDataItem &dataItem, MessageParcel &parcel); 56 57 template<> 58 bool Unmarshalling(PublishedDataItem &dataItem, MessageParcel &parcel); 59 60 template<> 61 bool Marshalling(const PublishedDataItem &templateId, MessageParcel &parcel); 62 63 template<> 64 bool Marshalling(const Data &data, MessageParcel &parcel); 65 66 template<> 67 bool Unmarshalling(Data &data, MessageParcel &parcel); 68 69 template<> 70 bool Marshalling(const DataShareValuesBucket &bucket, MessageParcel &parcel); 71 72 template<> 73 bool Unmarshalling(DataShareValuesBucket &bucket, MessageParcel &parcel); 74 75 template<> 76 bool Marshalling(const AshmemNode &node, MessageParcel &parcel); 77 78 template<> 79 bool Unmarshalling(AshmemNode &node, MessageParcel &parcel); 80 81 template<> 82 bool Marshalling(const Uri &node, MessageParcel &parcel); 83 84 template<> 85 bool Unmarshalling(Uri &node, MessageParcel &parcel); 86 87 template<> 88 bool Unmarshalling(TemplateId &templateId, MessageParcel &parcel); 89 90 template<> 91 bool Marshalling(const PredicateTemplateNode &predicateTemplateNode, MessageParcel &parcel); 92 93 template<> 94 bool Unmarshalling(PredicateTemplateNode &predicateTemplateNode, MessageParcel &parcel); 95 96 template<> 97 bool Marshalling(const RdbChangeNode &changeNode, MessageParcel &parcel); 98 99 template<> 100 bool Unmarshalling(RdbChangeNode &changeNode, MessageParcel &parcel); 101 102 template<> 103 bool Marshalling(const PublishedDataChangeNode &changeNode, MessageParcel &parcel); 104 105 template<> 106 bool Unmarshalling(PublishedDataChangeNode &changeNode, MessageParcel &parcel); 107 108 template<> 109 bool Marshalling(const OperationResult &operationResult, MessageParcel &parcel); 110 111 template<> 112 bool Unmarshalling(OperationResult &predicateTemplateNode, MessageParcel &parcel); 113 114 template<> 115 bool Marshalling(const TemplateId &changeNode, MessageParcel &parcel); 116 117 template<> 118 bool Marshalling(const OperationStatement &operationStatement, MessageParcel &parcel); 119 120 template<> 121 bool Unmarshalling(OperationStatement &operationStatement, MessageParcel &parcel); 122 123 template<> 124 bool Marshalling(const ExecResult &execResult, MessageParcel &parcel); 125 126 template<> 127 bool Unmarshalling(ExecResult &execResult, MessageParcel &parcel); 128 129 template<> 130 bool Marshalling(const ExecResultSet &execResultSet, MessageParcel &parcel); 131 132 template<> 133 bool Unmarshalling(ExecResultSet &execResultSet, MessageParcel &parcel); 134 } 135 #endif 136