1 /* 2 * Copyright (c) 2021 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 NATIVE_RDB_DATD_ABILITY_PREDICATES_H 17 #define NATIVE_RDB_DATD_ABILITY_PREDICATES_H 18 19 #include <string> 20 21 #include "abs_predicates.h" 22 #include "parcel.h" 23 24 namespace OHOS { 25 namespace NativeRdb { 26 /** 27 * The Predicates class of DataAbility. 28 */ 29 class API_EXPORT DataAbilityPredicates : public AbsPredicates, public virtual OHOS::Parcelable { 30 public: 31 /** 32 * @brief Constructor. 33 */ 34 API_EXPORT DataAbilityPredicates(); 35 36 /** 37 * @brief Constructor. 38 */ 39 API_EXPORT explicit DataAbilityPredicates(const std::string &rawSelection); 40 41 /** 42 * @brief Constructor. 43 */ 44 API_EXPORT explicit DataAbilityPredicates(OHOS::Parcel *source); 45 46 /** 47 * @brief Destructor. 48 */ 49 API_EXPORT ~DataAbilityPredicates() override; 50 51 /** 52 * @brief Obtains value of variable isRawSelection. 53 */ 54 API_EXPORT bool IsRawSelection() const; 55 56 /** 57 * @brief Obtains value of variable judgeSource. 58 */ 59 API_EXPORT bool GetJudgeSource() const; 60 61 /** 62 * @brief Write DataAbilityPredicates object to Parcel. 63 */ 64 API_EXPORT bool Marshalling(OHOS::Parcel &parcel) const override; 65 66 /** 67 * @brief Read from Parcel object. 68 */ 69 API_EXPORT static DataAbilityPredicates *Unmarshalling(OHOS::Parcel &parcel); 70 71 /** 72 * @brief The initial value of the static variable is false. 73 */ 74 API_EXPORT static bool result; 75 76 private: 77 void MarshallingString(std::string value, OHOS::Parcel &parcel) const; 78 void MarshallingStringList(std::vector<std::string> list, OHOS::Parcel &parcel) const; 79 80 bool isRawSelection; 81 bool judgeSource; 82 }; 83 } // namespace NativeRdb 84 } // namespace OHOS 85 86 #endif