• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 KVSTORE_RESULT_SET_H
17 #define KVSTORE_RESULT_SET_H
18 
19 #include "types.h"
20 
21 namespace OHOS {
22 namespace DistributedKv {
23 class KvStoreResultSet {
24 public:
~KvStoreResultSet()25     KVSTORE_API virtual ~KvStoreResultSet()
26     {}
27 
28     // Returns the count of rows in the result set.
29     KVSTORE_API virtual int GetCount() const = 0;
30 
31     // Returns the current read position of the result set.
32     KVSTORE_API virtual int GetPosition() const = 0;
33 
34     // Move the read position to the first row, return false if the result set is empty.
35     KVSTORE_API virtual bool MoveToFirst() = 0;
36 
37     // Move the read position to the last row, return false if the result set is empty.
38     KVSTORE_API virtual bool MoveToLast() = 0;
39 
40     // Move the read position to the next row,
41     // return false if the result set is empty or the read position is already past the last entry in the result set.
42     KVSTORE_API virtual bool MoveToNext() = 0;
43 
44     // Move the read position to the previous row,
45     // return false if result set is empty or the read position is already before the first entry in the result set.
46     KVSTORE_API virtual bool MoveToPrevious() = 0;
47 
48     // Move the read position by a relative amount from the current position.
49     KVSTORE_API virtual bool Move(int offset) = 0;
50 
51     // Move the read position to an absolute position value.
52     KVSTORE_API virtual bool MoveToPosition(int position) = 0;
53 
54     // Returns whether the read position is pointing to the first row.
55     KVSTORE_API virtual bool IsFirst() const = 0;
56 
57     // Returns whether the read position is pointing to the last row.
58     KVSTORE_API virtual bool IsLast() const = 0;
59 
60     // Returns whether the read position is before the first row.
61     KVSTORE_API virtual bool IsBeforeFirst() const = 0;
62 
63     // Returns whether the read position is after the last row.
64     KVSTORE_API virtual bool IsAfterLast() const = 0;
65 
66     // Get a key-value entry.
67     KVSTORE_API virtual Status GetEntry(Entry &entry) const = 0;
68 };
69 }  // namespace DistributedKv
70 }  // namespace OHOS
71 #endif  // KVSTORE_RESULT_SET_H
72