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; } \
75class SCharAsIntConverter :
public CharConverter {
77 using CharConverter::CharConverter;
81class UCharAsIntConverter :
public UCharConverter {
83 using UCharConverter::UCharConverter;
123class VoidConverter :
public Converter {
128class CStringConverter :
public Converter {
130 CStringConverter(std::string::size_type maxSize = std::string::npos) :
fMaxSize(maxSize) {}
134 virtual PyObject* FromMemory(
void* address);
136 virtual bool HasState() {
return true; }
143class NonConstCStringConverter :
public CStringConverter {
145 using CStringConverter::CStringConverter;
149 virtual PyObject* FromMemory(
void* address);
152class WCStringConverter :
public Converter {
154 WCStringConverter(std::wstring::size_type maxSize = std::wstring::npos) :
156 WCStringConverter(
const WCStringConverter&) =
delete;
157 WCStringConverter&
operator=(
const WCStringConverter&) =
delete;
158 virtual ~WCStringConverter() {
free(fBuffer); }
162 virtual PyObject* FromMemory(
void* address);
164 virtual bool HasState() {
return true; }
171class CString16Converter :
public Converter {
173 CString16Converter(std::wstring::size_type maxSize = std::wstring::npos) :
175 CString16Converter(
const CString16Converter&) =
delete;
176 CString16Converter&
operator=(
const CString16Converter&) =
delete;
177 virtual ~CString16Converter() {
free(fBuffer); }
181 virtual PyObject* FromMemory(
void* address);
183 virtual bool HasState() {
return true; }
190class CString32Converter :
public Converter {
192 CString32Converter(std::wstring::size_type maxSize = std::wstring::npos) :
194 CString32Converter(
const CString32Converter&) =
delete;
195 CString32Converter&
operator=(
const CString32Converter&) =
delete;
196 virtual ~CString32Converter() {
free(fBuffer); }
200 virtual PyObject* FromMemory(
void* address);
202 virtual bool HasState() {
return true; }
213#if __cplusplus > 201402L
232class CStringArrayConverter :
public SCharArrayConverter {
234 CStringArrayConverter(
cdims_t dims,
bool fixed) : SCharArrayConverter(dims) {
237 using SCharArrayConverter::SCharArrayConverter;
239 virtual PyObject* FromMemory(
void* address);
243 std::vector<const char*>
fBuffer;
246class NonConstCStringArrayConverter :
public CStringArrayConverter {
248 using CStringArrayConverter::CStringArrayConverter;
249 virtual PyObject* FromMemory(
void* address);
253class NullptrConverter :
public Converter {
258class InstanceConverter :
public StrictInstancePtrConverter {
260 using StrictInstancePtrConverter::StrictInstancePtrConverter;
262 virtual PyObject* FromMemory(
void*);
266class InstanceRefConverter :
public Converter {
273 virtual PyObject* FromMemory(
void* address);
274 virtual bool HasState() {
return true; }
281class InstanceMoveConverter :
public InstanceRefConverter {
283 InstanceMoveConverter(
Cppyy::TCppType_t klass) : InstanceRefConverter(klass,
true) {}
287template <
bool ISREFERENCE>
288class InstancePtrPtrConverter :
public InstancePtrConverter<false> {
294 virtual PyObject* FromMemory(
void* address);
298class InstanceArrayConverter :
public InstancePtrConverter<false> {
301 InstancePtrConverter<false>(klass, keepControl),
fShape(dims) { }
302 InstanceArrayConverter(
const InstanceArrayConverter&) =
delete;
303 InstanceArrayConverter&
operator=(
const InstanceArrayConverter&) =
delete;
307 virtual PyObject* FromMemory(
void* address);
315class ComplexDConverter:
public InstanceConverter {
317 ComplexDConverter(
bool keepControl =
false);
321 virtual PyObject* FromMemory(
void* address);
323 virtual bool HasState() {
return true; }
332class STLIteratorConverter :
public Converter {
339class VoidPtrRefConverter :
public Converter {
344class VoidPtrPtrConverter :
public Converter {
346 VoidPtrPtrConverter(
cdims_t dims);
350 virtual PyObject* FromMemory(
void* address);
351 virtual bool HasState() {
return true; }
361#define CPPYY_DECLARE_STRING_CONVERTER(name, strtype) \
362class name##Converter : public InstanceConverter { \
364 name##Converter(bool keepControl = true); \
367 virtual bool SetArg(PyObject*, Parameter&, CallContext* = nullptr); \
368 virtual PyObject* FromMemory(void* address); \
369 virtual bool ToMemory(PyObject*, void*, PyObject* = nullptr); \
370 virtual bool HasState() { return true; } \
379#if __cplusplus > 201402L
383class STLStringMoveConverter :
public STLStringConverter {
385 using STLStringConverter::STLStringConverter;
393class FunctionPointerConverter :
public Converter {
395 FunctionPointerConverter(
const std::string& ret,
const std::string& sig) :
400 virtual PyObject* FromMemory(
void* address);
402 virtual bool HasState() {
return true; }
410class StdFunctionConverter :
public FunctionPointerConverter {
412 StdFunctionConverter(Converter* cnv,
const std::string& ret,
const std::string& sig) :
413 FunctionPointerConverter(ret, sig),
fConverter(cnv) {}
414 StdFunctionConverter(
const StdFunctionConverter&) =
delete;
415 StdFunctionConverter&
operator=(
const StdFunctionConverter&) =
delete;
416 virtual ~StdFunctionConverter() {
delete fConverter; }
420 virtual PyObject* FromMemory(
void* address);
429class SmartPtrConverter :
public Converter {
433 bool keepControl =
false,
440 virtual PyObject* FromMemory(
void* address);
442 virtual bool HasState() {
return true; }
445 virtual bool GetAddressSpecialCase(
PyObject*,
void*&) {
return false; }
455class InitializerListConverter :
public InstanceConverter {
457 InitializerListConverter(
Cppyy::TCppType_t klass, std::string
const& value_type);
458 InitializerListConverter(
const InitializerListConverter&) =
delete;
459 InitializerListConverter&
operator=(
const InitializerListConverter&) =
delete;
460 virtual ~InitializerListConverter();
464 virtual bool HasState() {
return true; }
479class 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)