11#ifndef PythonMonkey_JsTypeFactory_
12#define PythonMonkey_JsTypeFactory_
27 static PyObject *
getPyString(
const char16_t *chars);
28 static PyObject *
getPyString(
const JS::Latin1Char *chars);
35 void finalize(
char16_t *chars)
const override;
36 void finalize(JS::Latin1Char *chars)
const override;
38 size_t sizeOfBuffer(
const char16_t *chars, mozilla::MallocSizeOf mallocSizeOf)
const override;
39 size_t sizeOfBuffer(
const JS::Latin1Char *chars, mozilla::MallocSizeOf mallocSizeOf)
const override;
51size_t UCS4ToUTF16(
const uint32_t *chars,
size_t length, uint16_t *outStr);
76bool callPyFunc(JSContext *cx,
unsigned int argc, JS::Value *vp);
PythonExternalString PythonExternalStringCallbacks
Definition jsTypeFactory.cc:112
bool callPyFunc(JSContext *cx, unsigned int argc, JS::Value *vp)
Helper function for jsTypeFactory to create a JSFunction* through JS_NewFunction that knows how to ca...
Definition jsTypeFactory.cc:352
size_t UCS4ToUTF16(const uint32_t *chars, size_t length, uint16_t *outStr)
Function that makes a UTF16-encoded copy of a UCS4 string.
JS::Value jsTypeFactorySafe(JSContext *cx, PyObject *object)
same to jsTypeFactory, but it's guaranteed that no error would be set on the Python error stack,...
Definition jsTypeFactory.cc:313
JS::Value jsTypeFactory(JSContext *cx, PyObject *object)
Function that takes a PyObject and returns a corresponding JS::Value, doing shared memory management ...
Definition jsTypeFactory.cc:135
Definition jsTypeFactory.hh:19
void finalize(char16_t *chars) const override
decrefs the underlying PyObject string when the JSString is finalized
Definition jsTypeFactory.cc:71
static PyObject * getPyString(const char16_t *chars)
Get the PyObject using the given char buffer.
Definition jsTypeFactory.cc:54
size_t sizeOfBuffer(const char16_t *chars, mozilla::MallocSizeOf mallocSizeOf) const override
Definition jsTypeFactory.cc:96