~ubuntu-branches/ubuntu/trusty/maliit-framework/trusty-proposed

« back to all changes in this revision

Viewing changes to src/mattributeextensionid.cpp

  • Committer: Package Import Robot
  • Author(s): Iain Lane
  • Date: 2013-01-31 13:26:48 UTC
  • Revision ID: package-import@ubuntu.com-20130131132648-w1u9d2279tppxcft
Tags: upstream-0.94.1
ImportĀ upstreamĀ versionĀ 0.94.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* * This file is part of Maliit framework *
 
2
 *
 
3
 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 
4
 * All rights reserved.
 
5
 *
 
6
 * Contact: maliit-discuss@lists.maliit.org
 
7
 *
 
8
 * This library is free software; you can redistribute it and/or
 
9
 * modify it under the terms of the GNU Lesser General Public
 
10
 * License version 2.1 as published by the Free Software Foundation
 
11
 * and appearing in the file LICENSE.LGPL included in the packaging
 
12
 * of this file.
 
13
 */
 
14
 
 
15
 
 
16
#include "mattributeextensionid.h"
 
17
 
 
18
#include <QHash>
 
19
 
 
20
namespace {
 
21
    const int InvalidId  = -1;
 
22
    const int StandardId = -2;
 
23
}
 
24
 
 
25
MAttributeExtensionId::MAttributeExtensionId()
 
26
    : m_id(InvalidId)
 
27
{
 
28
}
 
29
 
 
30
MAttributeExtensionId::MAttributeExtensionId(int id, const QString &service)
 
31
    : m_id(id),
 
32
      m_service(service)
 
33
{
 
34
}
 
35
 
 
36
MAttributeExtensionId MAttributeExtensionId::standardAttributeExtensionId()
 
37
{
 
38
    return MAttributeExtensionId(StandardId, QString());
 
39
}
 
40
 
 
41
bool MAttributeExtensionId::isValid() const
 
42
{
 
43
    return m_id >= 0 && !m_service.isEmpty();
 
44
}
 
45
 
 
46
bool MAttributeExtensionId::operator==(const MAttributeExtensionId &other) const
 
47
{
 
48
    return (m_id == other.m_id) && (m_service == other.m_service);
 
49
}
 
50
 
 
51
bool MAttributeExtensionId::operator!=(const MAttributeExtensionId &other) const
 
52
{
 
53
    return !operator==(other);
 
54
}
 
55
 
 
56
QString MAttributeExtensionId::service() const
 
57
{
 
58
    return m_service;
 
59
}
 
60
 
 
61
int MAttributeExtensionId::id() const
 
62
{
 
63
    return m_id;
 
64
}
 
65
 
 
66
uint qHash(const MAttributeExtensionId &id)
 
67
{
 
68
    return qHash(QPair<int, QString>(id.m_id, id.m_service));
 
69
}
 
70