Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
Pythonize.cxx File Reference
#include "CPyCppyy.h"
#include "Pythonize.h"
#include "Converters.h"
#include "CPPInstance.h"
#include "CPPFunction.h"
#include "CPPOverload.h"
#include "CustomPyTypes.h"
#include "LowLevelViews.h"
#include "ProxyWrappers.h"
#include "PyCallable.h"
#include "PyStrings.h"
#include "TypeManip.h"
#include "Utility.h"
#include <algorithm>
#include <complex>
#include <set>
#include <stdexcept>
#include <sstream>
#include <string>
#include <utility>
Include dependency graph for Pythonize.cxx:

Namespaces

namespace  CPyCppyy
 

Macros

#define COMPLEX_METH_GETSET(name, cppname)
 
#define CPPYY_IMPL_STRING_PYTHONIZATION(type, name)
 
#define CPPYY_IMPL_STRING_PYTHONIZATION_CMP(type, name)
 
#define CPYCPPYY_STRING_FINDMETHOD(name, cppname, pyname)
 
#define PyObject_LengthHint   _PyObject_LengthHint
 

Functions

std::map< std::string, std::vector< PyObject * > > & CPyCppyy::pythonizations ()
 
static bool run_pythonizors (PyObject *pyclass, PyObject *pyname, const std::vector< PyObject * > &v)
 

Macro Definition Documentation

◆ COMPLEX_METH_GETSET

#define COMPLEX_METH_GETSET (   name,
  cppname 
)
Value:
static PyObject* name##ComplexGet(PyObject* self, void*) { \
return PyObject_CallMethodNoArgs(self, cppname); \
} \
static int name##ComplexSet(PyObject* self, PyObject* value, void*) { \
if (result) { \
Py_DECREF(result); \
return 0; \
} \
return -1; \
} \
PyGetSetDef name##Complex{(char*)#name, (getter)name##ComplexGet, (setter)name##ComplexSet, nullptr, nullptr};
static PyObject * PyObject_CallMethodOneArg(PyObject *obj, PyObject *name, PyObject *arg)
Definition CPyCppyy.h:385
static PyObject * PyObject_CallMethodNoArgs(PyObject *obj, PyObject *name)
Definition CPyCppyy.h:381
_object PyObject
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
char name[80]
Definition TGX11.cxx:110

Definition at line 1473 of file Pythonize.cxx.

◆ CPPYY_IMPL_STRING_PYTHONIZATION

#define CPPYY_IMPL_STRING_PYTHONIZATION (   type,
  name 
)

Definition at line 1136 of file Pythonize.cxx.

◆ CPPYY_IMPL_STRING_PYTHONIZATION_CMP

#define CPPYY_IMPL_STRING_PYTHONIZATION_CMP (   type,
  name 
)
Value:
PyObject* name##StringCompare(PyObject* self, PyObject* obj) \
{ \
PyObject* data = name##StringGetData(self, PyBytes_Check(obj)); \
int result = 0; \
if (data) { \
result = PyObject_Compare(data, obj); \
Py_DECREF(data); \
} \
if (PyErr_Occurred()) \
return nullptr; \
return PyInt_FromLong(result); \
}
#define PyBytes_Check
Definition CPyCppyy.h:61
#define CPPYY_IMPL_STRING_PYTHONIZATION(type, name)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type

Definition at line 1202 of file Pythonize.cxx.

◆ CPYCPPYY_STRING_FINDMETHOD

#define CPYCPPYY_STRING_FINDMETHOD (   name,
  cppname,
  pyname 
)
Value:
PyObject* STLString##name(CPPInstance* self, PyObject* args, PyObject* /*kwds*/) \
{ \
std::string* obj = GetSTLString(self); \
if (!obj) \
return nullptr; \
\
PyObject* cppmeth = PyObject_GetAttrString((PyObject*)self, (char*)#cppname);\
if (cppmeth) { \
PyObject* result = PyObject_Call(cppmeth, args, nullptr); \
Py_DECREF(cppmeth); \
if (result) { \
if (PyLongOrInt_AsULong64(result) == (PY_ULONG_LONG)std::string::npos) {\
Py_DECREF(result); \
return PyInt_FromLong(-1); \
} \
return result; \
} \
PyErr_Clear(); \
} \
\
PyObject* pystr = CPyCppyy_PyText_FromStringAndSize(obj->data(), obj->size());\
PyObject* pymeth = PyObject_GetAttrString(pystr, (char*)#pyname); \
Py_DECREF(pystr); \
PyObject* result = PyObject_CallObject(pymeth, args); \
Py_DECREF(pymeth); \
return result; \
}
#define CPyCppyy_PyText_FromStringAndSize
Definition CPyCppyy.h:85
unsigned long long PY_ULONG_LONG
Definition Cppyy.h:31
PY_ULONG_LONG PyLongOrInt_AsULong64(PyObject *pyobject)
Definition Utility.cxx:156

Definition at line 1295 of file Pythonize.cxx.

◆ PyObject_LengthHint

#define PyObject_LengthHint   _PyObject_LengthHint

Definition at line 221 of file Pythonize.cxx.

Function Documentation

◆ run_pythonizors()

static bool run_pythonizors ( PyObject pyclass,
PyObject pyname,
const std::vector< PyObject * > &  v 
)
inlinestatic

Definition at line 1578 of file Pythonize.cxx.