1#ifndef CPYCPPYY_DECLARECONVERTERS_H
2#define CPYCPPYY_DECLARECONVERTERS_H
20#define CPPYY_DECLARE_BASIC_CONVERTER(name) \
21class name##Converter : public Converter { \
23 virtual bool SetArg(PyObject*, Parameter&, CallContext* = nullptr); \
24 virtual PyObject* FromMemory(void*); \
25 virtual bool ToMemory(PyObject*, void*, PyObject* = nullptr); \
28class Const##name##RefConverter : public Converter { \
30 virtual bool SetArg(PyObject*, Parameter&, CallContext* = nullptr); \
31 virtual PyObject* FromMemory(void*); \
35#define CPPYY_DECLARE_BASIC_CONVERTER2(name, base) \
36class name##Converter : public base##Converter { \
38 virtual PyObject* FromMemory(void*); \
39 virtual bool ToMemory(PyObject*, void*, PyObject* = nullptr); \
42class Const##name##RefConverter : public Converter { \
44 virtual bool SetArg(PyObject*, Parameter&, CallContext* = nullptr); \
45 virtual PyObject* FromMemory(void*); \
48#define CPPYY_DECLARE_REFCONVERTER(name) \
49class name##RefConverter : public Converter { \
51 virtual bool SetArg(PyObject*, Parameter&, CallContext* = nullptr); \
52 virtual PyObject* FromMemory(void*); \
55#define CPPYY_DECLARE_ARRAY_CONVERTER(name) \
56class name##ArrayConverter : public Converter { \
58 name##ArrayConverter(cdims_t dims); \
59 name##ArrayConverter(const name##ArrayConverter&) = delete; \
60 name##ArrayConverter& operator=(const name##ArrayConverter&) = delete; \
61 virtual bool SetArg(PyObject*, Parameter&, CallContext* = nullptr); \
62 virtual PyObject* FromMemory(void*); \
63 virtual bool ToMemory(PyObject*, void*, PyObject* = nullptr); \
64 virtual bool HasState() { return true; } \
76class UCharAsIntConverter :
public UCharConverter {
78 using UCharConverter::UCharConverter;
118class VoidConverter :
public Converter {
123class CStringConverter :
public Converter {
125 CStringConverter(std::string::size_type maxSize = std::string::npos) :
fMaxSize(maxSize) {}
129 virtual PyObject* FromMemory(
void* address);
131 virtual bool HasState() {
return true; }
138class NonConstCStringConverter :
public CStringConverter {
140 using CStringConverter::CStringConverter;
144 virtual PyObject* FromMemory(
void* address);
147class WCStringConverter :
public Converter {
149 WCStringConverter(std::wstring::size_type maxSize = std::wstring::npos) :
151 WCStringConverter(
const WCStringConverter&) =
delete;
152 WCStringConverter&
operator=(
const WCStringConverter&) =
delete;
153 virtual ~WCStringConverter() {
free(fBuffer); }
157 virtual PyObject* FromMemory(
void* address);
159 virtual bool HasState() {
return true; }
166class CString16Converter :
public Converter {
168 CString16Converter(std::wstring::size_type maxSize = std::wstring::npos) :
170 CString16Converter(
const CString16Converter&) =
delete;
171 CString16Converter&
operator=(
const CString16Converter&) =
delete;
172 virtual ~CString16Converter() {
free(fBuffer); }
176 virtual PyObject* FromMemory(
void* address);
178 virtual bool HasState() {
return true; }
185class CString32Converter :
public Converter {
187 CString32Converter(std::wstring::size_type maxSize = std::wstring::npos) :
189 CString32Converter(
const CString32Converter&) =
delete;
190 CString32Converter&
operator=(
const CString32Converter&) =
delete;
191 virtual ~CString32Converter() {
free(fBuffer); }
195 virtual PyObject* FromMemory(
void* address);
197 virtual bool HasState() {
return true; }
208#if __cplusplus > 201402L
227class CStringArrayConverter :
public SCharArrayConverter {
229 CStringArrayConverter(
cdims_t dims,
bool fixed) : SCharArrayConverter(dims) {
232 using SCharArrayConverter::SCharArrayConverter;
234 virtual PyObject* FromMemory(
void* address);
238 std::vector<const char*>
fBuffer;
241class NonConstCStringArrayConverter :
public CStringArrayConverter {
243 using CStringArrayConverter::CStringArrayConverter;
244 virtual PyObject* FromMemory(
void* address);
248class NullptrConverter :
public Converter {
253class InstanceConverter :
public StrictInstancePtrConverter {
255 using StrictInstancePtrConverter::StrictInstancePtrConverter;
257 virtual PyObject* FromMemory(
void*);
261class InstanceRefConverter :
public Converter {
268 virtual PyObject* FromMemory(
void* address);
269 virtual bool HasState() {
return true; }
276class InstanceMoveConverter :
public InstanceRefConverter {
278 InstanceMoveConverter(
Cppyy::TCppType_t klass) : InstanceRefConverter(klass,
true) {}
282template <
bool ISREFERENCE>
283class InstancePtrPtrConverter :
public InstancePtrConverter<false> {
289 virtual PyObject* FromMemory(
void* address);
293class InstanceArrayConverter :
public InstancePtrConverter<false> {
296 InstancePtrConverter<false>(klass, keepControl),
fShape(dims) { }
297 InstanceArrayConverter(
const InstanceArrayConverter&) =
delete;
298 InstanceArrayConverter&
operator=(
const InstanceArrayConverter&) =
delete;
302 virtual PyObject* FromMemory(
void* address);
310class ComplexDConverter:
public InstanceConverter {
312 ComplexDConverter(
bool keepControl =
false);
316 virtual PyObject* FromMemory(
void* address);
318 virtual bool HasState() {
return true; }
327class STLIteratorConverter :
public Converter {
334class VoidPtrRefConverter :
public Converter {
339class VoidPtrPtrConverter :
public Converter {
341 VoidPtrPtrConverter(
cdims_t dims);
345 virtual PyObject* FromMemory(
void* address);
346 virtual bool HasState() {
return true; }
356#define CPPYY_DECLARE_STRING_CONVERTER(name, strtype) \
357class name##Converter : public InstanceConverter { \
359 name##Converter(bool keepControl = true); \
362 virtual bool SetArg(PyObject*, Parameter&, CallContext* = nullptr); \
363 virtual PyObject* FromMemory(void* address); \
364 virtual bool ToMemory(PyObject*, void*, PyObject* = nullptr); \
365 virtual bool HasState() { return true; } \
374#if __cplusplus > 201402L
378class STLStringMoveConverter :
public STLStringConverter {
380 using STLStringConverter::STLStringConverter;
388class FunctionPointerConverter :
public Converter {
390 FunctionPointerConverter(
const std::string& ret,
const std::string& sig) :
395 virtual PyObject* FromMemory(
void* address);
397 virtual bool HasState() {
return true; }
405class StdFunctionConverter :
public FunctionPointerConverter {
407 StdFunctionConverter(Converter* cnv,
const std::string& ret,
const std::string& sig) :
408 FunctionPointerConverter(ret, sig),
fConverter(cnv) {}
409 StdFunctionConverter(
const StdFunctionConverter&) =
delete;
410 StdFunctionConverter&
operator=(
const StdFunctionConverter&) =
delete;
411 virtual ~StdFunctionConverter() {
delete fConverter; }
415 virtual PyObject* FromMemory(
void* address);
424class SmartPtrConverter :
public Converter {
428 bool keepControl =
false,
435 virtual PyObject* FromMemory(
void* address);
437 virtual bool HasState() {
return true; }
440 virtual bool GetAddressSpecialCase(
PyObject*,
void*&) {
return false; }
450class InitializerListConverter :
public InstanceConverter {
452 InitializerListConverter(
Cppyy::TCppType_t klass, std::string
const& value_type);
453 InitializerListConverter(
const InitializerListConverter&) =
delete;
454 InitializerListConverter&
operator=(
const InitializerListConverter&) =
delete;
455 virtual ~InitializerListConverter();
459 virtual bool HasState() {
return true; }
474class NotImplementedConverter :
public Converter {
#define CPPYY_DECLARE_ARRAY_CONVERTER(name)
#define CPPYY_DECLARE_STRING_CONVERTER(name, strtype)
std::string fValueTypeName
Cppyy::TCppType_t fValueType
#define CPPYY_DECLARE_BASIC_CONVERTER(name)
#define CPPYY_DECLARE_REFCONVERTER(name)
Cppyy::TCppType_t fSmartPtrType
Cppyy::TCppType_t fUnderlyingType
#define CPPYY_DECLARE_BASIC_CONVERTER2(name, base)
std::string::size_type fMaxSize
std::vector< Converter * > fConverters
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Binding & operator=(OUT(*fun)(void))
InstancePtrConverter(Cppyy::TCppType_t klass, bool keepControl=false)