ukui-search/libsearch/searchinterface/result-item.cpp

94 lines
1.7 KiB
C++
Raw Normal View History

2022-06-18 10:46:14 +08:00
#include "result-item.h"
#include "result-item-private.h"
using namespace UkuiSearch;
ResultItemPrivate::ResultItemPrivate::ResultItemPrivate(ResultItem *parent) : q(parent)
{
}
ResultItemPrivate::~ResultItemPrivate()
{
}
void ResultItemPrivate::setSearchId(size_t searchId)
{
m_searchId = searchId;
}
void ResultItemPrivate::setItemKey(QString itemKey)
{
m_itemKey = itemKey;
}
2022-10-21 11:21:35 +08:00
void ResultItemPrivate::setExtral(QVariantList extral)
{
for (auto &info : extral) {
m_extral.append(info);
}
}
2022-06-18 10:46:14 +08:00
size_t ResultItemPrivate::getSearchId()
{
return m_searchId;
}
QString ResultItemPrivate::getItemKey()
{
return m_itemKey;
}
2022-10-21 11:21:35 +08:00
QVariantList ResultItemPrivate::getExtral()
{
return m_extral;
}
2022-06-18 10:46:14 +08:00
ResultItem::ResultItem() : d(new ResultItemPrivate(this))
{
}
ResultItem::ResultItem(const size_t searchId) : d(new ResultItemPrivate(this))
{
d->setSearchId(searchId);
}
ResultItem::ResultItem(const QString itemKey) : d(new ResultItemPrivate(this))
{
d->setItemKey(itemKey);
}
2022-10-21 11:21:35 +08:00
ResultItem::ResultItem(const size_t searchId, const QString itemKey, QVariantList extral) : d(new ResultItemPrivate(this))
2022-06-18 10:46:14 +08:00
{
d->setSearchId(searchId);
d->setItemKey(itemKey);
2022-10-21 11:21:35 +08:00
d->setExtral(extral);
2022-06-18 10:46:14 +08:00
}
2022-10-21 11:21:35 +08:00
size_t ResultItem::getSearchId() const
2022-06-18 10:46:14 +08:00
{
return d->getSearchId();
}
2022-10-21 11:21:35 +08:00
QString ResultItem::getItemKey() const
2022-06-18 10:46:14 +08:00
{
return d->getItemKey();
}
2022-10-21 11:21:35 +08:00
QVariantList ResultItem::getExtral() const
{
return d->getExtral();
}
2022-06-18 10:46:14 +08:00
ResultItem::~ResultItem()
{
2022-10-21 11:21:35 +08:00
if (d)
delete d;
d = nullptr;
}
ResultItem::ResultItem(const ResultItem &item): d(new ResultItemPrivate(this))
{
d->setSearchId(item.getSearchId());
d->setItemKey(item.getItemKey());
d->setExtral(item.getExtral());
2022-06-18 10:46:14 +08:00
}