2
* Copyright (C) 2015 Canonical Ltd
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU Lesser General Public License version 3 as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Authored by: Xavi Garcia <xavi.garcia.mena@canonical.com>
19
#include <unity/scopes/qt/QCategorisedResult.h>
20
#include <unity/scopes/qt/internal/QCategorisedResultImpl.h>
22
using namespace unity::scopes::qt;
25
QCategorisedResult::QCategorisedResult(QCategory::SCPtr category)
26
: QResult(new internal::QCategorisedResultImpl(category))
30
QCategorisedResult::QCategorisedResult(QCategorisedResult const& other)
31
: QResult(new internal::QCategorisedResultImpl(*other.fwd()))
35
QCategorisedResult& QCategorisedResult::operator=(QCategorisedResult const& other)
39
p.reset(new internal::QCategorisedResultImpl(*other.fwd()));
44
QCategorisedResult::QCategorisedResult(QCategorisedResult&&) = default;
46
QCategorisedResult& QCategorisedResult::operator=(QCategorisedResult&&) = default;
48
void QCategorisedResult::set_category(QCategory::SCPtr category)
50
fwd()->set_category(category);
53
QCategory::SCPtr QCategorisedResult::category() const
55
return fwd()->category();
58
internal::QCategorisedResultImpl* QCategorisedResult::fwd() const
60
// synchronize the internal values in case anything was
61
// changed by the [] operator
63
return dynamic_cast<internal::QCategorisedResultImpl*>(p.get());