Remove using directives from the generated C# code and fully qualify the use of all .NET framework types in order to minimize potential name collisions from input files defining types, namespace, etc with the same name as .NET framework members.

This commit is contained in:
Brant K. Kyser 2013-10-17 15:44:24 -05:00
commit adb93980f2
14 changed files with 200 additions and 211 deletions

View file

@ -116,7 +116,7 @@ struct PrePost3 {
// Check attributes in the typemaps
%typemap(cstype, inattributes="[CustomInt]") int val "int"
%typemap(csin, pre=" int tmp_$csinput = $csinput * 100;") int val "tmp_$csinput"
%typemap(imtype, out="IntPtr/*overridden*/", outattributes="[CustomIntPtr]") CsinAttributes * "HandleRef/*overridden*/"
%typemap(imtype, out="global::System.IntPtr/*overridden*/", outattributes="[CustomIntPtr]") CsinAttributes * "global::System.Runtime.InteropServices.HandleRef/*overridden*/"
%inline %{
class CsinAttributes {
@ -216,8 +216,8 @@ void subtractYears(CDate *pDate, int years) {
%typemap(csvarout, excode=SWIGEXCODE2) CDate * %{
/* csvarout typemap code */
get {
IntPtr cPtr = $imcall;
CDate tempDate = (cPtr == IntPtr.Zero) ? null : new CDate(cPtr, $owner);$excode
global::System.IntPtr cPtr = $imcall;
CDate tempDate = (cPtr == global::System.IntPtr.Zero) ? null : new CDate(cPtr, $owner);$excode
return new System.DateTime(tempDate.getYear(), tempDate.getMonth(), tempDate.getDay(),
0, 0, 0);
} %}

View file

@ -94,7 +94,7 @@ Number times12(const Number* num) {
%typemap(csvarin, excode=SWIGEXCODE2) int %{
set {
if ($csinput < 0)
throw new ApplicationException("number too small!");
throw new global::System.ApplicationException("number too small!");
$imcall;$excode
} %}

View file

@ -188,7 +188,7 @@ namespace Space {
#if defined(SWIGCSHARP)
%typemap(cscode) Space::RenameMe %{
public static NewName factory(String s) {
public static NewName factory(System.String s) {
//below should expand to:
//return new NewName( new Name(s) );
return new $typemap(cstype, Space::RenameMe)( new $typemap(cstype, Name)(s) );