ukui-search/libsearch/appdata/application-info-storage.h

61 lines
2.0 KiB
C++

/*
*
* Copyright (C) 2023, KylinSoft Co., Ltd.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#ifndef APPLICATIONINFOSTORAGE_H
#define APPLICATIONINFOSTORAGE_H
#include <QVariant>
#include "application-property.h"
namespace UkuiSearch {
class ApplicationInfoStoragePrivate;
class ApplicationInfoStorage
{
public:
ApplicationInfoStorage();
ApplicationInfoStorage(Properties properties);
ApplicationInfoStorage(const ApplicationInfoStorage &other);
~ApplicationInfoStorage();
ApplicationInfoStorage & operator=(const ApplicationInfoStorage &rhs);
/**
* @brief 查询当前容器内包含的应用列表
* @return 所有desktop路径的QStringlist
*/
QStringList applicationKeys() const;
/**
* @brief 查询当前容器包含的信息种类
* @return QVector<ApplicationProperty::Property>
*/
Properties &applicationInfoKeys() const;
/**
* @brief 查询某个应用的某个信息
* @param desktopFile
* @param info
* @return 以info的数据类型格式返回特定信息
*/
QVariant ApplicationInfo(const QString &desktopFile, ApplicationProperty::Property property);
ApplicationInfoMap &allData();
void addData(const QString &desktopFile, ApplicationProperty::Property property, const QVariant &value);
private:
ApplicationInfoStoragePrivate *d = nullptr;
};
}
#endif // APPLICATIONINFOSTORAGE_H