summaryrefslogtreecommitdiff
path: root/sapserviceinfo.h
blob: 91756b7ca74a552605fc9fa365c6adaa2e1ae4ad (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
#ifndef SAPSERVICEINFO_H
#define SAPSERVICEINFO_H

#include <QtCore/QObject>
#include <QtCore/QSharedDataPointer>

class SAPServiceInfoData;
class SAPChannelInfo;

class SAPServiceInfo
{
	Q_GADGET
	Q_ENUMS(Role)

public:
	SAPServiceInfo();
	SAPServiceInfo(const SAPServiceInfo &);
	SAPServiceInfo &operator=(const SAPServiceInfo &);
	~SAPServiceInfo();

	enum Role {
		RoleProvider,
		RoleConsumer
	};

	static Role oppositeRole(Role role);

	QString profile() const;
	void setProfile(const QString &profile);

	QString friendlyName() const;
	void setFriendlyName(const QString &name);

	Role role() const;
	void setRole(Role role);

	unsigned short version() const;
	void setVersion(unsigned short version);
	void setVersion(unsigned char maj, unsigned char min);

	unsigned short connectionTimeout() const;
	void setConnectionTimeout(unsigned short timeout);

	void addChannel(const SAPChannelInfo &channel);
	void removeChannel(unsigned short channelId);
	QList<SAPChannelInfo> channels() const;

private:
	QSharedDataPointer<SAPServiceInfoData> data;
};

inline SAPServiceInfo::Role SAPServiceInfo::oppositeRole(Role role)
{
	switch (role) {
	case RoleProvider:
		return RoleConsumer;
	case RoleConsumer:
		return RoleProvider;
	default:
		abort();
	}
}

#endif // SAPSERVICEINFO_H