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_PROXY_H 17 #define DATASHARE_PROXY_H 18 19 #include <iremote_proxy.h> 20 #include <memory> 21 #include "idatashare.h" 22 23 namespace OHOS { 24 namespace DataShare { 25 class DataShareProxy : public IRemoteProxy<IDataShare> { 26 public: DataShareProxy(const sptr<IRemoteObject> & remote)27 explicit DataShareProxy(const sptr<IRemoteObject>& remote) : IRemoteProxy<IDataShare>(remote) {} 28 ~DataShareProxy()29 virtual ~DataShareProxy() {} 30 31 virtual std::vector<std::string> GetFileTypes(const Uri &uri, const std::string &mimeTypeFilter) override; 32 33 virtual int OpenFile(const Uri &uri, const std::string &mode) override; 34 35 virtual int OpenRawFile(const Uri &uri, const std::string &mode) override; 36 37 virtual int Insert(const Uri &uri, const DataShareValuesBucket &value) override; 38 39 virtual int Update(const Uri &uri, const DataSharePredicates &predicates, 40 const DataShareValuesBucket &value) override; 41 42 virtual int Delete(const Uri &uri, const DataSharePredicates &predicates) override; 43 44 virtual std::shared_ptr<DataShareResultSet> Query(const Uri &uri, 45 const DataSharePredicates &predicates, std::vector<std::string> &columns) override; 46 47 virtual std::string GetType(const Uri &uri) override; 48 49 virtual int BatchInsert(const Uri &uri, const std::vector<DataShareValuesBucket> &values) override; 50 51 virtual bool RegisterObserver(const Uri &uri, const sptr<AAFwk::IDataAbilityObserver> &dataObserver) override; 52 53 virtual bool UnregisterObserver(const Uri &uri, const sptr<AAFwk::IDataAbilityObserver> &dataObserver) override; 54 55 virtual bool NotifyChange(const Uri &uri) override; 56 57 virtual Uri NormalizeUri(const Uri &uri) override; 58 59 virtual Uri DenormalizeUri(const Uri &uri) override; 60 61 private: 62 static inline BrokerDelegator<DataShareProxy> delegator_; 63 }; 64 } // namespace DataShare 65 } // namespace OHOS 66 #endif // DATASHARE_PROXY_H 67 68