~ubuntu-branches/ubuntu/trusty/hud/trusty-updates

« back to all changes in this revision

Viewing changes to common/NameObject.cpp

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release
  • Date: 2014-01-20 19:43:59 UTC
  • mfrom: (1.1.26)
  • Revision ID: package-import@ubuntu.com-20140120194359-jxxxqtd4ql9elvpf
Tags: 13.10.1+14.04.20140120-0ubuntu1
* New rebuild forced
* Automatic snapshot from revision 362

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2013 Canonical, Ltd.
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify it
 
5
 * under the terms of the GNU General Public License version 3, as published
 
6
 * by the Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful, but
 
9
 * WITHOUT ANY WARRANTY; without even the implied warranties of
 
10
 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
 
11
 * PURPOSE.  See the GNU General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License along
 
14
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 * Author: Pete Woods <pete.woods@canonical.com>
 
17
 */
 
18
 
 
19
#include <common/NameObject.h>
 
20
 
 
21
#include <QDBusMetaType>
 
22
 
 
23
using namespace hud::common;
 
24
 
 
25
QDBusArgument & operator<<(QDBusArgument &argument,
 
26
                const NameObject &nameObject) {
 
27
        argument.beginStructure();
 
28
        argument << nameObject.m_name << nameObject.m_object;
 
29
        argument.endStructure();
 
30
        return argument;
 
31
}
 
32
 
 
33
const QDBusArgument & operator>>(const QDBusArgument &argument,
 
34
                NameObject &nameObject) {
 
35
        argument.beginStructure();
 
36
        argument >> nameObject.m_name >> nameObject.m_object;
 
37
        argument.endStructure();
 
38
        return argument;
 
39
}
 
40
 
 
41
namespace hud {
 
42
namespace common {
 
43
 
 
44
NameObject::NameObject() {
 
45
}
 
46
 
 
47
NameObject::NameObject(const QString &name, const QDBusObjectPath &object) :
 
48
                m_name(name), m_object(object) {
 
49
}
 
50
 
 
51
NameObject::NameObject(const NameObject &other) :
 
52
                m_name(other.m_name), m_object(other.m_object) {
 
53
}
 
54
 
 
55
NameObject & NameObject::operator=(const NameObject &other) {
 
56
        m_name = other.m_name;
 
57
        m_object = other.m_object;
 
58
        return *this;
 
59
}
 
60
 
 
61
bool NameObject::operator==(const NameObject &other) const {
 
62
        return m_name == other.m_name && m_object == other.m_object;
 
63
}
 
64
 
 
65
NameObject::~NameObject() {
 
66
}
 
67
 
 
68
void NameObject::registerMetaTypes() {
 
69
        qRegisterMetaType<NameObject>();
 
70
        qDBusRegisterMetaType<NameObject>();
 
71
 
 
72
        qRegisterMetaType<QList<NameObject>>();
 
73
        qDBusRegisterMetaType<QList<NameObject>>();
 
74
}
 
75
 
 
76
}
 
77
}