~mardy/unity-scopes-api/clientid-1554040

« back to all changes in this revision

Viewing changes to src/scopes/qt/QCategorisedResult.cpp

  • Committer: Michi Henning
  • Date: 2015-02-25 05:20:57 UTC
  • mfrom: (163.386.1 devel)
  • mto: (163.386.2 devel)
  • mto: This revision was merged to the branch mainline in revision 324.
  • Revision ID: michi.henning@canonical.com-20150225052057-9p21sge1myzaowcb
Merged devel and resolved conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2015 Canonical Ltd
 
3
 *
 
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.
 
7
 *
 
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.
 
12
 *
 
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/>.
 
15
 *
 
16
 * Authored by: Xavi Garcia <xavi.garcia.mena@canonical.com>
 
17
 */
 
18
 
 
19
#include <unity/scopes/qt/QCategorisedResult.h>
 
20
#include <unity/scopes/qt/internal/QCategorisedResultImpl.h>
 
21
 
 
22
using namespace unity::scopes::qt;
 
23
 
 
24
/// @cond
 
25
QCategorisedResult::QCategorisedResult(QCategory::SCPtr category)
 
26
    : QResult(new internal::QCategorisedResultImpl(category))
 
27
{
 
28
}
 
29
 
 
30
QCategorisedResult::QCategorisedResult(QCategorisedResult const& other)
 
31
    : QResult(new internal::QCategorisedResultImpl(*other.fwd()))
 
32
{
 
33
}
 
34
 
 
35
QCategorisedResult& QCategorisedResult::operator=(QCategorisedResult const& other)
 
36
{
 
37
    if (this != &other)
 
38
    {
 
39
        p.reset(new internal::QCategorisedResultImpl(*other.fwd()));
 
40
    }
 
41
    return *this;
 
42
}
 
43
 
 
44
QCategorisedResult::QCategorisedResult(QCategorisedResult&&) = default;
 
45
 
 
46
QCategorisedResult& QCategorisedResult::operator=(QCategorisedResult&&) = default;
 
47
 
 
48
void QCategorisedResult::set_category(QCategory::SCPtr category)
 
49
{
 
50
    fwd()->set_category(category);
 
51
}
 
52
 
 
53
QCategory::SCPtr QCategorisedResult::category() const
 
54
{
 
55
    return fwd()->category();
 
56
}
 
57
 
 
58
internal::QCategorisedResultImpl* QCategorisedResult::fwd() const
 
59
{
 
60
    // synchronize the internal values in case anything was
 
61
    // changed by the [] operator
 
62
    p->sync_values();
 
63
    return dynamic_cast<internal::QCategorisedResultImpl*>(p.get());
 
64
}
 
65
 
 
66
/// @endcond