summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarsten Heimrich <karsten.heimrich@qt.io>2018-03-07 16:48:44 +0100
committerKarsten Heimrich <karsten.heimrich@qt.io>2018-03-09 10:23:58 +0000
commit487a7799a6b2e00e3a094e06a966e2b09ef8bb1b (patch)
treeb811e839cbf4d641fda4984e6f51338eee8d7e65
parentabb03252c1524d2f3c451c09cb7a40ea9a99bbfc (diff)
Remove superfluous classes QKnxByteStore{Ref} and QKnxNetIpPayloadv5.11.0-beta2
Change-Id: I2b6a2fc73da64dfdd1de2f9236ac3eca1736b785 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r--src/knx/knx.pro4
-rw-r--r--src/knx/netip/netip.pri2
-rw-r--r--src/knx/netip/qknxnetippayload.cpp52
-rw-r--r--src/knx/netip/qknxnetippayload.h81
-rw-r--r--src/knx/netip/qknxnetipstruct.h1
-rw-r--r--src/knx/qknxbytestore.cpp170
-rw-r--r--src/knx/qknxbytestore.h137
-rw-r--r--src/knx/qknxbytestoreref.cpp88
-rw-r--r--src/knx/qknxbytestoreref.h101
-rw-r--r--src/knx/qknxtpdu.h2
-rw-r--r--src/knx/qknxutils.h47
11 files changed, 2 insertions, 683 deletions
diff --git a/src/knx/knx.pro b/src/knx/knx.pro
index 7090f15..c6b9042 100644
--- a/src/knx/knx.pro
+++ b/src/knx/knx.pro
@@ -17,8 +17,6 @@ DEFINES += QT_NO_CAST_FROM_ASCII
PUBLIC_HEADERS += \
qknxadditionalinfo.h \
qknxaddress.h \
- qknxbytestore.h \
- qknxbytestoreref.h \
qknxcemi.h \
qknxconnectioninfo.h \
qknxcontrolfield.h \
@@ -49,8 +47,6 @@ PRIVATE_HEADERS += \
SOURCES += \
qknxadditionalinfo.cpp \
qknxaddress.cpp \
- qknxbytestore.cpp \
- qknxbytestoreref.cpp \
qknxconnectioninfo.cpp \
qknxcontrolfield.cpp \
qknxdeviceconfiguration.cpp \
diff --git a/src/knx/netip/netip.pri b/src/knx/netip/netip.pri
index 108557c..28dc165 100644
--- a/src/knx/netip/netip.pri
+++ b/src/knx/netip/netip.pri
@@ -24,7 +24,6 @@ PUBLIC_HEADERS += $$PWD/qknxnetip.h \
$$PWD/qknxnetiphpai.h \
$$PWD/qknxnetipknxaddressesdib.h \
$$PWD/qknxnetipmanufacturerdib.h \
- $$PWD/qknxnetippayload.h \
$$PWD/qknxnetiproutingbusy.h \
$$PWD/qknxnetiproutingindication.h \
$$PWD/qknxnetiproutinglostmessage.h \
@@ -69,7 +68,6 @@ SOURCES += $$PWD/qknxnetipconfigdib.cpp \
$$PWD/qknxnetiphpai.cpp \
$$PWD/qknxnetipknxaddressesdib.cpp \
$$PWD/qknxnetipmanufacturerdib.cpp \
- $$PWD/qknxnetippayload.cpp \
$$PWD/qknxnetiproutingbusy.cpp \
$$PWD/qknxnetiproutingindication.cpp \
$$PWD/qknxnetiproutinglostmessage.cpp \
diff --git a/src/knx/netip/qknxnetippayload.cpp b/src/knx/netip/qknxnetippayload.cpp
deleted file mode 100644
index 7111673..0000000
--- a/src/knx/netip/qknxnetippayload.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/******************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtKnx module.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-******************************************************************************/
-
-#include "qknxnetippayload.h"
-
-QT_BEGIN_NAMESPACE
-
-QKnxNetIpPayload::QKnxNetIpPayload(quint8 byte)
- : QKnxByteStore(byte)
-{}
-
-QKnxNetIpPayload::QKnxNetIpPayload(const QKnxByteArray &ba)
-{
- setBytes(ba);
-}
-
-QKnxNetIpPayload::QKnxNetIpPayload(const quint8 *data, quint16 size)
- : QKnxByteStore(data, size)
-{}
-
-QKnxNetIpPayloadRef QKnxNetIpPayload::ref(quint16 index) const
-{
- return QKnxByteStore::ref(index);
-}
-
-QT_END_NAMESPACE
diff --git a/src/knx/netip/qknxnetippayload.h b/src/knx/netip/qknxnetippayload.h
deleted file mode 100644
index d7d464e..0000000
--- a/src/knx/netip/qknxnetippayload.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/******************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtKnx module.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-******************************************************************************/
-
-#ifndef QKNXNETIPPAYLOAD_H
-#define QKNXNETIPPAYLOAD_H
-
-#include <QtCore/qdatastream.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/qstring.h>
-#include <QtCore/qvector.h>
-#include <QtKnx/qknxbytestore.h>
-#include <QtKnx/qknxglobal.h>
-#include <QtKnx/qknxtraits.h>
-#include <QtKnx/qknxbytestore.h>
-
-QT_BEGIN_NAMESPACE
-
-using QKnxNetIpPayloadRef = QKnxByteStoreRef;
-
-class Q_KNX_EXPORT QKnxNetIpPayload final : private QKnxByteStore
-{
-public:
- QKnxNetIpPayload() = default;
- ~QKnxNetIpPayload() override = default;
-
- explicit QKnxNetIpPayload(quint8 byte);
- explicit QKnxNetIpPayload(const QKnxByteArray &ba);
- QKnxNetIpPayload(const quint8 *data, quint16 size);
-
- QKnxNetIpPayloadRef ref(quint16 index = 0) const;
-
- using QKnxByteStore::size;
- using QKnxByteStore::resize;
- using QKnxByteStore::toString;
-
- using QKnxByteStore::byte;
- using QKnxByteStore::bytes;
- using QKnxByteStore::setByte;
- using QKnxByteStore::setBytes;
- using QKnxByteStore::appendBytes;
- using QKnxByteStore::insertBytes;
- using QKnxByteStore::replaceBytes;
-
- static QKnxNetIpPayload fromBytes(const QKnxByteArray &type, quint16 index, quint16 size)
- {
- QKnxNetIpPayload payload;
- auto begin = std::next(std::begin(type), index);
- payload.setBytes(begin, std::next(begin, size));
- return payload;
- }
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/knx/netip/qknxnetipstruct.h b/src/knx/netip/qknxnetipstruct.h
index fb90f95..13c3f1f 100644
--- a/src/knx/netip/qknxnetipstruct.h
+++ b/src/knx/netip/qknxnetipstruct.h
@@ -34,7 +34,6 @@
#include <QtKnx/qknxnetip.h>
#include <QtKnx/qknxtraits.h>
#include <QtKnx/qknxnetipstructheader.h>
-#include <QtKnx/qknxnetippayload.h>
QT_BEGIN_NAMESPACE
diff --git a/src/knx/qknxbytestore.cpp b/src/knx/qknxbytestore.cpp
deleted file mode 100644
index eb65812..0000000
--- a/src/knx/qknxbytestore.cpp
+++ /dev/null
@@ -1,170 +0,0 @@
-/******************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtKnx module.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-******************************************************************************/
-
-#include "qknxbytestore.h"
-#include "qknxbytestoreref.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QKnxByteStore
-
- \inmodule QtKnx
- \brief The QKnxByteStore class is a byte store used when building frames.
-
- To communicate with the KNX bus, frames needs to be exchanged. The byte
- store is useful when building the frames and serves as a base to classes
- representing the frames.
-*/
-
-/*!
- Constructs a new byte store equal to \a byte.
-*/
-QKnxByteStore::QKnxByteStore(quint8 byte)
-{
- m_bytes.resize(1);
- m_bytes[0] = byte;
-}
-
-/*!
- Constructs a new byte store of the size \a size from the \a bytes array.
-*/
-QKnxByteStore::QKnxByteStore(const quint8 *bytes, quint16 size)
-{
- m_bytes.resize(size);
- std::copy_n(bytes, size, std::begin(m_bytes));
-}
-
-/*!
- \fn quint16 QKnxByteStore::size() const
-
- Returns the number of bytes.
-*/
-
-/*!
- \fn void QKnxByteStore::resize(quint16 size, const quint8 value = 0)
-
- Resizes the range of bytes to the given \a size and \a value.
-*/
-
-/*!
- \fn quint8 QKnxByteStore::byte(quint16 index) const
-
- Returns the byte of the current byte store at \a index.
-*/
-
-/*!
- \fn virtual QString QKnxByteStore::toString() const
-
- Returns a \l QString object representing the bytes.
-*/
-
-/*!
- \fn template <typename T> auto QKnxByteStore::bytes() const
-
- Returns the bytes of the byte store in the chosen format.
-*/
-
-/*!
- \fn template <typename T> auto QKnxByteStore::bytes(quint16 start, quint16 count) const
-
- Returns the bytes of the byte store in the chosen format. Starting at the
- byte at the index \a start until the byte at the index \a start plus
- \a count.
-*/
-
-/*!
- Resizes the current byte store to the size of one passed as
- \l QKnxByteStoreRef with \a storeRef. The \a storeRef bytes are copied to
- the current object.
-*/
-void QKnxByteStore::setBytes(const QKnxByteStoreRef &storeRef)
-{
- m_bytes.resize(storeRef.size());
- std::copy(std::begin(storeRef), std::end(storeRef), std::begin(m_bytes));
-}
-
-/*!
- \fn template <typename T, std::size_t S> void QKnxByteStore::setBytes(const T &sourceBytes)
-
- Replaces the current byte store with the provided \a sourceBytes.
-*/
-
-/*!
- \fn void QKnxByteStore::setBytes(QByteArray::const_iterator sourceBegin, QByteArray::const_iterator sourceEnd)
-
- Replaces the current byte store using the STL-style const iterators
- \a sourceBegin and \a sourceEnd.
-*/
-
-/*!
- \fn template <typename Iterator> void sQKnxByteStore::setBytes(Iterator sourceBegin, Iterator sourceEnd)
-
- Replaces the current byte store by using the iterators \a sourceBegin
- and \a sourceEnd.
-*/
-
-/*!
- \fn template <typename T, std::size_t S> void QKnxByteStore::appendBytes(const T &bytesToAppend)
-
- Adds the \a bytesToAppend to the current byte store.
-*/
-
-/*!
- \fn template <typename T, std::size_t S> void QKnxByteStore::insertBytes(quint16 pos, const T &bytesToInsert)
-
- Inserts the bytes specified by \a bytesToInsert at the position \a pos.
-*/
-
-/*!
- \fn template <typename T, std::size_t S = 0> void QKnxByteStore::replaceBytes(quint16 pos, const T &replacement)
-
- Replaces the bytes situated at the position \a pos by the ones specified by
- \a replacement.
-*/
-
-void QKnxByteStore::replaceBytes(quint16 pos, const QKnxByteArray & replacement)
-{
- if (replacement.size() <= 0)
- return;
-
- if ((pos + replacement.size()) >= size())
- resize(pos + quint16(replacement.size()));
- m_bytes.replace(pos, replacement.size(), replacement);
-}
-
-/*!
- Creates a \l QKnxByteStoreRef object pointing to the \a index of the object.
-*/
-QKnxByteStoreRef QKnxByteStore::ref(quint16 index) const
-{
- return QKnxByteStoreRef(const_cast<QKnxByteStore*> (this), index);
-}
-
-QT_END_NAMESPACE
diff --git a/src/knx/qknxbytestore.h b/src/knx/qknxbytestore.h
deleted file mode 100644
index beb6948..0000000
--- a/src/knx/qknxbytestore.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/******************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtKnx module.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-******************************************************************************/
-
-#ifndef QKNXBYTESTORE_H
-#define QKNXBYTESTORE_H
-
-#include <QtCore/qdatastream.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/qstring.h>
-#include <QtCore/qvector.h>
-#include <QtKnx/qknxglobal.h>
-#include <QtKnx/qknxbytestoreref.h>
-#include <QtKnx/qknxtraits.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_KNX_EXPORT QKnxByteStore
-{
- friend class QKnxByteStoreRef;
-
-public:
- quint16 size() const
- {
- return quint16(m_bytes.size());
- }
-
- void resize(quint16 size, const quint8 value = 0)
- {
- auto oldSize = m_bytes.size();
- if (size > oldSize)
- m_bytes += QKnxByteArray(size - oldSize, value);
- else
- m_bytes.resize(size);
- }
-
- quint8 byte(quint16 index) const
- {
- return m_bytes.value(index);
- }
-
- void setByte(quint16 index, quint8 byte)
- {
- if (size() <= index)
- resize(index + 1);
- m_bytes[index] = byte;
- }
-
- virtual QString toString() const
- {
- QString bytesString;
- for (quint8 byte : m_bytes)
- bytesString += QStringLiteral("0x%1, ").arg(byte, 2, 16, QLatin1Char('0'));
- bytesString.chop(2);
- return QStringLiteral("Bytes { %1 }").arg(bytesString);
- }
-
- QKnxByteArray bytes() const
- {
- return m_bytes;
- }
-
- QKnxByteArray bytes(quint16 start, quint16 count) const
- {
- if (size() < start + count)
- return {};
- return m_bytes.mid(start, count);
- }
-
- void setBytes(const QKnxByteStoreRef &storeRef);
-
- void setBytes(const QKnxByteArray &sourceBytes)
- {
- m_bytes = sourceBytes;
- }
-
- void setBytes(QKnxByteArray::const_iterator sourceBegin, QKnxByteArray::const_iterator sourceEnd)
- {
- m_bytes.resize(std::distance(sourceBegin, sourceEnd));
- std::copy(sourceBegin, sourceEnd, std::begin(m_bytes));
- }
-
- void appendBytes(const QKnxByteArray &bytesToAppend)
- {
- m_bytes += bytesToAppend;
- }
-
- void insertBytes(quint16 pos, const QKnxByteArray &bytesToInsert)
- {
- m_bytes.insert(pos, bytesToInsert);
- }
-
- void replaceBytes(quint16 pos, const QKnxByteArray &replacement);
-
- QKnxByteStoreRef ref(quint16 index = 0) const;
-
-protected:
- QKnxByteStore() = default;
- virtual ~QKnxByteStore() = default;
-
- explicit QKnxByteStore(quint8 byte);
- QKnxByteStore(const quint8 *bytes, quint16 size);
-
- const quint8 *data() const { return m_bytes.data(); }
-
-private:
- QKnxByteArray m_bytes;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/knx/qknxbytestoreref.cpp b/src/knx/qknxbytestoreref.cpp
deleted file mode 100644
index 9b16989..0000000
--- a/src/knx/qknxbytestoreref.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/******************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtKnx module.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-******************************************************************************/
-
-#include "qknxbytestore.h"
-#include "qknxbytestoreref.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QKnxByteStoreRef
-
- \inmodule QtKnx
- \brief The QKnxByteStoreRef class represents a pointer to a byte store.
-*/
-
-/*!
- Constructs a byte store reference using the pointer \a store to a byte store
- and the \a index at which the reference starts.
-*/
-QKnxByteStoreRef::QKnxByteStoreRef(QKnxByteStore *store, quint16 index)
-{
- if (store && index < store->size()) {
- m_index = index;
- m_store = store;
- }
-}
-
-/*!
- Returns the size of the byte store referred to by the object.
-*/
-quint16 QKnxByteStoreRef::size() const
-{
- if (m_store)
- return m_store->size() - m_index;
- return 0;
-}
-
-quint8 QKnxByteStoreRef::operator[](int i) const
-{
- Q_ASSERT_X(i >= 0 && i < size(), "QKnxByteStoreRef::operator[]", "index out of range");
- if (const quint8 *tmp = bytes())
- return tmp[i];
- return 0;
-}
-
-/*!
- Returns the content of the byte store referred to as an array of \l quint8.
-*/
-const quint8 *QKnxByteStoreRef::bytes() const
-{
- if (m_store)
- return &(*std::next(m_store->data(), m_index));
- return nullptr;
-}
-
-/*!
- \fn quint8 QKnxByteStoreRef::byte(quint16 index) const
-
- Returns the byte at \a index.
-*/
-
-QT_END_NAMESPACE
diff --git a/src/knx/qknxbytestoreref.h b/src/knx/qknxbytestoreref.h
deleted file mode 100644
index c523744..0000000
--- a/src/knx/qknxbytestoreref.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/******************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtKnx module.
-**
-** $QT_BEGIN_LICENSE:GPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 or (at your option) any later version
-** approved by the KDE Free Qt Foundation. The licenses are as published by
-** the Free Software Foundation and appearing in the file LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-******************************************************************************/
-
-#ifndef QKNXBYTESTOREREF_H
-#define QKNXBYTESTOREREF_H
-
-#include <QtKnx/qknxbytearray.h>
-#include <QtKnx/qknxglobal.h>
-#include <QtKnx/qknxtraits.h>
-
-QT_BEGIN_NAMESPACE
-
-class QKnxByteStore;
-class Q_KNX_EXPORT QKnxByteStoreRef final
-{
- friend class QKnxByteStore;
-
-public:
- QKnxByteStoreRef() = default;
- ~QKnxByteStoreRef() = default;
-
- QKnxByteStoreRef(const QKnxByteStoreRef &) = default;
- QKnxByteStoreRef &operator=(const QKnxByteStoreRef &) = default;
-
- quint16 size() const;
- const quint8 *bytes() const;
-
- quint8 byte(quint16 index) const
- {
- if (index < size()) {
- const quint8 *tmp = bytes();
- return tmp[index];
- }
- return {};
- }
-
- QKnxByteArray bytes(quint16 start, qint32 count = -1) const
- {
- if (count <= -1)
- count = size();
- if (size() < start + count)
- return {};
-
- QKnxByteArray t(count, 0);
- std::copy_n(std::next(bytes(), start), count, std::begin(t));
- return t;
- }
-
- typedef const quint8 *const_iterator;
- const_iterator begin() const
- {
- const quint8 *tmp = bytes();
- return tmp;
- }
-
- const_iterator end() const
- {
- const quint8 *tmp = bytes();
- return std::next(tmp, size());
- }
-
- quint8 operator[](int i) const;
-
-private:
- explicit QKnxByteStoreRef(QKnxByteStore *store);
- QKnxByteStoreRef(QKnxByteStore *store, quint16 index);
-
-private:
- quint16 m_index = 0;
- QKnxByteStore *m_store = nullptr;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/knx/qknxtpdu.h b/src/knx/qknxtpdu.h
index bbdf7f2..a0b092b 100644
--- a/src/knx/qknxtpdu.h
+++ b/src/knx/qknxtpdu.h
@@ -34,7 +34,7 @@
#include <QtCore/qshareddata.h>
#include <QtKnx/qknxglobal.h>
#include <QtKnx/qknxtraits.h>
-#include <QtKnx/qknxbytestore.h>
+#include <QtKnx/qknxbytearray.h>
QT_BEGIN_NAMESPACE
diff --git a/src/knx/qknxutils.h b/src/knx/qknxutils.h
index 0d956b5..6439110 100644
--- a/src/knx/qknxutils.h
+++ b/src/knx/qknxutils.h
@@ -34,7 +34,7 @@
#include <QtCore/qdebug.h>
#include <QtCore/qstring.h>
#include <QtCore/qvector.h>
-#include <QtKnx/qknxbytestoreref.h>
+#include <QtKnx/qknxbytearray.h>
#include <QtKnx/qknxglobal.h>
#include <QtKnx/qknxtraits.h>
#include <QtNetwork/qhostaddress.h>
@@ -50,13 +50,6 @@ struct QKnxUtils final
return { quint8(integer) };
}
- static quint8 fromBytes(const QKnxByteStoreRef &data, quint16 index = 0)
- {
- if (data.size() - index < 1)
- return {};
- return data.bytes()[index];
- }
-
static quint8 fromBytes(const QKnxByteArray &data, quint16 index = 0)
{
if (data.size() - index < 1)
@@ -72,13 +65,6 @@ struct QKnxUtils final
return { quint8(integer >> 8), quint8(integer) };
}
- static quint16 fromBytes(const QKnxByteStoreRef &data, quint16 index = 0)
- {
- if (data.size() - index < 2)
- return {};
- return quint16(quint16(data.bytes()[index]) << 8 | data.bytes()[index + 1]);
- }
-
static quint16 fromBytes(const QKnxByteArray &data, quint16 index = 0)
{
if (data.size() - index < 2)
@@ -95,15 +81,6 @@ struct QKnxUtils final
quint8(integer) };
}
- static quint32 fromBytes(const QKnxByteStoreRef &data, quint16 index = 0)
- {
- if (data.size() - index < 4)
- return {};
- const auto bytes = data.bytes();
- return quint32(bytes[index]) << 24 | quint32(bytes[index + 1]) << 16
- | quint32(bytes[index + 2]) << 8 | bytes[index + 3];
- }
-
static quint32 fromBytes(const QKnxByteArray &data, quint16 index = 0)
{
if (data.size() - index < 4)
@@ -124,21 +101,6 @@ struct QKnxUtils final
, quint8(integer >> 8), quint8(integer) };
}
- static quint64 fromBytes(const QKnxByteStoreRef &data, quint16 index = 0)
- {
- if (data.size() - index < 4)
- return {};
- const auto bytes = data.bytes();
- return quint64(bytes[index]) << 56
- | quint64(bytes[index + 1]) << 48
- | quint64(bytes[index + 2]) << 40
- | quint64(bytes[index + 3]) << 32
- | quint64(bytes[index + 4]) << 24
- | quint64(bytes[index + 5]) << 16
- | quint64(bytes[index + 6]) << 8
- | bytes[index + 7];
- }
-
static quint64 fromBytes(const QKnxByteArray &data, quint16 index = 0)
{
if (data.size() - index < 8)
@@ -161,13 +123,6 @@ struct QKnxUtils final
return QUint32::bytes(address.toIPv4Address());
}
- static QHostAddress fromBytes(const QKnxByteStoreRef &ref, quint16 index = 0)
- {
- if (ref.size() - index < 4)
- return {};
- return QHostAddress(QUint32::fromBytes(ref, index));
- }
-
static QHostAddress fromBytes(const QKnxByteArray &data, quint16 index = 0)
{
if (data.size() - index < 4)