/* * Copyright (C) 2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef RINGTONE_FETCH_RESULT_H #define RINGTONE_FETCH_RESULT_H #include "abs_shared_result_set.h" #include "datashare_result_set.h" #include "rdb_errno.h" #include "ringtone_asset.h" #include "vibrate_asset.h" #include "ringtone_db_const.h" #include "ringtone_type.h" #include "simcard_setting_asset.h" namespace OHOS { namespace Media { #define EXPORT __attribute__ ((visibility ("default"))) /** * @brief Class for returning the data cursor to application. * * @since 1.0 * @version 1.0 */ template class RingtoneFetchResult { public: EXPORT explicit RingtoneFetchResult(const std::shared_ptr &resultset); EXPORT RingtoneFetchResult(); EXPORT virtual ~RingtoneFetchResult(); EXPORT void Close(); EXPORT int32_t GetCount(); EXPORT bool IsAtLastRow(); EXPORT std::shared_ptr &GetDataShareResultSet(); EXPORT std::unique_ptr GetObjectAtPosition(int32_t index); EXPORT std::unique_ptr GetFirstObject(); EXPORT std::unique_ptr GetObjectFromRdb(std::shared_ptr &resultSet, int idx); EXPORT std::unique_ptr GetNextObject(); EXPORT std::unique_ptr GetLastObject(); EXPORT std::unique_ptr GetObject(); private: EXPORT std::unique_ptr GetObject(std::shared_ptr &resultSet); EXPORT std::variant GetRowValFromColumn(std::string columnName, RingtoneResultSetDataType dataType, std::shared_ptr &resultSet); std::variant GetValByIndex(int32_t index, RingtoneResultSetDataType dataType, std::shared_ptr &resultSet); void SetRingtoneAsset(std::unique_ptr& asset, std::shared_ptr &resultSet); void GetObjectFromResultSet(std::unique_ptr& asset, std::shared_ptr &resultSet); std::shared_ptr resultset_ = nullptr; }; } // namespace Media } // namespace OHOS #endif // INTERFACES_INNERKITS_NATIVE_INCLUDE_FETCH_RESULT_H