#include "cxx-qt-lib/qbytearray.h"
#include <cxx-qt-lib/assertion_utils.h>
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
assert_alignment_and_size(QByteArray, {
::std::size_t a0;
::std::size_t a1;
::std::size_t a2;
});
#else
assert_alignment_and_size(QByteArray, { ::std::size_t a0; });
#endif
static_assert(!::std::is_trivially_copy_assignable<QByteArray>::value);
static_assert(!::std::is_trivially_copy_constructible<QByteArray>::value);
static_assert(!::std::is_trivially_destructible<QByteArray>::value);
static_assert(QTypeInfo<QByteArray>::isRelocatable);
using QByteArrayFromBase64Result = QByteArray::FromBase64Result;
assert_alignment_and_size(QByteArrayFromBase64Result, {
QByteArray decoded;
QByteArray::Base64DecodingStatus decodingStatus;
});
static_assert(
!::std::is_trivially_copy_assignable<QByteArray::FromBase64Result>::value);
static_assert(
!::std::is_trivially_copy_constructible<QByteArray::FromBase64Result>::value);
static_assert(
!::std::is_trivially_destructible<QByteArray::FromBase64Result>::value);
static_assert(QTypeInfo<QByteArray::FromBase64Result>::isRelocatable);
namespace rust {
namespace cxxqtlib1 {
QByteArray
qbytearrayFromSliceU8(::rust::Slice<const ::std::uint8_t> slice)
{
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
return QByteArray(reinterpret_cast<const char*>(slice.data()),
static_cast<qsizetype>(slice.size()));
#else
return QByteArray(reinterpret_cast<const char*>(slice.data()),
static_cast<int>(slice.size()));
#endif
}
::rust::Vec<::std::uint8_t>
qbytearrayToVecU8(const QByteArray& byteArray)
{
::rust::Vec<::std::uint8_t> vec;
std::copy(byteArray.cbegin(), byteArray.cend(), ::std::back_inserter(vec));
return vec;
}
QByteArray
qbytearrayFromRawData(::rust::Slice<const ::std::uint8_t> slice)
{
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
return QByteArray::fromRawData(reinterpret_cast<const char*>(slice.data()),
static_cast<qsizetype>(slice.size()));
#else
return QByteArray::fromRawData(reinterpret_cast<const char*>(slice.data()),
static_cast<int>(slice.size()));
#endif
}
::rust::Slice<::std::uint8_t>
qbytearrayAsMutSlice(QByteArray& byteArray)
{
return ::rust::Slice<::std::uint8_t>(
reinterpret_cast<std::uint8_t*>(byteArray.data()),
static_cast<::std::size_t>(byteArray.size()));
}
::rust::Slice<const ::std::uint8_t>
qbytearrayAsSlice(const QByteArray& byteArray)
{
return ::rust::Slice<const ::std::uint8_t>(
reinterpret_cast<const std::uint8_t*>(byteArray.data()),
static_cast<::std::size_t>(byteArray.size()));
}
void
qbytearrayAppend(QByteArray& byteArray, ::std::uint8_t ch)
{
byteArray.append(static_cast<char>(ch));
}
void
qbytearrayFill(QByteArray& byteArray, ::std::uint8_t ch, ::rust::isize size)
{
Q_ASSERT(size >= -1);
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
byteArray.fill(static_cast<char>(ch), static_cast<qsizetype>(size));
#else
byteArray.fill(static_cast<char>(ch), static_cast<int>(size));
#endif
}
QByteArray::FromBase64Result
qbytearrayFromBase64Encoding(const QByteArray& base64,
QByteArray::Base64Options options)
{
return QByteArray::fromBase64Encoding(base64, options);
}
void
qbytearrayInsert(QByteArray& byteArray, ::rust::isize pos, ::std::uint8_t ch)
{
Q_ASSERT(pos >= 0);
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
byteArray.insert(static_cast<qsizetype>(pos), static_cast<char>(ch));
#else
byteArray.insert(static_cast<int>(pos), static_cast<char>(ch));
#endif
}
::rust::isize
qbytearrayLen(const QByteArray& byteArray)
{
return static_cast<::rust::isize>(byteArray.size());
}
void
qbytearrayPrepend(QByteArray& byteArray, ::std::uint8_t ch)
{
byteArray.prepend(static_cast<char>(ch));
}
void
qbytearrayRemove(QByteArray& byteArray, ::rust::isize pos, ::rust::isize len)
{
Q_ASSERT(pos >= 0);
Q_ASSERT(len >= 0);
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
byteArray.remove(static_cast<qsizetype>(pos), static_cast<qsizetype>(len));
#else
byteArray.remove(static_cast<int>(pos), static_cast<int>(len));
#endif
}
void
qbytearrayReserve(QByteArray& byteArray, ::rust::isize size)
{
Q_ASSERT(size >= 0);
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
byteArray.reserve(static_cast<qsizetype>(size));
#else
byteArray.reserve(static_cast<int>(size));
#endif
}
void
qbytearrayResize(QByteArray& byteArray, ::rust::isize size)
{
Q_ASSERT(size >= 0);
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
byteArray.resize(static_cast<qsizetype>(size));
#else
byteArray.resize(static_cast<int>(size));
#endif
}
QByteArray
qbytearraySimplified(const QByteArray& byteArray)
{
return byteArray.simplified();
}
QByteArray
qbytearrayToLower(const QByteArray& byteArray)
{
return byteArray.toLower();
}
QByteArray
qbytearrayToUpper(const QByteArray& byteArray)
{
return byteArray.toUpper();
}
QByteArray
qbytearrayTrimmed(const QByteArray& byteArray)
{
return byteArray.trimmed();
}
}
}