/*
 * Interface wrapper code.
 *
 * Generated by SIP 6.15.3
 *
 * Copyright (c) 2026 Riverbank Computing Limited <info@riverbankcomputing.com>
 * 
 * This file is part of PyQt6.
 * 
 * This file may be used under the terms of the GNU General Public License
 * version 3.0 as published by the Free Software Foundation and appearing in
 * the file LICENSE included in the packaging of this file.  Please review the
 * following information to ensure the GNU General Public License version 3.0
 * requirements will be met: http://www.gnu.org/copyleft/gpl.html.
 * 
 * If you do not wish to use this file under the terms of the GPL version 3.0
 * then you may purchase a commercial license.  For more information contact
 * info@riverbankcomputing.com.
 * 
 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 */

#include "sipAPIQtCore.h"

#line 24 "/build/pyqt6/src/pyqt6-6.11.0/sip/QtCore/qbytearrayview.sip"
#include <qbytearrayview.h>
#line 29 "/build/pyqt6/src/pyqt6-6.11.0/build/QtCore/sipQtCoreQByteArrayView.cpp"



extern "C" {static void assign_QByteArrayView(void *, Py_ssize_t, void *);}
static void assign_QByteArrayView(void *sipDst, Py_ssize_t sipDstIdx, void *sipSrc)
{
    reinterpret_cast< ::QByteArrayView *>(sipDst)[sipDstIdx] = *reinterpret_cast< ::QByteArrayView *>(sipSrc);
}


extern "C" {static void *array_QByteArrayView(Py_ssize_t);}
static void *array_QByteArrayView(Py_ssize_t sipNrElem)
{
    return new ::QByteArrayView[sipNrElem];
}


extern "C" {static void *copy_QByteArrayView(const void *, Py_ssize_t);}
static void *copy_QByteArrayView(const void *sipSrc, Py_ssize_t sipSrcIdx)
{
    return new ::QByteArrayView(reinterpret_cast<const ::QByteArrayView *>(sipSrc)[sipSrcIdx]);
}


/* Call the mapped type's destructor. */
extern "C" {static void release_QByteArrayView(void *, int, void *);}
static void release_QByteArrayView(void *sipCppV, int, void *sipUserState)
{
    ::QByteArrayView *sipCpp = reinterpret_cast< ::QByteArrayView *>(sipCppV);
#line 61 "/build/pyqt6/src/pyqt6-6.11.0/sip/QtCore/qbytearrayview.sip"
delete sipCpp;

sipBufferInfoDef *buffer_info = reinterpret_cast<sipBufferInfoDef *>(sipUserState);
sipReleaseBufferInfo(buffer_info);
sipFree(buffer_info);
#line 65 "/build/pyqt6/src/pyqt6-6.11.0/build/QtCore/sipQtCoreQByteArrayView.cpp"
}



extern "C" {static int convertTo_QByteArrayView(PyObject *, void **, int *, PyObject *, void **);}
static int convertTo_QByteArrayView(PyObject *sipPy, void **sipCppPtrV, int *sipIsErr, PyObject *, void **sipUserStatePtr)
{
    ::QByteArrayView **sipCppPtr = reinterpret_cast< ::QByteArrayView **>(sipCppPtrV);

#line 28 "/build/pyqt6/src/pyqt6-6.11.0/sip/QtCore/qbytearrayview.sip"
if (sipIsErr == NULL)
{
    // Note that we choose to use QByteArray's implementation of the buffer
    // protocol.
    return sipGetBufferInfo(sipPy, NULL);
}

sipBufferInfoDef *buffer_info = (sipBufferInfoDef *)sipMalloc(
        sizeof (sipBufferInfoDef));

if (buffer_info)
{
    if (sipGetBufferInfo(sipPy, buffer_info) > 0)
    {
        *sipCppPtr = new QByteArrayView(
                reinterpret_cast<const unsigned char *>(buffer_info->bi_buf),
                (qsizetype)buffer_info->bi_len);

        *sipUserStatePtr = buffer_info;

        // We don't support transfer of ownership.
        return SIP_TEMPORARY;
    }

    sipFree(buffer_info);
}

*sipIsErr = 1;

return 0;
#line 106 "/build/pyqt6/src/pyqt6-6.11.0/build/QtCore/sipQtCoreQByteArrayView.cpp"
}


sipMappedTypeDef sipTypeDef_QtCore_QByteArrayView = {
    {
        SIP_NULLPTR,
        SIP_TYPE_USER_STATE|SIP_TYPE_MAPPED,
        sipNameNr_QByteArrayView,
        SIP_NULLPTR,
        SIP_NULLPTR,
    },
    {
        -1,
        {0, 0, 1},
        0, SIP_NULLPTR,
        0, SIP_NULLPTR,
        {SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR, SIP_NULLPTR}
    },
    assign_QByteArrayView,
    array_QByteArrayView,
    copy_QByteArrayView,
    release_QByteArrayView,
    convertTo_QByteArrayView,
    SIP_NULLPTR
};
