diff options
author | Andrew O'Doherty <andrew.odoherty@qt.io> | 2018-09-11 14:49:59 +0200 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@qt.io> | 2018-09-13 08:19:56 +0000 |
commit | 071ac7c6b3b20f738c3c8d016f30cc50bd6cae71 (patch) | |
tree | cca168ac22546e4d13b086a00015c3a88e38cbaf /src/knx/netip/qknxnetipsessionauthenticate.cpp | |
parent | 9b3df740acb61e68ce1cb061153b2684858cd3c4 (diff) |
Add d-pointers to new builder classes
Change-Id: I303795f8b1cf627986588541db129ce2bfb787ca
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
Diffstat (limited to 'src/knx/netip/qknxnetipsessionauthenticate.cpp')
-rw-r--r-- | src/knx/netip/qknxnetipsessionauthenticate.cpp | 49 |
1 files changed, 44 insertions, 5 deletions
diff --git a/src/knx/netip/qknxnetipsessionauthenticate.cpp b/src/knx/netip/qknxnetipsessionauthenticate.cpp index af6c368..46300f5 100644 --- a/src/knx/netip/qknxnetipsessionauthenticate.cpp +++ b/src/knx/netip/qknxnetipsessionauthenticate.cpp @@ -181,6 +181,28 @@ QKnxNetIpSessionAuthenticateProxy::Builder QKnxNetIpSessionAuthenticateProxy::bu \sa QKnxCryptographicEngine */ +class QKnxNetIpSessionAuthenticateBuilderPrivate : public QSharedData +{ +public: + QKnxNetIpSessionAuthenticateBuilderPrivate() = default; + ~QKnxNetIpSessionAuthenticateBuilderPrivate() = default; + + quint16 m_id { 0 }; + QKnxByteArray m_authCode; +}; + +/*! + Creates a new empty session authenticate frame builder. +*/ +QKnxNetIpSessionAuthenticateProxy::Builder::Builder() + : d_ptr(new QKnxNetIpSessionAuthenticateBuilderPrivate) +{} + +/*! + Destroys the object and frees any allocated resources. +*/ +QKnxNetIpSessionAuthenticateProxy::Builder::~Builder() = default; + /*! Sets the user ID of the KNXnet/IP session authentication frame to \a userId and returns a reference to the builder. @@ -191,7 +213,7 @@ QKnxNetIpSessionAuthenticateProxy::Builder QKnxNetIpSessionAuthenticateProxy::bu QKnxNetIpSessionAuthenticateProxy::Builder & QKnxNetIpSessionAuthenticateProxy::Builder::setUserId(quint16 userId) { - m_id = userId; + d_ptr->m_id = userId; return *this; } @@ -203,7 +225,7 @@ QKnxNetIpSessionAuthenticateProxy::Builder & QKnxNetIpSessionAuthenticateProxy::Builder & QKnxNetIpSessionAuthenticateProxy::Builder::setMessageAuthenticationCode(const QKnxByteArray &data) { - m_authCode = data; + d_ptr->m_authCode = data; return *this; } @@ -217,11 +239,28 @@ QKnxNetIpSessionAuthenticateProxy::Builder & */ QKnxNetIpFrame QKnxNetIpSessionAuthenticateProxy::Builder::create() const { - if (m_id == 0 || m_id >= 0x80 || m_authCode.size() != 16) + if (d_ptr->m_id == 0 || d_ptr->m_id >= 0x80 || d_ptr->m_authCode.size() != 16) return { QKnxNetIp::ServiceType::SessionAuthenticate }; - return { QKnxNetIp::ServiceType::SessionAuthenticate, QKnxUtils::QUint16::bytes(m_id) - + m_authCode }; + return { QKnxNetIp::ServiceType::SessionAuthenticate, QKnxUtils::QUint16::bytes(d_ptr->m_id) + + d_ptr->m_authCode }; +} + +/*! + Constructs a copy of \a other. +*/ +QKnxNetIpSessionAuthenticateProxy::Builder::Builder(const Builder &other) + : d_ptr(other.d_ptr) +{} + +/*! + Assigns the specified \a other to this object. +*/ +QKnxNetIpSessionAuthenticateProxy::Builder & + QKnxNetIpSessionAuthenticateProxy::Builder::operator=(const Builder &other) +{ + d_ptr = other.d_ptr; + return *this; } QT_END_NAMESPACE |