From d8d8fc7a0d139e7b864eee3b573bd208f823ad4f Mon Sep 17 00:00:00 2001 From: Javier Date: Sun, 19 Oct 2014 18:45:03 +0200 Subject: initial import, no crypto --- sapserviceinfo.cc | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 sapserviceinfo.cc (limited to 'sapserviceinfo.cc') diff --git a/sapserviceinfo.cc b/sapserviceinfo.cc new file mode 100644 index 0000000..a77d2f0 --- /dev/null +++ b/sapserviceinfo.cc @@ -0,0 +1,106 @@ +#include +#include + +#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 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 SAPServiceInfo::channels() const +{ + return data->channels.values(); +} -- cgit v1.2.3