-// Copyright (C) 2014-2020 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
%{
#include "ModelHighAPI_swig.h"
+ // fix for SWIG v4.1.1
+ #if PY_VERSION_HEX >= 0x03020000
+ # define SWIGPY_SLICEOBJECT PyObject
+ #else
+ # define SWIGPY_SLICEOBJECT PySliceObject
+ #endif
+
// fix for SWIG v2.0.4
- #define SWIGPY_SLICE_ARG(obj) ((PyObject*)(obj))
+ #define SWIGPY_SLICE_ARG(obj) ((SWIGPY_SLICEOBJECT*)(obj))
+ #define SWIGPY_UNICODE_ARG(obj) ((PyObject*) (obj))
%}
%include "doxyhelp.i"
#define MODELHIGHAPI_EXPORT
// standard definitions
-%include "typemaps.i"
-%include "std_list.i"
%include "std_pair.i"
-%include "std_string.i"
-%include "std_shared_ptr.i"
// directors
%feature("director") ModelHighAPI_Dumper;
+// functions with named parameters
+%feature("kwargs") setColor;
+
+// renamed methods
+%rename(__print__) ModelHighAPI_Dumper::operator<<;
+
// shared pointers
%shared_ptr(ModelHighAPI_Interface)
%shared_ptr(ModelHighAPI_Folder)
temp = ModelHighAPI_Double(PyFloat_AsDouble($input));
$1 = &temp;
} else if (PyUnicode_Check($input)) {
- temp = ModelHighAPI_Double(PyUnicode_AsUTF8($input));
+ Py_ssize_t size;
+ temp = ModelHighAPI_Double(PyUnicode_AsWideCharString($input, &size));
$1 = &temp;
} else if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
} else {
temp = ModelHighAPI_Integer(static_cast<int>(PyLong_AsLong($input)));
$1 = &temp;
} else if (PyUnicode_Check($input)) {
- temp = ModelHighAPI_Integer(PyUnicode_AsUTF8($input));
+ Py_ssize_t size;
+ temp = ModelHighAPI_Integer(PyUnicode_AsWideCharString($input, &size));
$1 = &temp;
} else if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
} else {
// std::pair -> []
%template(ResultSubShapePair) std::pair<std::shared_ptr<ModelAPI_Result>, std::shared_ptr<GeomAPI_Shape> >;
%template(StringsPair) std::pair<std::string, std::string>;
+%template(StringWStringPair) std::pair<std::string, std::wstring>;
// fix compilarion error: 'res*' was not declared in this scope
%typemap(in) const std::list<int> & (std::list<int> temp) {
- int newmem = 0;
if (PySequence_Check($input)) {
for (Py_ssize_t i = 0; i < PySequence_Size($input); ++i) {
PyObject * item = PySequence_GetItem($input, i);
}
%typecheck(SWIG_TYPECHECK_POINTER) std::list<int>, const std::list<int>& {
- int newmem = 0;
if (PySequence_Check($input)) {
for (Py_ssize_t i = 0; i < PySequence_Size($input); ++i) {
PyObject * item = PySequence_GetItem($input, i);
%typemap(in) const std::list<double> & (std::list<double> temp) {
- int newmem = 0;
if (PyTuple_Check($input)) {
for (Py_ssize_t i = 0; i < PyTuple_Size($input); ++i) {
PyObject * item = PySequence_GetItem($input, i);
}
%typecheck(SWIG_TYPECHECK_POINTER) std::list<double>, const std::list<double>& {
- int newmem = 0;
if (PyTuple_Check($input)) {
for (Py_ssize_t i = 0; i < PyTuple_Size($input); ++i) {
PyObject * item = PySequence_GetItem($input, i);
if (PyFloat_Check(item) || PyLong_Check(item)) {
temp.push_back(ModelHighAPI_Double(PyFloat_AsDouble(item)));
} else if (PyUnicode_Check(item)) {
- temp.push_back(ModelHighAPI_Double(PyUnicode_AsUTF8(item)));
+ Py_ssize_t size;
+ temp.push_back(ModelHighAPI_Double(PyUnicode_AsWideCharString(item, &size)));
} else if ((SWIG_ConvertPtr(item, (void **)&temp_double, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
temp.push_back(*temp_double);
} else {
if (PyLong_Check(item)) {
temp.push_back(ModelHighAPI_Integer(PyLong_AsLong(item)));
} else if (PyUnicode_Check(item)) {
- temp.push_back(ModelHighAPI_Integer(PyUnicode_AsUTF8(item)));
+ Py_ssize_t size;
+ temp.push_back(ModelHighAPI_Integer(PyUnicode_AsWideCharString(item, &size)));
} else if ((SWIG_ConvertPtr(item, (void **)&temp_int, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
temp.push_back(*temp_int);
} else {