• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 DISTRIBUTEDDATAFWK_IDATA_SHARE_SERVICE_H
17 #define DISTRIBUTEDDATAFWK_IDATA_SHARE_SERVICE_H
18 
19 #include <string>
20 
21 #include "datashare_predicates.h"
22 #include "datashare_result_set.h"
23 #include "datashare_values_bucket.h"
24 #include "iremote_broker.h"
25 
26 namespace OHOS::DataShare {
27 class IDataShareService : public IRemoteBroker {
28 public:
29     enum {
30         DATA_SHARE_SERVICE_CMD_INSERT,
31         DATA_SHARE_SERVICE_CMD_DELETE,
32         DATA_SHARE_SERVICE_CMD_UPDATE,
33         DATA_SHARE_SERVICE_CMD_QUERY,
34         DATA_SHARE_SERVICE_CMD_MAX
35     };
36 
37     enum {
38         DATA_SHARE_ERROR = -1,
39         DATA_SHARE_OK = 0,
40     };
41     virtual int32_t Insert(const std::string &uri, const DataShareValuesBucket &valuesBucket) = 0;
42     virtual int32_t Update(
43         const std::string &uri, const DataSharePredicates &predicate, const DataShareValuesBucket &valuesBucket) = 0;
44     virtual int32_t Delete(const std::string &uri, const DataSharePredicates &predicate) = 0;
45     virtual std::shared_ptr<DataShareResultSet> Query(
46         const std::string &uri, const DataSharePredicates &predicates, const std::vector<std::string> &columns) = 0;
47     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.DataShare.IDataShareService");
48 };
49 
50 class IKvStoreDataService : public IRemoteBroker {
51 public:
52     enum { GET_FEATURE_INTERFACE = 0 };
53 
54     enum {
55         DATA_SHARE_ERROR = -1,
56         DATA_SHARE_OK = 0,
57     };
58 
59     virtual sptr<IRemoteObject> GetFeatureInterface(const std::string &name) = 0;
60 
61     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.DistributedKv.IKvStoreDataService");
62 };
63 
64 } // namespace OHOS::DataShare
65 #endif
66