#include <QtWaylandClient/private/qwayland-server-buffer-extension.h>

QT_BEGIN_NAMESPACE
QT_WARNING_PUSH
QT_WARNING_DISABLE_GCC("-Wmissing-field-initializers")

namespace QtWayland {

static inline void *wlRegistryBind(struct ::wl_registry *registry, uint32_t name, const struct ::wl_interface *interface, uint32_t version)
{
    const uint32_t bindOpCode = 0;
#if (WAYLAND_VERSION_MAJOR == 1 && WAYLAND_VERSION_MINOR > 10) || WAYLAND_VERSION_MAJOR > 1
    return (void *) wl_proxy_marshal_constructor_versioned((struct wl_proxy *) registry,
        bindOpCode, interface, version, name, interface->name, version, nullptr);
#else
    return (void *) wl_proxy_marshal_constructor((struct wl_proxy *) registry,
        bindOpCode, interface, name, interface->name, version, nullptr);
#endif
}

    qt_server_buffer::qt_server_buffer(struct ::wl_registry *registry, int id, int version)
    {
        init(registry, id, version);
    }

    qt_server_buffer::qt_server_buffer(struct ::qt_server_buffer *obj)
        : m_qt_server_buffer(obj)
    {
    }

    qt_server_buffer::qt_server_buffer()
        : m_qt_server_buffer(nullptr)
    {
    }

    qt_server_buffer::~qt_server_buffer()
    {
    }

    void qt_server_buffer::init(struct ::wl_registry *registry, int id, int version)
    {
        m_qt_server_buffer = static_cast<struct ::qt_server_buffer *>(wlRegistryBind(registry, id, &qt_server_buffer_interface, version));
    }

    void qt_server_buffer::init(struct ::qt_server_buffer *obj)
    {
        m_qt_server_buffer = obj;
    }

    qt_server_buffer *qt_server_buffer::fromObject(struct ::qt_server_buffer *object)
    {
        return static_cast<qt_server_buffer *>(qt_server_buffer_get_user_data(object));
    }

    bool qt_server_buffer::isInitialized() const
    {
        return m_qt_server_buffer != nullptr;
    }

    const struct wl_interface *qt_server_buffer::interface()
    {
        return &::qt_server_buffer_interface;
    }

    void qt_server_buffer::release()
    {
        qt_server_buffer_release(
            m_qt_server_buffer);
    }
}

QT_WARNING_POP
QT_END_NAMESPACE
