~xavi-garcia-mena/unity-scopes-api/utils-qt

« back to all changes in this revision

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

  • Committer: Xavi Garcia
  • Date: 2015-01-20 13:59:36 UTC
  • Revision ID: xavi.garcia.mena@canonical.com-20150120135936-cogxk8ok7g0gvo8g
Added Qt-bindings classes

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/QSearchMetadata.h>
 
20
#include <unity/scopes/qt/QUtils.h>
 
21
 
 
22
#include <unity/scopes/qt/internal/QSearchMetadataImpl.h>
 
23
 
 
24
using namespace unity::scopes;
 
25
using namespace unity::scopes::qt;
 
26
 
 
27
/// @cond
 
28
QSearchMetadata::QSearchMetadata(QString const& locale, QString const& form_factor)
 
29
    : p(new internal::QSearchMetadataImpl(locale, form_factor))
 
30
{
 
31
}
 
32
 
 
33
QSearchMetadata::QSearchMetadata(int cardinality, QString const& locale, QString const& form_factor)
 
34
    : p(new internal::QSearchMetadataImpl(cardinality, locale, form_factor))
 
35
{
 
36
}
 
37
 
 
38
QSearchMetadata::QSearchMetadata(QSearchMetadata const& other)
 
39
    : p(new internal::QSearchMetadataImpl(*other.p))
 
40
{
 
41
}
 
42
 
 
43
QSearchMetadata::QSearchMetadata(QSearchMetadata&&) = default;
 
44
 
 
45
QSearchMetadata::~QSearchMetadata() = default;
 
46
 
 
47
void QSearchMetadata::set_cardinality(int cardinality)
 
48
{
 
49
    p->set_cardinality(cardinality);
 
50
}
 
51
 
 
52
int QSearchMetadata::cardinality() const
 
53
{
 
54
    return p->cardinality();
 
55
}
 
56
 
 
57
void QSearchMetadata::set_location(Location const& location)
 
58
{
 
59
    p->set_location(location);
 
60
}
 
61
 
 
62
Location QSearchMetadata::location() const
 
63
{
 
64
    return p->location();
 
65
}
 
66
 
 
67
bool QSearchMetadata::has_location() const
 
68
{
 
69
    return p->has_location();
 
70
}
 
71
 
 
72
void QSearchMetadata::set_hint(QString const& key, QVariant const& value)
 
73
{
 
74
    p->set_hint(key, value);
 
75
}
 
76
 
 
77
QVariantMap QSearchMetadata::hints() const
 
78
{
 
79
    return p->hints();
 
80
}
 
81
 
 
82
bool QSearchMetadata::contains_hint(QString const& key) const
 
83
{
 
84
    return p->contains_hint(key);
 
85
}
 
86
 
 
87
QScopeVariant& QSearchMetadata::operator[](QString const& key)
 
88
{
 
89
    return (*p)[key];
 
90
}
 
91
 
 
92
QVariant const& QSearchMetadata::operator[](QString const& key) const
 
93
{
 
94
    return p->value(key);
 
95
}
 
96
/// @endcond