-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathidentifier.h
92 lines (73 loc) · 2.81 KB
/
identifier.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
identifier.h: Definition of Identifier class
Copyright (C) 2010 Sarab D. Mattes <[email protected]>
This file is part of omapd.
omapd is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
omapd is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with omapd. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef IDENTIFIER_H
#define IDENTIFIER_H
#include <QtCore>
#include "omapdconfig.h"
class Identifier;
typedef Identifier Id;
typedef QPair<Identifier, Identifier> Link;
class Identifier
{
public:
enum IdType {
IdNone = 0,
AccessRequest,
DeviceAikName,
DeviceName,
IdentityAikName,
IdentityDistinguishedName,
IdentityDnsName,
IdentityEmailAddress,
IdentityKerberosPrincipal,
IdentityTrustedPlatformModule,
IdentityUsername,
IdentitySipUri,
IdentityHipHit,
IdentityTelUri,
IdentityOther,
IpAddressIPv4,
IpAddressIPv6,
MacAddress
};
Identifier(Identifier::IdType type = Identifier::IdNone);
Identifier(Identifier::IdType type, const QString& value, const QString& ad = QString(), const QString& other = QString());
static QString idStringForType(Identifier::IdType idType);
static QString idBaseStringForType(Identifier::IdType idType);
static Link makeLinkFromIds(const Id& id1, const Id& id2);
static Id otherIdForLink(const Link& link, const Id& targetId);
// Two Identifier objects are equal iff their type, namespace, value, and other members are the same
bool operator==(const Identifier &other) const;
bool operator< (const Id& other) const { return hashString() < other.hashString(); }
//QDataStream & operator<< ( QDataStream & stream, const Identifier & id );
Identifier::IdType type() const { return _type; }
const QString& value() const { return _value; }
const QString& ad() const { return _ad; }
const QString& other() const { return _other; }
QString hashString() const;
void setType(Identifier::IdType type) { _type = type; }
void setValue(const QString& value) { _value = value; }
void setAd(const QString& ad) { _ad = ad; }
void setOther(const QString& other) { _other = other; }
private:
Identifier::IdType _type;
QString _value;
QString _ad;
QString _other;
};
QDebug operator<<(QDebug dbg, const Identifier & id);
uint qHash ( const Identifier & key );
#endif // IDENTIFIER_H