• 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 DATASHARE_I_SHARED_RESULT_SET_H
17 #define DATASHARE_I_SHARED_RESULT_SET_H
18 #include <memory>
19 #include "iremote_broker.h"
20 #include "datashare_result_set.h"
21 namespace OHOS::DataShare {
22 class ISharedResultSet : public DataShareResultSet, public IRemoteBroker {
23 public:
24     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.DataShare.ISharedResultSet")
25     static std::shared_ptr<DataShareResultSet> ReadFromParcel(MessageParcel &parcel);
26     static sptr<ISharedResultSet> WriteToParcel(std::shared_ptr<DataShareResultSet> resultSet,
27                                                 MessageParcel &parcel);
28 
29 protected:
30     enum {
31         FUNC_GET_ROW_COUNT,
32         FUNC_GET_ALL_COLUMN_NAMES,
33         FUNC_ON_GO,
34         FUNC_CLOSE,
35         FUNC_GET_BLOB,
36         FUNC_GET_STRING,
37         FUNC_GET_INT,
38         FUNC_GET_LONG,
39         FUNC_GET_DOUBLE,
40         FUNC_IS_COLUMN_NULL,
41         FUNC_GO_TO,
42         FUNC_GO_TO_ROW,
43         FUNC_GO_TO_FISTR_ROW,
44         FUNC_GO_TO_LAST_ROW,
45         FUNC_GO_TO_NEXT_ROW,
46         FUNC_GO_TO_PREV_ROW,
47         FUNC_IS_AT_FIRST_ROW,
48         FUNC_IS_AT_LAST_ROW,
49         FUNC_IS_STARTED_ROW,
50         FUNC_IS_ENDED_ROW,
51         FUNC_IS_CLOSED,
52         FUNC_GET_COLUMN_COUNT,
53         FUNC_GET_COLUMN_INDEX,
54         FUNC_GET_COLUMN_NAME,
55         FUNC_GET_COLUMN_TYPE,
56         FUNC_GET_ROW_INDEX,
57         FUNC_BUTT
58     };
59 
60 private:
61     static std::function<std::shared_ptr<DataShareResultSet>(MessageParcel &parcel)> consumerCreator_;
62     static std::function<sptr<ISharedResultSet>(std::shared_ptr<DataShareResultSet>,
63                                                 MessageParcel &)> providerCreator_;
64 };
65 } // namespace OHOS::DataShare
66 
67 #endif // DATASHARE_I_SHARED_RESULT_SET_H
68