Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
47 changes: 30 additions & 17 deletions src/SWIG_files/common/IOStream.i
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,36 @@ along with pythonOCC. If not, see <http://www.gnu.org/licenses/>.
%include <python/std_iostream.i>
%include <python/std_string.i>

/*
Standard_OStream & function transformation
The float number is returned in the output tuple
*/
%typemap(argout) Standard_OStream &OutValue {
// Standard_IStream
%typemap(in) std::istream& {
PyObject* temp_bytes = PyUnicode_AsEncodedString($input, "UTF-8", "strict");
std::string data(PyBytes_AsString(temp_bytes));
std::stringstream* ss = new std::stringstream(data);
$1 = ss;
}

%typemap(freearg) std::istream& {
delete $1;
}

// Standard_SStream
%typemap(in) std::stringstream & {
PyObject* temp_bytes = PyUnicode_AsEncodedString($input, "UTF-8", "strict");
std::string data(PyBytes_AsString(temp_bytes));
std::stringstream* ss = new std::stringstream(data);
$1 = ss;
}

%typemap(freearg) std::stringstream & {
delete $1;
}

%typemap(argout) std::ostream &OutValue {
PyObject *o, *o2, *o3;
std::ostringstream *output = static_cast<std::ostringstream *> ($1);
o = PyString_FromString(output->str().c_str());

std::string str = ((std::stringstream*)$1)->str();
o = PyUnicode_FromString(str.c_str());

if ((!$result) || ($result == Py_None)) {
$result = o;
} else {
Expand All @@ -47,16 +69,7 @@ The float number is returned in the output tuple
}
}

%typemap(in, numinputs=0) Standard_OStream &OutValue (std::ostringstream temp) {
%typemap(in, numinputs=0) std::ostream &OutValue (std::stringstream temp) {
$1 = &temp;
}

/*
Standard_IStream & function transformation
takes a string as input
*/
%typemap(in) Standard_IStream & {
char * in = PyString_AsString($input);
std::istringstream ss(in);
$1 = &ss;
}
55 changes: 46 additions & 9 deletions src/SWIG_files/wrapper/AIS.i
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ https://www.opencascade.com/doc/occt-7.7.0/refman/html/package_ais.html"
%include ../common/EnumTemplates.i
%include ../common/Operators.i
%include ../common/OccHandle.i
%include ../common/IOStream.i


%{
Expand Down Expand Up @@ -3252,10 +3253,22 @@ Returns standard_true if the hidden lines are to be drawn. by default the hidden
Standard_Boolean DrawHiddenLine();


/****************** DumpJsonToString ******************/
%feature("autodoc", "Json string serializer.");
/****************** DumpJson ******************/
%feature("autodoc", "
Parameters
----------
depth: int, default=-1

Return
-------
str

Description
-----------
Dump the object to JSON string.
") DumpJson;
%extend{
std::string DumpJsonToString(int depth=-1) {
std::string DumpJson(int depth=-1) {
std::stringstream s;
self->DumpJson(s, depth);
return "{" + s.str() + "}" ;}
Expand Down Expand Up @@ -6245,10 +6258,22 @@ Each interactive object has methods which allow us to attribute an owner to it i
void ClearOwner();


/****************** DumpJsonToString ******************/
%feature("autodoc", "Json string serializer.");
/****************** DumpJson ******************/
%feature("autodoc", "
Parameters
----------
depth: int, default=-1

Return
-------
str

Description
-----------
Dump the object to JSON string.
") DumpJson;
%extend{
std::string DumpJsonToString(int depth=-1) {
std::string DumpJson(int depth=-1) {
std::stringstream s;
self->DumpJson(s, depth);
return "{" + s.str() + "}" ;}
Expand Down Expand Up @@ -15415,10 +15440,22 @@ Returns the color attributes of the shape accordingly to the current facing mode
virtual void Color(Quantity_Color & aColor);


/****************** DumpJsonToString ******************/
%feature("autodoc", "Json string serializer.");
/****************** DumpJson ******************/
%feature("autodoc", "
Parameters
----------
depth: int, default=-1

Return
-------
str

Description
-----------
Dump the object to JSON string.
") DumpJson;
%extend{
std::string DumpJsonToString(int depth=-1) {
std::string DumpJson(int depth=-1) {
std::stringstream s;
self->DumpJson(s, depth);
return "{" + s.str() + "}" ;}
Expand Down
3 changes: 3 additions & 0 deletions src/SWIG_files/wrapper/AIS.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,7 @@ class AIS_InteractiveContext(Standard_Transient):
@overload
def DisplayedObjects(self, theWhichKind: AIS_KindOfInteractive, theWhichSignature: int, theListOfIO: AIS_ListOfInteractive) -> None: ...
def DrawHiddenLine(self) -> bool: ...
def DumpJson(self, depth: Optional[int]=-1) -> str: ...
def EnableDrawHiddenLine(self) -> None: ...
@overload
def EndImmediateDraw(self, theView: V3d_View) -> bool: ...
Expand Down Expand Up @@ -792,6 +793,7 @@ class AIS_InteractiveContext(Standard_Transient):

class AIS_InteractiveObject(SelectMgr_SelectableObject):
def ClearOwner(self) -> None: ...
def DumpJson(self, depth: Optional[int]=-1) -> str: ...
def GetContext(self) -> AIS_InteractiveContext: ...
def GetOwner(self) -> Standard_Transient: ...
def HasInteractiveContext(self) -> bool: ...
Expand Down Expand Up @@ -1424,6 +1426,7 @@ class AIS_Shape(AIS_InteractiveObject):
def AcceptShapeDecomposition(self) -> bool: ...
def BoundingBox(self) -> Bnd_Box: ...
def Color(self, aColor: Quantity_Color) -> None: ...
def DumpJson(self, depth: Optional[int]=-1) -> str: ...
def Material(self) -> Graphic3d_NameOfMaterial: ...
def OwnDeviationAngle(self) -> Tuple[bool, float, float]: ...
def OwnDeviationCoefficient(self) -> Tuple[bool, float, float]: ...
Expand Down
1 change: 1 addition & 0 deletions src/SWIG_files/wrapper/APIHeaderSection.i
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ https://www.opencascade.com/doc/occt-7.7.0/refman/html/package_apiheadersection.
%include ../common/EnumTemplates.i
%include ../common/Operators.i
%include ../common/OccHandle.i
%include ../common/IOStream.i


%{
Expand Down
1 change: 1 addition & 0 deletions src/SWIG_files/wrapper/Adaptor2d.i
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ https://www.opencascade.com/doc/occt-7.7.0/refman/html/package_adaptor2d.html"
%include ../common/EnumTemplates.i
%include ../common/Operators.i
%include ../common/OccHandle.i
%include ../common/IOStream.i


%{
Expand Down
1 change: 1 addition & 0 deletions src/SWIG_files/wrapper/Adaptor3d.i
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ https://www.opencascade.com/doc/occt-7.7.0/refman/html/package_adaptor3d.html"
%include ../common/EnumTemplates.i
%include ../common/Operators.i
%include ../common/OccHandle.i
%include ../common/IOStream.i


%{
Expand Down
24 changes: 17 additions & 7 deletions src/SWIG_files/wrapper/AdvApp2Var.i
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ https://www.opencascade.com/doc/occt-7.7.0/refman/html/package_advapp2var.html"
%include ../common/EnumTemplates.i
%include ../common/Operators.i
%include ../common/OccHandle.i
%include ../common/IOStream.i


%{
Expand Down Expand Up @@ -314,14 +315,23 @@ No available documentation.
") CritError;
Standard_Real CritError(const Standard_Integer Dimension, const Standard_Integer Index);

/****************** Dump ******************/
/**** md5 signature: d37b43e0b2386dc096d5d707876db157 ****/
%feature("compactdefaultargs") Dump;
%feature("autodoc", "
Parameters
----------

Return
-------
o: Standard_OStream

Description
-----------
Prints on the stream 'o' information on the current state of the object.
") Dump;
void Dump(std::ostream &OutValue);

%feature("autodoc", "1");
%extend{
std::string DumpToString() {
std::stringstream s;
self->Dump(s);
return s.str();}
};
/****************** HasResult ******************/
/**** md5 signature: 345d4b0f7e88f528928167976d8256d5 ****/
%feature("compactdefaultargs") HasResult;
Expand Down
1 change: 1 addition & 0 deletions src/SWIG_files/wrapper/AdvApp2Var.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class AdvApp2Var_ApproxAFunc2Var:
@overload
def AverageError(self, Dimension: int, Index: int) -> float: ...
def CritError(self, Dimension: int, Index: int) -> float: ...
def Dump(self) -> str: ...
def HasResult(self) -> bool: ...
def IsDone(self) -> bool: ...
@overload
Expand Down
47 changes: 33 additions & 14 deletions src/SWIG_files/wrapper/AdvApprox.i
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ https://www.opencascade.com/doc/occt-7.7.0/refman/html/package_advapprox.html"
%include ../common/EnumTemplates.i
%include ../common/Operators.i
%include ../common/OccHandle.i
%include ../common/IOStream.i


%{
Expand Down Expand Up @@ -230,14 +231,23 @@ No available documentation.
") Degree;
Standard_Integer Degree();

/****************** Dump ******************/
/**** md5 signature: d37b43e0b2386dc096d5d707876db157 ****/
%feature("compactdefaultargs") Dump;
%feature("autodoc", "
Parameters
----------

Return
-------
o: Standard_OStream

Description
-----------
Display information on approximation.
") Dump;
void Dump(std::ostream &OutValue);

%feature("autodoc", "1");
%extend{
std::string DumpToString() {
std::stringstream s;
self->Dump(s);
return s.str();}
};
/****************** HasResult ******************/
/**** md5 signature: 345d4b0f7e88f528928167976d8256d5 ****/
%feature("compactdefaultargs") HasResult;
Expand Down Expand Up @@ -599,14 +609,23 @@ No available documentation.
") DifTab;
opencascade::handle<TColStd_HArray1OfReal> DifTab();

/****************** Dump ******************/
/**** md5 signature: d37b43e0b2386dc096d5d707876db157 ****/
%feature("compactdefaultargs") Dump;
%feature("autodoc", "
Parameters
----------

Return
-------
o: Standard_OStream

Description
-----------
Display information on approximation.
") Dump;
void Dump(std::ostream &OutValue);

%feature("autodoc", "1");
%extend{
std::string DumpToString() {
std::stringstream s;
self->Dump(s);
return s.str();}
};
/****************** FirstConstr ******************/
/**** md5 signature: f7818f8b2283dc680ce2b42c85a59f9d ****/
%feature("compactdefaultargs") FirstConstr;
Expand Down
2 changes: 2 additions & 0 deletions src/SWIG_files/wrapper/AdvApprox.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class AdvApprox_ApproxAFunction:
@overload
def AverageError(self, Dimension: int, Index: int) -> float: ...
def Degree(self) -> int: ...
def Dump(self) -> str: ...
def HasResult(self) -> bool: ...
def IsDone(self) -> bool: ...
def Knots(self) -> TColStd_HArray1OfReal: ...
Expand Down Expand Up @@ -54,6 +55,7 @@ class AdvApprox_SimpleApprox:
def Coefficients(self) -> TColStd_HArray1OfReal: ...
def Degree(self) -> int: ...
def DifTab(self) -> TColStd_HArray1OfReal: ...
def Dump(self) -> str: ...
def FirstConstr(self) -> TColStd_HArray2OfReal: ...
def IsDone(self) -> bool: ...
def LastConstr(self) -> TColStd_HArray2OfReal: ...
Expand Down
1 change: 1 addition & 0 deletions src/SWIG_files/wrapper/AppBlend.i
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ https://www.opencascade.com/doc/occt-7.7.0/refman/html/package_appblend.html"
%include ../common/EnumTemplates.i
%include ../common/Operators.i
%include ../common/OccHandle.i
%include ../common/IOStream.i


%{
Expand Down
1 change: 1 addition & 0 deletions src/SWIG_files/wrapper/AppCont.i
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ https://www.opencascade.com/doc/occt-7.7.0/refman/html/package_appcont.html"
%include ../common/EnumTemplates.i
%include ../common/Operators.i
%include ../common/OccHandle.i
%include ../common/IOStream.i


%{
Expand Down
Loading