]> gerrit.simantics Code Review - simantics/3d.git/blob - org.jcae.opencascade/src/Standard.i
Merge "Allow property editing with just a single mouse click"
[simantics/3d.git] / org.jcae.opencascade / src / Standard.i
1 /*
2  * Project Info:  http://jcae.sourceforge.net
3  * 
4  * This program is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License as published by the Free
6  * Software Foundation; either version 2.1 of the License, or (at your option)
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12  * details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this program; if not, write to the Free Software Foundation, Inc.,
16  * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
17  *
18  * (C) Copyright 2005, by EADS CRC
19  */
20
21 //Refine the catch keywoard
22 %{#include <Standard_ErrorHandler.hxx>%}
23
24 /*%exception
25 {
26         try
27         {
28                 $action
29         }
30         catch(Standard_Failure) 
31         {
32                 SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, Standard_Failure::Caught()->DynamicType()->Name());
33                 return $null;
34         }
35 }*/
36 // Now we bind Opencascade types with Java types.
37 // /usr/share/swig1.3/java/java.swg contains many simple example to do that.
38 /**
39  * Standard_CString
40  */
41 %typemap(jni) Standard_CString "jstring"
42 %typemap(jtype) Standard_CString "String"
43 %typemap(jstype) Standard_CString "String"
44
45 %typemap(in) Standard_CString
46 {
47   $1 = const_cast<$1_ltype>(JCALL2(GetStringUTFChars, jenv, $input, 0));
48 }
49
50 %typemap(out) Standard_CString %{ #error TODO %}
51
52 %typemap(javain) Standard_CString "$javainput"
53 %typemap(javaout) Standard_CString 
54 {
55         return $jnicall;
56 }
57
58 /**
59  * Standard_Boolean
60  */
61 %typemap(jni) Standard_Boolean "jboolean"
62 %typemap(jtype) Standard_Boolean "boolean"
63 %typemap(jstype) Standard_Boolean "boolean"
64
65 %typemap(in) Standard_Boolean
66 {
67   $1 = $input;
68 }
69
70 %typemap(out) Standard_Boolean %{ $result = (jboolean)$1; %}
71
72 %typemap(javain) Standard_Boolean "$javainput"
73 %typemap(javaout) Standard_Boolean 
74 {
75         return $jnicall;
76 }
77
78 %typedef double Standard_Real;
79 %typedef int Standard_Integer;
80 //%typedef double Quantity_Length;
81 //%typedef double Quantity_Parameter;
82
83 /**
84  * Standard_OStream
85  */
86 %{ #include "jnistream.hxx" %}
87 %typemap(jni) Standard_OStream& "jobject"
88 %typemap(jtype) Standard_OStream& "java.nio.channels.WritableByteChannel"
89 %typemap(jstype) Standard_OStream& "java.nio.channels.WritableByteChannel"
90
91 %typemap(in) Standard_OStream&
92 %{
93     jnistreambuf buf(jenv, $input);
94     Standard_OStream os(&buf);
95         $1=&os;
96 %}
97
98 %typemap(freearg) Standard_OStream&
99 %{
100     $1->flush();
101 %}
102
103 %typemap(javain) Standard_OStream& "$javainput"
104 %typemap(javaout) Standard_OStream& 
105 {
106         return $jnicall;
107 }
108
109 /**
110  * Standard_IStream
111  */
112 %typemap(jni) Standard_IStream& "jobject"
113 %typemap(jtype) Standard_IStream& "java.nio.channels.ReadableByteChannel"
114 %typemap(jstype) Standard_IStream& "java.nio.channels.ReadableByteChannel"
115
116 %typemap(in) Standard_IStream&
117 %{
118         jnistreambuf buf(jenv, $input);
119         Standard_IStream is(&buf);
120         $1=&is;
121 %}
122
123 %typemap(javain) Standard_IStream& "$javainput"
124 %typemap(javaout) Standard_IStream& 
125 {
126         return $jnicall;
127 }
128