1 // Copyright (C) 2014-2019 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
25 #include "FiltersAPI_swig.h"
27 // fix for SWIG v2.0.4
28 #define SWIGPY_SLICE_ARG(obj) ((PyObject*)(obj))
33 // import other modules
34 %import "ModelHighAPI.i"
36 // to avoid error on this
37 #define FILTERSAPI_EXPORT
39 // standard definitions
42 %include "std_shared_ptr.i"
45 %shared_ptr(FiltersAPI_Feature)
46 %shared_ptr(FiltersAPI_Filter)
48 // function with named parameters
49 %feature("kwargs") addFilter;
53 %template(FilterList) std::list<std::shared_ptr<FiltersAPI_Filter> >;
54 %template(ArgumentList) std::list<FiltersAPI_Argument>;
56 // fix compilarion error: 'res*' was not declared in this scope
57 %typemap(freearg) const std::list<FiltersAPI_Argument> & {}
59 %typecheck(SWIG_TYPECHECK_POINTER) std::list<FiltersAPI_Argument>, const std::list<FiltersAPI_Argument> & {
60 ModelHighAPI_Selection* temp_selection;
61 std::string* temp_string;
64 if (PySequence_Check($input)) {
65 for (Py_ssize_t i = 0; i < PySequence_Size($input); ++i) {
66 PyObject * item = PySequence_GetItem($input, i);
67 if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_selection, $descriptor(ModelHighAPI_Selection *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
68 if (!temp_selection) {
72 if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_string, $descriptor(std::string *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
77 if (!PyUnicode_Check(item) && !PyBool_Check(item))
83 %typemap(in) const std::list<FiltersAPI_Argument> & (std::list<FiltersAPI_Argument> temp) {
84 ModelHighAPI_Selection* temp_selection;
85 std::string* temp_string;
87 if (PySequence_Check($input)) {
88 for (Py_ssize_t i = 0; i < PySequence_Size($input); ++i) {
89 PyObject * item = PySequence_GetItem($input, i);
90 if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_selection, $descriptor(ModelHighAPI_Selection*), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
91 if (!temp_selection) {
92 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_Selection, string or boolean.");
95 temp.push_back(FiltersAPI_Argument(*temp_selection));
96 if (newmem & SWIG_CAST_NEW_MEMORY) {
97 delete temp_selection;
100 if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_string, $descriptor(std::string*), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
102 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_Selection, string or boolean.");
105 temp.push_back(FiltersAPI_Argument(*temp_string));
106 if (newmem & SWIG_CAST_NEW_MEMORY) {
110 if (PyUnicode_Check(item)) {
111 temp.push_back(FiltersAPI_Argument(PyUnicode_AsUTF8(item)));
113 if (PyBool_Check(item)) {
114 temp.push_back(FiltersAPI_Argument(item == Py_True));
116 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_Selection, string or boolean.");
123 PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_Selection, string or boolean.");
129 // all supported interfaces
130 %include "FiltersAPI_Argument.h"
131 %include "FiltersAPI_Feature.h"
132 %include "FiltersAPI_Filter.h"
133 %include "FiltersAPI_Selection.h"