PythonMonkey   v1.0.0 (dev)
Loading...
Searching...
No Matches
BufferType Struct Reference

#include <BufferType.hh>

Static Public Member Functions

static PyObject * getPyObject (JSContext *cx, JS::HandleObject bufObj)
 Construct a new BufferType object from a JS TypedArray or ArrayBuffer, as a Python memoryview object.
 
static JSObject * toJsTypedArray (JSContext *cx, PyObject *pyObject)
 Convert a Python object that provides the buffer interface to JS TypedArray. The subtype (Uint8Array, Float64Array, ...) is automatically determined by the Python buffer's format
 
static bool isSupportedJsTypes (JSObject *obj)
 

Static Protected Member Functions

static PyObject * fromJsTypedArray (JSContext *cx, JS::HandleObject typedArray)
 
static PyObject * fromJsArrayBuffer (JSContext *cx, JS::HandleObject arrayBuffer)
 

Member Function Documentation

◆ fromJsArrayBuffer()

PyObject * BufferType::fromJsArrayBuffer ( JSContext *  cx,
JS::HandleObject  arrayBuffer 
)
staticprotected

◆ fromJsTypedArray()

PyObject * BufferType::fromJsTypedArray ( JSContext *  cx,
JS::HandleObject  typedArray 
)
staticprotected

◆ getPyObject()

PyObject * BufferType::getPyObject ( JSContext *  cx,
JS::HandleObject  bufObj 
)
static

Construct a new BufferType object from a JS TypedArray or ArrayBuffer, as a Python memoryview object.

Parameters
cx- javascript context pointer
bufObj- JS object to be coerced
Returns
PyObject* pointer to the resulting PyObject

◆ isSupportedJsTypes()

bool BufferType::isSupportedJsTypes ( JSObject *  obj)
static
Returns
Is the given JS object either a TypedArray or an ArrayBuffer?

◆ toJsTypedArray()

JSObject * BufferType::toJsTypedArray ( JSContext *  cx,
PyObject *  pyObject 
)
static

Convert a Python object that provides the buffer interface to JS TypedArray. The subtype (Uint8Array, Float64Array, ...) is automatically determined by the Python buffer's format

Parameters
cx- javascript context pointer
pyObject- the object to be converted

The documentation for this struct was generated from the following files: