Commit graph

335 commits

Author SHA1 Message Date
William S Fulton
52063a732b Consistent parameter names for std::pair 2019-02-14 22:44:27 +00:00
William S Fulton
6d27ead9c0 Add STL container copy constructors where missing
Also provide consistent copy constructor declarations.
2019-02-14 18:53:05 +00:00
William S Fulton
e26f6bb4e2 Add missing typedefs to std::vector + typedef corrections
Tests for std::vector of pointers added which check
 std::vector<T*>::const_reference and std::vector<T*>::reference
usage which gave compilation errors in Python and Perl which had
specialized these vectors incorrectly.
2019-02-13 22:46:28 +00:00
William S Fulton
a47c2553f5 Add missing typedefs to std::pair 2019-02-13 22:46:28 +00:00
William S Fulton
9dd33e6367 Add missing typedefs to std::map 2019-02-13 22:46:27 +00:00
William S Fulton
68e86614ff Create a consistent stl.i library file
Same file now for all languages except R which is still missing std_map.i.
Recent Java changes adding in std_set.i removed.
2019-02-12 18:46:05 +00:00
William S Fulton
368cd3b52c Add ToArray test for C# std::vector wrapper 2018-01-12 18:26:47 +00:00
William S Fulton
6227013da4 Merge branch 'master' of https://github.com/Liryna/swig into Liryna-master
* 'master' of https://github.com/Liryna/swig:
  [C#] Add ToArray to std_vector.i
2018-01-12 18:02:33 +00:00
William S Fulton
e86c881a70 Fix directorout typemaps which were causing undefined behaviour when returning pointers by reference.
Closes #1167
2017-12-14 07:00:42 +00:00
William S Fulton
dafe2d6949 Add director typemaps for pointer const ref types 2017-10-24 23:47:40 +01:00
Quentin
4326da9ab3 [C#] Add ToArray to std_vector.i 2017-10-19 09:45:57 +02:00
William S Fulton
46ea2ab0a6 Add director shared_ptr typemaps for C# 2017-10-17 21:55:31 +01:00
William S Fulton
e43dfc69e5 Precision loss warning fixes for C# std::complex<float> typemaps
For gcc -Wfloat-conversion and vc++ C4244 warnings
2017-10-10 19:26:54 +01:00
William S Fulton
a55981b883 Fix C# std::complex pass by value typemaps 2017-10-02 19:07:24 +01:00
William S Fulton
ed4b84f4d3 Fix overloading of shared_ptr method overloading
Add 'equivalent' attribute to typecheck typemap.
Closes #1098.
2017-09-23 15:19:34 +01:00
William S Fulton
32e7074d9b Whitespace fixes in STL wrappers 2017-06-03 18:36:59 +01:00
William S Fulton
fdca8e9829 Better variable naming consistency in STL containers 2017-05-26 22:37:29 +01:00
William S Fulton
2ec156fb7f Merge branch 'vadz-csharp-complex'
* vadz-csharp-complex:
  Add header to std_complex.i
  Fix linkage problems in C# std::complex wrappers
  C# std::complex wrappers marshalling by value
  C# std::complex wrappers SwigValueWrapper fix
  Use %naturalvar for C# std::complex wrappers
  Allow avoiding generation of unwanted std::complex<T> typemaps
  Also apply csvar{in,out} typemaps to std::complex references
  Add std_complex.i for C# too
  Extend C# complex support to member variables of this type
  Add support for std::complex<> to C#
  Use new unified Mono mcs compiler if available under Unix
2017-05-20 15:21:48 +01:00
William S Fulton
fb941315c1 Add header to std_complex.i 2017-05-19 20:25:15 +01:00
William S Fulton
57ec5ec056 Fix linkage problems in C# std::complex wrappers
Fix warnings and subsequent exception trying to use wrappers:
Warning C4190: 'CSharp_complextestNamespace_VectorStdCplx_getitemcopy'
has C-linkage specified, but returns UDT 'SwigSystemNumericsComplex'
which is incompatible with C

Rename swig_complex_typemaps macro to SWIG_COMPLEX_TYPEMAPS
2017-05-19 19:52:39 +01:00
William S Fulton
e11e1c4cb8 C# std::complex wrappers marshalling by value
Change the wrapping to marshall directly to the .net
System.Numerics.Complex type instead of using an intermediate
std::complex .net type.
2017-05-19 08:15:01 +01:00
William S Fulton
8c13ee2411 C# std::complex wrappers SwigValueWrapper fix
Fix std::complex constructor declaration to stop SwigValueWrapper from
being generated
2017-05-19 07:10:43 +01:00
William S Fulton
bb758d7810 Use %naturalvar for C# std::complex wrappers 2017-05-19 06:58:54 +01:00
William S Fulton
07ab80b49e Add raise methods for throwing c++ exceptions in C#, Java, D
The director c++ exceptions are thrown in a helper method instead of in
the director overloaded method. This circumvents compiler warnings about
throwing exceptions when the method has an exception specification or
noexcept. If the exception is thrown, abort will still be called!
In Java, the "director:noexcept" typemap can be used to do something
else. This typemap should be ported to the other languages too.
2017-05-13 17:01:15 +01:00
William S Fulton
ab1e9f5bd9 Consistent whitespace amongst all the shared_ptr and intrusive_ptr typemaps
[skip ci]
2017-04-20 19:21:47 +01:00
Vadim Zeitlin
03f229b314 Allow avoiding generation of unwanted std::complex<T> typemaps
In many cases, only one of std::complex<double> and std::complex<float> is
used, so while we continue to define typemaps for both by default, for
compatibility with the other modules, add a possibility to avoid generating
the code for the unwanted specialization by predefining the corresponding
SWIG_NO_STD_COMPLEX_$TYPE before including this file.
2017-04-15 20:28:30 +02:00
Vadim Zeitlin
95aa3d9389 Also apply csvar{in,out} typemaps to std::complex references
This is needed to handle the artificial complex-valued properties created
using %naturalvar correctly.
2017-04-15 20:18:24 +02:00
Vadim Zeitlin
485efd511f Add std_complex.i for C# too
For consistency with the other modules (Python, Ruby and JS), allow including
<std_complex.i> directly when using C# too instead of including <complex.i>
which only works in C++ mode (i.e. when using std::complex) anyhow with C# for
now.
2017-04-14 19:23:31 +02:00
Vadim Zeitlin
ec565f74cf Extend C# complex support to member variables of this type
Define csvar{in,out} typemaps needed to support properties of complex type and
apply the existing cstype and csin ones to them as well.

Add unit test verifying that this works as expected in C# and, also, in
Python, even though no changes were needed there.
2017-04-01 23:51:45 +02:00
Vadim Zeitlin
aa047c43f7 Add support for std::complex<> to C#
Create Lib/csharp/complex.i with simplest possible typemaps mapping
std::complex<> to System.Numerics.Complex.
2017-04-01 23:51:45 +02:00
William S Fulton
279744603f Merge branch 'vadz-use-cstype-vector-typemap'
* vadz-use-cstype-vector-typemap:
  Don't hardcode C# type corresponding to size_t in vector typemaps
2017-03-24 07:29:41 +00:00
William S Fulton
72ba741d1c Fix wrapping of references/pointers and qualifiers to member pointers
Also fix Go wrapping of member const function pointers.
2017-03-16 21:04:38 +00:00
Vadim Zeitlin
bf11d5ee7a Don't hardcode C# type corresponding to size_t in vector typemaps
The C# type corresponding to size_t may be changed by redefining its "cstype"
type typemap, but this broke compilation of the code using std::vector<> as
the typemap generating it assumed that size_t was always represented by uint
in C#. Make this work in all cases by explicitly looking up cstype of size_t
instead.

Notice that it may be quite useful, and even necessary, to map size_t to int
as when generating C# assembly for use with COM, via .NET interop, as some COM
clients, notably VBA-using ones, including all Microsoft Office applications,
don't support unsigned types and can't call methods using or returning uint in
C# at all.
2017-03-15 23:17:03 +01:00
Jean-Claude Manoli
18ac3030df Replace ICollection with IEnumerable<T>
Adding a constructor that accepts IEnumerable<T> avoids the boxing and unboxing overhead of the original constructor, when the type parameter is a value type. This also allows passing IList<T>, which does not implement ICollection (ironically the generated type implements IList<T>).

Kept the original constructor for backward compatibility, but replaced ICollection with IEnumerable for added flexibility.
2017-02-05 08:02:14 +01:00
William S Fulton
449aa08124 %extend changes and remove default use of javatype, dtype, cstype %typemaps
1) The %extend directive can now optionally support one of the 'class', 'struct' or 'union'.
2) The SWIG library no longer uses the javatype, dtype or cstype typemaps, thereby
   completely freeing them up for users to use without having to replicate the library
   code that they previously added

Tested by changes to test: java_lib_arrays
2017-01-15 16:50:24 +00:00
William S Fulton
3d2e57b0f2 Add %proxycode directive for adding code into proxy classes for C#, D and Java 2017-01-13 20:43:50 +00:00
William S Fulton
d48b1712a8 Merge branch 'myd7349-master'
* myd7349-master:
  Convert the Java runtime testcase cpp11_li_std_array_runme to C#
  Add C++11 std::array interface file for C#
  SWIG_STD_VECTOR_ENHANCED for std::wstring
2016-10-30 22:27:47 +00:00
William S Fulton
e9e6a99f0f Add missing VOID_INT_PTR director typemaps 2016-10-23 16:18:05 +01:00
Daniel Vollmer
ce1cb85d86 Add <typeinfo> header for std::bad_cast 2016-09-17 13:24:32 +02:00
Daniel Vollmer
2dc87d7485 Add std::bad_cast to std_except.i
This exception occurs when dynamic_cast<T&> fails.

Fixes #783.
2016-09-17 10:26:54 +02:00
Heinrich Schuchardt
073948777e Csharp: CLS compliance - keyword rename
SWIG C# can be used to wrap native libraries as common language
interface compatible assemblies.
If you want to use the assemblies with other languages like
Visual Basic these assemblies should comply to the
Common Language Specification (CLS).

Lib/csharp/csharpkw.swg defines rename rules to avoid collisions
with keywords. Unfortunately these rules prepend an underscore.
Parameters starting with underscores are not CLS compliant.

Hence the rules should be changed to append the underscore
instead of prepending it.

Tested with
make check-csharp-test-suite

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: Olly Betts <olly@survex.com>
2016-09-09 16:40:18 +02:00
myd7349
b1151b34f2 Add C++11 std::array interface file for C# 2016-07-05 10:41:59 +08:00
myd7349
46791437a4 SWIG_STD_VECTOR_ENHANCED for std::wstring 2016-07-04 14:28:46 +08:00
William S Fulton
06c47fbcdc Correct file format to unix 2016-05-28 00:45:24 +01:00
William S Fulton
ff21a0bca9 Remove unused variables from C# boost::intrusive_ptr wrappers 2016-05-28 00:45:24 +01:00
William S Fulton
98a31ff633 Fix directorin SWIGTYPE typemaps to make a copy as these are used for pass by value.
Closes #434
2016-05-14 21:32:24 +01:00
William S Fulton
dc4e0ab0f6 interface macro argument name tweaks 2016-03-11 19:47:08 +00:00
William S Fulton
e1dfad1a3b Change the name of the interface in %feature to be more portable
Use SwigInterface as a suffix to the class name when naming the
interface class instead of using a simple I as a prefix.
%feature_custom can be used to use I as a prefix if so desired.
2016-03-08 08:42:16 +00:00
William S Fulton
5cf20086a4 Rename feature_interface.i to swiginterface.i 2016-03-03 08:55:20 +00:00
William S Fulton
7f3f8fd76a Use rstrip instead of regex encoder in %feature_rename
The regex encoder is not always available in SWIG builds.
2016-03-03 08:55:10 +00:00