summaryrefslogtreecommitdiff
path: root/sapserviceinfo.cc
blob: a77d2f0476b28a5da28b1b7161e752207ae802b4 (plain)
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#include <QtCore/QMap>
#include <QtCore/QSharedData>

#include "sapserviceinfo.h"
#include "sapchannelinfo.h"


class SAPServiceInfoData : public QSharedData {
public:
	QString profile;
	QString friendlyName;
	SAPServiceInfo::Role role;
	unsigned short version;
	unsigned short connectionTimeout;

	QMap<int, SAPChannelInfo> channels;
};

SAPServiceInfo::SAPServiceInfo() : data(new SAPServiceInfoData)
{
}

SAPServiceInfo::SAPServiceInfo(const SAPServiceInfo &rhs) : data(rhs.data)
{
}

SAPServiceInfo &SAPServiceInfo::operator=(const SAPServiceInfo &rhs)
{
	if (this != &rhs)
		data.operator=(rhs.data);
	return *this;
}

SAPServiceInfo::~SAPServiceInfo()
{
}

QString SAPServiceInfo::profile() const
{
	return data->profile;
}

void SAPServiceInfo::setProfile(const QString &profile)
{
	data->profile = profile;
}

QString SAPServiceInfo::friendlyName() const
{
	return data->friendlyName;
}

void SAPServiceInfo::setFriendlyName(const QString &name)
{
	data->friendlyName = name;
}

SAPServiceInfo::Role SAPServiceInfo::role() const
{
	return data->role;
}

void SAPServiceInfo::setRole(SAPServiceInfo::Role role)
{
	data->role = role;
}

unsigned short SAPServiceInfo::version() const
{
	return data->version;
}

void SAPServiceInfo::setVersion(unsigned short version)
{
	data->version = version;
}

void SAPServiceInfo::setVersion(unsigned char maj, unsigned char min)
{
	setVersion((maj << 8) | (min & 0xFF));
}

unsigned short SAPServiceInfo::connectionTimeout() const
{
	return data->connectionTimeout;
}

void SAPServiceInfo::setConnectionTimeout(unsigned short timeout)
{
	data->connectionTimeout = timeout;
}

void SAPServiceInfo::addChannel(const SAPChannelInfo &channel)
{
	data->channels.insert(channel.channelId(), channel);
}

void SAPServiceInfo::removeChannel(unsigned short channelId)
{
	data->channels.remove(channelId);
}

QList<SAPChannelInfo> SAPServiceInfo::channels() const
{
	return data->channels.values();
}