WARNING: Dirty QT5 compat. Tested on Debian 13.
| 26 | |
| 27 | // WARNING: Dirty QT5 compat. Tested on Debian 13. |
| 28 | class QByteArrayView |
| 29 | { |
| 30 | public: |
| 31 | QByteArrayView() : m_data(nullptr), m_size(0) {} |
| 32 | QByteArrayView(const char* data, qsizetype size) : m_data(data), m_size(size) {} |
| 33 | QByteArrayView(const QByteArray& ba) : m_data(ba.constData()), m_size(ba.size()) {} |
| 34 | const char* data() const { return m_data; } |
| 35 | qsizetype size() const { return m_size; } |
| 36 | bool isEmpty() const { return m_size == 0; } |
| 37 | bool operator==(const QByteArrayView& other) const |
| 38 | { |
| 39 | return m_size == other.m_size && (m_data == other.m_data || (m_size > 0 && std::memcmp(m_data, other.m_data, m_size) == 0)); |
| 40 | } |
| 41 | bool operator!=(const QByteArrayView& other) const { return !(*this == other); } |
| 42 | |
| 43 | private: |
| 44 | const char* m_data; |
| 45 | qsizetype m_size; |
| 46 | }; |
| 47 | #endif |
| 48 | #include <QList> |
| 49 | #include <QSet> |