1 /* 2 * Copyright (c) 2023 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 OHOS_DISTRIBUTED_DATA_SERVICES_FRAMEWORK_STORE_CURSOR_H 17 #define OHOS_DISTRIBUTED_DATA_SERVICES_FRAMEWORK_STORE_CURSOR_H 18 #include <map> 19 #include <variant> 20 #include <vector> 21 22 #include "store/general_value.h" 23 namespace OHOS::DistributedData { 24 class Cursor { 25 public: 26 virtual ~Cursor() = default; 27 28 virtual int32_t GetColumnNames(std::vector<std::string> &names) const = 0; 29 30 virtual int32_t GetColumnName(int32_t col, std::string &name) const = 0; 31 32 virtual int32_t GetColumnType(int32_t col) const = 0; 33 34 virtual int32_t GetCount() const = 0; 35 36 virtual int32_t MoveToFirst() = 0; 37 38 virtual int32_t MoveToNext() = 0; 39 40 virtual int32_t MoveToPrev() = 0; 41 42 virtual int32_t GetEntry(VBucket &entry) = 0; 43 44 virtual int32_t GetRow(VBucket &data) = 0; 45 46 virtual int32_t Get(int32_t col, Value &value) = 0; 47 48 virtual int32_t Get(const std::string &col, Value &value) = 0; 49 50 virtual int32_t Close() = 0; 51 52 virtual bool IsEnd() = 0; 53 }; 54 } // namespace OHOS::DistributedData 55 #endif // OHOS_DISTRIBUTED_DATA_SERVICES_FRAMEWORK_STORE_CURSOR_H 56