[mapserver-commits] r7210 - in trunk/mapserver/mapscript: csharp swiginc

svn at osgeo.org svn at osgeo.org
Sun Dec 23 15:41:38 EST 2007


Author: tamas
Date: 2007-12-23 15:41:38 -0500 (Sun, 23 Dec 2007)
New Revision: 7210

Modified:
   trunk/mapserver/mapscript/csharp/csmodule.i
   trunk/mapserver/mapscript/csharp/swig_csharp_extensions.i
   trunk/mapserver/mapscript/swiginc/class.i
   trunk/mapserver/mapscript/swiginc/layer.i
   trunk/mapserver/mapscript/swiginc/map.i
Log:
Added %typemap(csin) SWIGTYPE *SETREFERENCE and fixed the RFC-24 test failures. (#2442)

Modified: trunk/mapserver/mapscript/csharp/csmodule.i
===================================================================
--- trunk/mapserver/mapscript/csharp/csmodule.i	2007-12-23 20:29:33 UTC (rev 7209)
+++ trunk/mapserver/mapscript/csharp/csmodule.i	2007-12-23 20:41:38 UTC (rev 7210)
@@ -328,7 +328,7 @@
  * with parent objects (causing nullreference exception, Bug 1743)
  *****************************************************************************/
 
-%typemap(csconstruct, excode=SWIGEXCODE) layerObj(mapObj map) %{: this($imcall, true , map) {
+%typemap(csconstruct, excode=SWIGEXCODE) layerObj(mapObj map) %{: this($imcall, true, map) {
   $excode
 }
 %}

Modified: trunk/mapserver/mapscript/csharp/swig_csharp_extensions.i
===================================================================
--- trunk/mapserver/mapscript/csharp/swig_csharp_extensions.i	2007-12-23 20:29:33 UTC (rev 7209)
+++ trunk/mapserver/mapscript/csharp/swig_csharp_extensions.i	2007-12-23 20:41:38 UTC (rev 7210)
@@ -1,6 +1,6 @@
 
 /******************************************************************************
- * $Id: swig_csharp_extensions.i 10898 2007-03-08 21:17:42Z tamas $
+ * $Id:  $
  *
  * Name:     swig_csharp_extensions.i
  * Purpose:  Fix for the SWIG Interface problems (early GC) 
@@ -58,10 +58,28 @@
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
   }
   internal static HandleRef getCPtrAndDisown($csclassname obj, object parent) {
-    obj.swigCMemOwn = false;
-    obj.swigParentRef = parent;
-    return getCPtr(obj);
+    if (obj != null)
+    {
+      obj.swigCMemOwn = false;
+      obj.swigParentRef = parent;
+      return obj.swigCPtr;
+    }
+    else
+    {
+      return new HandleRef(null, IntPtr.Zero);
+    }
   }
+  internal static HandleRef getCPtrAndSetReference($csclassname obj, object parent) {
+    if (obj != null)
+    {
+      obj.swigParentRef = parent;
+      return obj.swigCPtr;
+    }
+    else
+    {
+      return new HandleRef(null, IntPtr.Zero);
+    }
+  }
 %}
 
 // Derived proxy classes
@@ -75,11 +93,29 @@
   internal static HandleRef getCPtr($csclassname obj) {
     return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
   }
-  internal static HandleRef getCPtrAndDisown($csclassname obj, bool cMemoryOwn, object parent) {
-    obj.swigCMemOwn = cMemoryOwn;
-    obj.swigParentRef = parent;
-    return getCPtr(obj);
+  internal static HandleRef getCPtrAndDisown($csclassname obj, object parent) {
+    if (obj != null)
+    {
+      obj.swigCMemOwn = false;
+      obj.swigParentRef = parent;
+      return obj.swigCPtr;
+    }
+    else
+    {
+      return new HandleRef(null, IntPtr.Zero);
+    }
   }
+  internal static HandleRef getCPtrAndSetReference($csclassname obj, object parent) {
+    if (obj != null)
+    {
+      obj.swigParentRef = parent;
+      return obj.swigCPtr;
+    }
+    else
+    {
+      return new HandleRef(null, IntPtr.Zero);
+    }
+  }
 %}
 
 // Typewrapper classes
@@ -135,6 +171,7 @@
   }
 
 %typemap(csin) SWIGTYPE *DISOWN "$csclassname.getCPtrAndDisown($csinput, ThisOwn_false())"
+%typemap(csin) SWIGTYPE *SETREFERENCE "$csclassname.getCPtrAndSetReference($csinput, ThisOwn_false())"
 
 %pragma(csharp) modulecode=%{
   internal class $moduleObject : IDisposable {

Modified: trunk/mapserver/mapscript/swiginc/class.i
===================================================================
--- trunk/mapserver/mapscript/swiginc/class.i	2007-12-23 20:29:33 UTC (rev 7209)
+++ trunk/mapserver/mapscript/swiginc/class.i	2007-12-23 20:41:38 UTC (rev 7210)
@@ -193,7 +193,7 @@
     }
 
 #ifdef SWIGCSHARP
-%apply SWIGTYPE *DISOWN {styleObj *style};
+%apply SWIGTYPE *SETREFERENCE {styleObj *style};
 #endif
     int insertStyle(styleObj *style, int index=-1) {
         return msInsertStyle(self, style, index);

Modified: trunk/mapserver/mapscript/swiginc/layer.i
===================================================================
--- trunk/mapserver/mapscript/swiginc/layer.i	2007-12-23 20:29:33 UTC (rev 7209)
+++ trunk/mapserver/mapscript/swiginc/layer.i	2007-12-23 20:41:38 UTC (rev 7210)
@@ -123,7 +123,7 @@
     }
 
 #ifdef SWIGCSHARP   
-%apply SWIGTYPE *DISOWN {classObj *classobj};
+%apply SWIGTYPE *SETREFERENCE {classObj *classobj};
 #endif
     int insertClass(classObj *classobj, int index=-1)
     {

Modified: trunk/mapserver/mapscript/swiginc/map.i
===================================================================
--- trunk/mapserver/mapscript/swiginc/map.i	2007-12-23 20:29:33 UTC (rev 7209)
+++ trunk/mapserver/mapscript/swiginc/map.i	2007-12-23 20:41:38 UTC (rev 7210)
@@ -64,7 +64,7 @@
     }
 
 #ifdef SWIGCSHARP
-%apply SWIGTYPE *DISOWN {layerObj *layer};
+%apply SWIGTYPE *SETREFERENCE {layerObj *layer};
 #endif
     int insertLayer(layerObj *layer, int index=-1) 
     {



More information about the mapserver-commits mailing list