Shiboken::Buffer Namespace

namespace Shiboken::Buffer

Namespace for Python buffer-related functionality. More...

Header: #include <shibokenbuffer.h>

Functions

bool checkType(PyObject *pyObj)
void *copyData(PyObject *pyObj, Py_ssize_t *size = nullptr)
void *getPointer(PyObject *pyObj, Py_ssize_t *size = nullptr)
PyObject *newObject(const void *memory, Py_ssize_t size)
PyObject *newObject(void *memory, Py_ssize_t size, Shiboken::Buffer::Type type)

Detailed Description

Function Documentation

bool Buffer::checkType(PyObject *pyObj)

Returns whether it is OK to use pyObj as argument in all functions under the Shiboken::Buffer namespace.

void *Buffer::copyData(PyObject *pyObj, Py_ssize_t *size = nullptr)

Returns a copy of the data of the buffer pyObj which should be freed; size is filled with the buffer size if not null.

If pyObj is a non-contiguous buffer, a Python error is set. nullptr is returned for empty buffers.

void *Buffer::getPointer(PyObject *pyObj, Py_ssize_t *size = nullptr)

Returns a pointer to the memory pointed to by the buffer pyObj; size is filled with the buffer size if not null.

If pyObj is a non-contiguous buffer, a Python error is set.

PyObject *Buffer::newObject(const void *memory, Py_ssize_t size)

Creates a new read only Python buffer pointing to a contiguous memory block at memory of size size.

PyObject *Buffer::newObject(void *memory, Py_ssize_t size, Shiboken::Buffer::Type type)

Creates a new Python buffer of type pointing to a contiguous memory block at memory of size size.