Permalink
Browse files

Add C# typemaps for style pattern

  • Loading branch information...
szekerest committed Nov 17, 2012
1 parent 6c9d17a commit 62d58131336edfbfa96f2b8ef61e17920fdfd77b
Showing with 26 additions and 0 deletions.
  1. +26 −0 mapscript/csharp/csmodule.i
@@ -380,6 +380,32 @@ DllExport void SWIGSTDCALL SWIGRegisterByteArrayCallback_$module(SWIG_CSharpByte
#endif
%}
/* Typemaps for pattern array */
%typemap(imtype) (double pattern[ANY]) "IntPtr"
%typemap(cstype) (double pattern[ANY]) "double[]"
%typemap(in) (double pattern[ANY]) %{ $1 = ($1_ltype)$input; %}
%typemap(csin) (double pattern[ANY]) "$csinput"
%typemap(csvarout, excode=SWIGEXCODE2) (double pattern[ANY]) %{
get {
IntPtr cPtr = $imcall;
double[] ret = new double[patternlength];
if (patternlength > 0) {
System.Runtime.InteropServices.Marshal.Copy(cPtr, ret, 0, patternlength);
}
$excode
return ret;
}
set {
IntPtr cPtr = $imcall;
if (value.Length > 0) {
System.Runtime.InteropServices.Marshal.Copy(value, 0, cPtr, value.Length);
}
patternlength = value.Length;
$excode
}
%}
%typemap(csvarin, excode=SWIGEXCODE2) (double pattern[ANY]) %{%}
/* Typemaps for device handle */
%typemap(imtype) (void* device) %{IntPtr%}
%typemap(cstype) (void* device) %{IntPtr%}

0 comments on commit 62d5813

Please sign in to comment.