This commit is contained in:
FluorescentCIAAfricanAmerican
2020-04-22 12:56:21 -04:00
commit 3bf9df6b27
15370 changed files with 5489726 additions and 0 deletions
@@ -0,0 +1,229 @@
%include <shared_ptr.i>
%define SWIG_SHARED_PTR_TYPEMAPS(PROXYCLASS, CONST, TYPE...)
%naturalvar TYPE;
%naturalvar SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
// destructor mods
%feature("unref") TYPE
//"if (debug_shared) { cout << \"deleting use_count: \" << (*smartarg1).use_count() << \" [\" << (boost::get_deleter<SWIG_null_deleter>(*smartarg1) ? std::string(\"CANNOT BE DETERMINED SAFELY\") : ( (*smartarg1).get() ? (*smartarg1)->getValue() : std::string(\"NULL PTR\") )) << \"]\" << endl << flush; }\n"
"(void)arg1; delete smartarg1;"
// plain value
%typemap(in, canthrow=1) CONST TYPE ($&1_type argp = 0) %{
argp = ((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input) ? ((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input)->get() : 0;
if (!argp) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null $1_type", 0);
return $null;
}
$1 = *argp; %}
%typemap(out) CONST TYPE
%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1)); %}
// plain pointer
%typemap(in, canthrow=1) CONST TYPE * (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
smartarg = (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input;
$1 = (TYPE *)(smartarg ? smartarg->get() : 0); %}
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE * %{
$result = $1 ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner) : 0;
%}
// plain reference
%typemap(in, canthrow=1) CONST TYPE & %{
$1 = ($1_ltype)(((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input) ? ((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input)->get() : 0);
if(!$1) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type reference is null", 0);
return $null;
} %}
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE &
%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner); %}
// plain pointer by reference
%typemap(in) CONST TYPE *& ($*1_ltype temp = 0)
%{ temp = (((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input) ? ((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input)->get() : 0);
$1 = &temp; %}
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE *&
%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner); %}
// shared_ptr by value
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >
%{ if ($input) $1 = *($&1_ltype)$input; %}
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >
%{ $result = $1 ? new $1_ltype($1) : 0; %}
// shared_ptr by reference
%typemap(in, canthrow=1) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & ($*1_ltype tempnull)
%{ $1 = $input ? ($1_ltype)$input : &tempnull; %}
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &
%{ $result = *$1 ? new $*1_ltype(*$1) : 0; %}
// shared_ptr by pointer
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * ($*1_ltype tempnull)
%{ $1 = $input ? ($1_ltype)$input : &tempnull; %}
%typemap(out, fragment="SWIG_null_deleter") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *
%{ $result = ($1 && *$1) ? new $*1_ltype(*($1_ltype)$1) : 0;
if ($owner) delete $1; %}
// shared_ptr by pointer reference
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempnull, $*1_ltype temp = 0)
%{ temp = $input ? *($1_ltype)&$input : &tempnull;
$1 = &temp; %}
%typemap(out) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *&
%{ *($1_ltype)&$result = (*$1 && **$1) ? new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(**$1) : 0; %}
// various missing typemaps - If ever used (unlikely) ensure compilation error rather than runtime bug
%typemap(in) CONST TYPE[], CONST TYPE[ANY], CONST TYPE (CLASS::*) %{
#error "typemaps for $1_type not available"
%}
%typemap(out) CONST TYPE[], CONST TYPE[ANY], CONST TYPE (CLASS::*) %{
#error "typemaps for $1_type not available"
%}
%typemap (ctype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "void *"
%typemap (imtype, out="IntPtr") SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "HandleRef"
%typemap (cstype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "PROXYCLASS"
%typemap(csin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "PROXYCLASS.getCPtr($csinput)"
%typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > {
IntPtr cPtr = $imcall;
PROXYCLASS ret = (cPtr == IntPtr.Zero) ? null : new PROXYCLASS(cPtr, true);$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & {
IntPtr cPtr = $imcall;
PROXYCLASS ret = (cPtr == IntPtr.Zero) ? null : new PROXYCLASS(cPtr, true);$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * {
IntPtr cPtr = $imcall;
PROXYCLASS ret = (cPtr == IntPtr.Zero) ? null : new PROXYCLASS(cPtr, true);$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& {
IntPtr cPtr = $imcall;
PROXYCLASS ret = (cPtr == IntPtr.Zero) ? null : new PROXYCLASS(cPtr, true);$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) CONST TYPE {
PROXYCLASS ret = new PROXYCLASS($imcall, true);$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) CONST TYPE & {
PROXYCLASS ret = new PROXYCLASS($imcall, true);$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) CONST TYPE * {
IntPtr cPtr = $imcall;
PROXYCLASS ret = (cPtr == IntPtr.Zero) ? null : new PROXYCLASS(cPtr, true);$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) CONST TYPE *& {
IntPtr cPtr = $imcall;
PROXYCLASS ret = (cPtr == IntPtr.Zero) ? null : new PROXYCLASS(cPtr, true);$excode
return ret;
}
%typemap(csvarout, excode=SWIGEXCODE2) CONST TYPE & %{
get {
$csclassname ret = new $csclassname($imcall, true);$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) CONST TYPE * %{
get {
IntPtr cPtr = $imcall;
$csclassname ret = (cPtr == IntPtr.Zero) ? null : new $csclassname(cPtr, true);$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & %{
get {
IntPtr cPtr = $imcall;
PROXYCLASS ret = (cPtr == IntPtr.Zero) ? null : new PROXYCLASS(cPtr, true);$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * %{
get {
IntPtr cPtr = $imcall;
PROXYCLASS ret = (cPtr == IntPtr.Zero) ? null : new PROXYCLASS(cPtr, true);$excode
return ret;
} %}
// Proxy classes (base classes, ie, not derived classes)
%typemap(csbody) TYPE %{
private HandleRef swigCPtr;
private bool swigCMemOwnBase;
internal $csclassname(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwnBase = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr($csclassname obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
%}
// Derived proxy classes
%typemap(csbody_derived) TYPE %{
private HandleRef swigCPtr;
private bool swigCMemOwnDerived;
internal $csclassname(IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclassname_SWIGSharedPtrUpcast(cPtr), true) {
swigCMemOwnDerived = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr($csclassname obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
%}
%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") TYPE {
lock(this) {
if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwnBase) {
swigCMemOwnBase = false;
$imcall;
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
GC.SuppressFinalize(this);
}
}
%typemap(csdestruct_derived, methodname="Dispose", methodmodifiers="public") TYPE {
lock(this) {
if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwnDerived) {
swigCMemOwnDerived = false;
$imcall;
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
GC.SuppressFinalize(this);
base.Dispose();
}
}
%typemap(imtype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > swigSharedPtrUpcast "IntPtr"
%typemap(csin) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > swigSharedPtrUpcast "PROXYCLASS.getCPtr($csinput).Handle"
%template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
%enddef
@@ -0,0 +1,971 @@
/* -----------------------------------------------------------------------------
* See the LICENSE file for information on copyright, usage and redistribution
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
*
* csharp.swg
*
* C# typemaps
* ----------------------------------------------------------------------------- */
%include <csharphead.swg>
/* The ctype, imtype and cstype typemaps work together and so there should be one of each.
* The ctype typemap contains the PInvoke type used in the PInvoke (C/C++) code.
* The imtype typemap contains the C# type used in the intermediary class.
* The cstype typemap contains the C# type used in the C# proxy classes, type wrapper classes and module class. */
/* Fragments */
%fragment("SWIG_PackData", "header") {
/* Pack binary data into a string */
SWIGINTERN char * SWIG_PackData(char *c, void *ptr, size_t sz) {
static const char hex[17] = "0123456789abcdef";
register const unsigned char *u = (unsigned char *) ptr;
register const unsigned char *eu = u + sz;
for (; u != eu; ++u) {
register unsigned char uu = *u;
*(c++) = hex[(uu & 0xf0) >> 4];
*(c++) = hex[uu & 0xf];
}
return c;
}
}
%fragment("SWIG_UnPackData", "header") {
/* Unpack binary data from a string */
SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
register unsigned char *u = (unsigned char *) ptr;
register const unsigned char *eu = u + sz;
for (; u != eu; ++u) {
register char d = *(c++);
register unsigned char uu;
if ((d >= '0') && (d <= '9'))
uu = ((d - '0') << 4);
else if ((d >= 'a') && (d <= 'f'))
uu = ((d - ('a'-10)) << 4);
else
return (char *) 0;
d = *(c++);
if ((d >= '0') && (d <= '9'))
uu |= (d - '0');
else if ((d >= 'a') && (d <= 'f'))
uu |= (d - ('a'-10));
else
return (char *) 0;
*u = uu;
}
return c;
}
}
/* Primitive types */
%typemap(ctype) bool, const bool & "unsigned int"
%typemap(ctype) char, const char & "char"
%typemap(ctype) signed char, const signed char & "signed char"
%typemap(ctype) unsigned char, const unsigned char & "unsigned char"
%typemap(ctype) short, const short & "short"
%typemap(ctype) unsigned short, const unsigned short & "unsigned short"
%typemap(ctype) int, const int & "int"
%typemap(ctype) unsigned int, const unsigned int & "unsigned int"
%typemap(ctype) long, const long & "long"
%typemap(ctype) unsigned long, const unsigned long & "unsigned long"
%typemap(ctype) long long, const long long & "long long"
%typemap(ctype) unsigned long long, const unsigned long long & "unsigned long long"
%typemap(ctype) float, const float & "float"
%typemap(ctype) double, const double & "double"
%typemap(ctype) void "void"
%typemap(imtype) bool, const bool & "bool"
%typemap(imtype) char, const char & "char"
%typemap(imtype) signed char, const signed char & "sbyte"
%typemap(imtype) unsigned char, const unsigned char & "byte"
%typemap(imtype) short, const short & "short"
%typemap(imtype) unsigned short, const unsigned short & "ushort"
%typemap(imtype) int, const int & "int"
%typemap(imtype) unsigned int, const unsigned int & "uint"
%typemap(imtype) long, const long & "int"
%typemap(imtype) unsigned long, const unsigned long & "uint"
%typemap(imtype) long long, const long long & "long"
%typemap(imtype) unsigned long long, const unsigned long long & "ulong"
%typemap(imtype) float, const float & "float"
%typemap(imtype) double, const double & "double"
%typemap(imtype) void "void"
%typemap(cstype) bool, const bool & "bool"
%typemap(cstype) char, const char & "char"
%typemap(cstype) signed char, const signed char & "sbyte"
%typemap(cstype) unsigned char, const unsigned char & "byte"
%typemap(cstype) short, const short & "short"
%typemap(cstype) unsigned short, const unsigned short & "ushort"
%typemap(cstype) int, const int & "int"
%typemap(cstype) unsigned int, const unsigned int & "uint"
%typemap(cstype) long, const long & "int"
%typemap(cstype) unsigned long, const unsigned long & "uint"
%typemap(cstype) long long, const long long & "long"
%typemap(cstype) unsigned long long, const unsigned long long & "ulong"
%typemap(cstype) float, const float & "float"
%typemap(cstype) double, const double & "double"
%typemap(cstype) void "void"
%typemap(ctype) char *, char[ANY], char[] "char *"
%typemap(imtype) char *, char[ANY], char[] "string"
%typemap(cstype) char *, char[ANY], char[] "string"
/* Non primitive types */
%typemap(ctype) SWIGTYPE "void *"
%typemap(imtype, out="IntPtr") SWIGTYPE "HandleRef"
%typemap(cstype) SWIGTYPE "$&csclassname"
%typemap(ctype) SWIGTYPE [] "void *"
%typemap(imtype, out="IntPtr") SWIGTYPE [] "HandleRef"
%typemap(cstype) SWIGTYPE [] "$csclassname"
%typemap(ctype) SWIGTYPE * "void *"
%typemap(imtype, out="IntPtr") SWIGTYPE * "HandleRef"
%typemap(cstype) SWIGTYPE * "$csclassname"
%typemap(ctype) SWIGTYPE & "void *"
%typemap(imtype, out="IntPtr") SWIGTYPE & "HandleRef"
%typemap(cstype) SWIGTYPE & "$csclassname"
/* pointer to a class member */
%typemap(ctype) SWIGTYPE (CLASS::*) "char *"
%typemap(imtype) SWIGTYPE (CLASS::*) "string"
%typemap(cstype) SWIGTYPE (CLASS::*) "$csclassname"
/* The following are the in and out typemaps. These are the PInvoke code generating typemaps for converting from C# to C and visa versa. */
/* primitive types */
%typemap(in) bool
%{ $1 = $input ? true : false; %}
%typemap(directorout) bool
%{ $result = $input ? true : false; %}
%typemap(csdirectorin) bool "$iminput"
%typemap(csdirectorout) bool "$cscall"
%typemap(in) char,
signed char,
unsigned char,
short,
unsigned short,
int,
unsigned int,
long,
unsigned long,
long long,
unsigned long long,
float,
double
%{ $1 = ($1_ltype)$input; %}
%typemap(directorout) char,
signed char,
unsigned char,
short,
unsigned short,
int,
unsigned int,
long,
unsigned long,
long long,
unsigned long long,
float,
double
%{ $result = ($1_ltype)$input; %}
%typemap(directorin) bool "$input = $1;"
%typemap(directorin) char "$input = $1;"
%typemap(directorin) signed char "$input = $1;"
%typemap(directorin) unsigned char "$input = $1;"
%typemap(directorin) short "$input = $1;"
%typemap(directorin) unsigned short "$input = $1;"
%typemap(directorin) int "$input = $1;"
%typemap(directorin) unsigned int "$input = $1;"
%typemap(directorin) long "$input = $1;"
%typemap(directorin) unsigned long "$input = $1;"
%typemap(directorin) long long "$input = $1;"
%typemap(directorin) unsigned long long "$input = $1;"
%typemap(directorin) float "$input = $1;"
%typemap(directorin) double "$input = $1;"
%typemap(csdirectorin) char,
signed char,
unsigned char,
short,
unsigned short,
int,
unsigned int,
long,
unsigned long,
long long,
unsigned long long,
float,
double
"$iminput"
%typemap(csdirectorout) char,
signed char,
unsigned char,
short,
unsigned short,
int,
unsigned int,
long,
unsigned long,
long long,
unsigned long long,
float,
double
"$cscall"
%typemap(out) bool %{ $result = $1; %}
%typemap(out) char %{ $result = $1; %}
%typemap(out) signed char %{ $result = $1; %}
%typemap(out) unsigned char %{ $result = $1; %}
%typemap(out) short %{ $result = $1; %}
%typemap(out) unsigned short %{ $result = $1; %}
%typemap(out) int %{ $result = $1; %}
%typemap(out) unsigned int %{ $result = $1; %}
%typemap(out) long %{ $result = $1; %}
%typemap(out) unsigned long %{ $result = (unsigned long)$1; %}
%typemap(out) long long %{ $result = $1; %}
%typemap(out) unsigned long long %{ $result = $1; %}
%typemap(out) float %{ $result = $1; %}
%typemap(out) double %{ $result = $1; %}
/* char * - treat as String */
%typemap(in) char * %{ $1 = ($1_ltype)$input; %}
%typemap(out) char * %{ $result = SWIG_csharp_string_callback((const char *)$1); %}
%typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) char * %{ $result = ($1_ltype)$input; %}
%typemap(directorin) char * %{ $input = SWIG_csharp_string_callback((const char *)$1); %}
%typemap(csdirectorin) char * "$iminput"
%typemap(csdirectorout) char * "$cscall"
%typemap(out, null="") void ""
%typemap(csdirectorin) void "$iminput"
%typemap(csdirectorout) void "$cscall"
%typemap(directorin) void ""
/* primitive types by const reference */
%typemap(in) const bool & ($*1_ltype temp)
%{ temp = $input ? true : false;
$1 = &temp; %}
%typemap(directorout,warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const bool &
%{ static $*1_ltype temp;
temp = $input ? true : false;
$result = &temp; %}
%typemap(csdirectorin) const bool & "$iminput"
%typemap(csdirectorout) const bool & "$cscall"
%typemap(in) const char & ($*1_ltype temp),
const signed char & ($*1_ltype temp),
const unsigned char & ($*1_ltype temp),
const short & ($*1_ltype temp),
const unsigned short & ($*1_ltype temp),
const int & ($*1_ltype temp),
const unsigned int & ($*1_ltype temp),
const long & ($*1_ltype temp),
const unsigned long & ($*1_ltype temp),
const long long & ($*1_ltype temp),
const unsigned long long & ($*1_ltype temp),
const float & ($*1_ltype temp),
const double & ($*1_ltype temp)
%{ temp = ($*1_ltype)$input;
$1 = &temp; %}
%typemap(directorout,warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const char &,
const signed char &,
const unsigned char &,
const short &,
const unsigned short &,
const int &,
const unsigned int &,
const long &,
const unsigned long &,
const long long &,
const float &,
const double &
%{ static $*1_ltype temp;
temp = ($*1_ltype)$input;
$result = &temp; %}
%typemap(directorin) const bool & "$input = $1_name;"
%typemap(directorin) const char & "$input = $1_name;"
%typemap(directorin) const signed char & "$input = $1_name;"
%typemap(directorin) const unsigned char & "$input = $1_name;"
%typemap(directorin) const short & "$input = $1_name;"
%typemap(directorin) const unsigned short & "$input = $1_name;"
%typemap(directorin) const int & "$input = $1_name;"
%typemap(directorin) const unsigned int & "$input = $1_name;"
%typemap(directorin) const long & "$input = $1_name;"
%typemap(directorin) const unsigned long & "$input = $1_name;"
%typemap(directorin) const long long & "$input = $1_name;"
%typemap(directorin) const float & "$input = $1_name;"
%typemap(directorin) const double & "$input = $1_name;"
%typemap(csdirectorin) const char & ($*1_ltype temp),
const signed char & ($*1_ltype temp),
const unsigned char & ($*1_ltype temp),
const short & ($*1_ltype temp),
const unsigned short & ($*1_ltype temp),
const int & ($*1_ltype temp),
const unsigned int & ($*1_ltype temp),
const long & ($*1_ltype temp),
const unsigned long & ($*1_ltype temp),
const long long & ($*1_ltype temp),
const float & ($*1_ltype temp),
const double & ($*1_ltype temp)
"$iminput"
%typemap(csdirectorout) const char & ($*1_ltype temp),
const signed char & ($*1_ltype temp),
const unsigned char & ($*1_ltype temp),
const short & ($*1_ltype temp),
const unsigned short & ($*1_ltype temp),
const int & ($*1_ltype temp),
const unsigned int & ($*1_ltype temp),
const long & ($*1_ltype temp),
const unsigned long & ($*1_ltype temp),
const long long & ($*1_ltype temp),
const float & ($*1_ltype temp),
const double & ($*1_ltype temp)
"$cscall"
%typemap(out) const bool & %{ $result = *$1; %}
%typemap(out) const char & %{ $result = *$1; %}
%typemap(out) const signed char & %{ $result = *$1; %}
%typemap(out) const unsigned char & %{ $result = *$1; %}
%typemap(out) const short & %{ $result = *$1; %}
%typemap(out) const unsigned short & %{ $result = *$1; %}
%typemap(out) const int & %{ $result = *$1; %}
%typemap(out) const unsigned int & %{ $result = *$1; %}
%typemap(out) const long & %{ $result = *$1; %}
%typemap(out) const unsigned long & %{ $result = (unsigned long)*$1; %}
%typemap(out) const long long & %{ $result = *$1; %}
%typemap(out) const unsigned long long & %{ $result = *$1; %}
%typemap(out) const float & %{ $result = *$1; %}
%typemap(out) const double & %{ $result = *$1; %}
/* Default handling. Object passed by value. Convert to a pointer */
%typemap(in, canthrow=1) SWIGTYPE ($&1_type argp)
%{ argp = ($&1_ltype)$input;
if (!argp) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null $1_type", 0);
return $null;
}
$1 = *argp; %}
%typemap(directorout) SWIGTYPE
%{ if (!$input) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Unexpected null return for type $1_type", 0);
return $null;
}
$result = *($&1_ltype)$input; %}
%typemap(out) SWIGTYPE
#ifdef __cplusplus
%{ $result = new $1_ltype(($1_ltype &)$1); %}
#else
{
$&1_ltype $1ptr = ($&1_ltype) malloc(sizeof($1_ltype));
memmove($1ptr, &$1, sizeof($1_type));
$result = $1ptr;
}
#endif
%typemap(directorin) SWIGTYPE
%{ $input = (void *)&$1; %}
%typemap(csdirectorin) SWIGTYPE "new $&csclassname($iminput, false)"
%typemap(csdirectorout) SWIGTYPE "$&csclassname.getCPtr($cscall).Handle"
/* Generic pointers and references */
%typemap(in) SWIGTYPE * %{ $1 = ($1_ltype)$input; %}
%typemap(in, fragment="SWIG_UnPackData") SWIGTYPE (CLASS::*) %{
SWIG_UnpackData($input, (void *)&$1, sizeof($1));
%}
%typemap(in, canthrow=1) SWIGTYPE & %{ $1 = ($1_ltype)$input;
if(!$1) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type type is null", 0);
return $null;
} %}
%typemap(out) SWIGTYPE * %{ $result = (void *)$1; %}
%typemap(out, fragment="SWIG_PackData") SWIGTYPE (CLASS::*) %{
char buf[128];
char *data = SWIG_PackData(buf, (void *)&$1, sizeof($1));
*data = '\0';
$result = SWIG_csharp_string_callback(buf);
%}
%typemap(out) SWIGTYPE & %{ $result = (void *)$1; %}
%typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) SWIGTYPE *
%{ $result = ($1_ltype)$input; %}
%typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) SWIGTYPE (CLASS::*)
%{ $result = ($1_ltype)$input; %}
%typemap(directorin) SWIGTYPE *
%{ $input = (void *) $1; %}
%typemap(directorin) SWIGTYPE (CLASS::*)
%{ $input = (void *) $1; %}
%typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) SWIGTYPE &
%{ if (!$input) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Unexpected null return for type $1_type", 0);
return $null;
}
$result = ($1_ltype)$input; %}
%typemap(directorin) SWIGTYPE &
%{ $input = ($1_ltype) &$1; %}
%typemap(csdirectorin) SWIGTYPE *, SWIGTYPE (CLASS::*), SWIGTYPE & "new $csclassname($iminput, false)"
%typemap(csdirectorout) SWIGTYPE *, SWIGTYPE (CLASS::*), SWIGTYPE & "$csclassname.getCPtr($cscall).Handle"
/* Default array handling */
%typemap(in) SWIGTYPE [] %{ $1 = ($1_ltype)$input; %}
%typemap(out) SWIGTYPE [] %{ $result = $1; %}
/* char arrays - treat as String */
%typemap(in) char[ANY], char[] %{ $1 = ($1_ltype)$input; %}
%typemap(out) char[ANY], char[] %{ $result = SWIG_csharp_string_callback((const char *)$1); %}
%typemap(directorout) char[ANY], char[] %{ $result = ($1_ltype)$input; %}
%typemap(directorin) char[ANY], char[] %{ $input = SWIG_csharp_string_callback((const char *)$1); %}
%typemap(csdirectorin) char[ANY], char[] "$iminput"
%typemap(csdirectorout) char[ANY], char[] "$cscall"
/* Typecheck typemaps - The purpose of these is merely to issue a warning for overloaded C++ functions
* that cannot be overloaded in C# as more than one C++ type maps to a single C# type */
%typecheck(SWIG_TYPECHECK_BOOL)
bool,
const bool &
""
%typecheck(SWIG_TYPECHECK_CHAR)
char,
const char &
""
%typecheck(SWIG_TYPECHECK_INT8)
signed char,
const signed char &
""
%typecheck(SWIG_TYPECHECK_UINT8)
unsigned char,
const unsigned char &
""
%typecheck(SWIG_TYPECHECK_INT16)
short,
const short &
""
%typecheck(SWIG_TYPECHECK_UINT16)
unsigned short,
const unsigned short &
""
%typecheck(SWIG_TYPECHECK_INT32)
int,
long,
const int &,
const long &
""
%typecheck(SWIG_TYPECHECK_UINT32)
unsigned int,
unsigned long,
const unsigned int &,
const unsigned long &
""
%typecheck(SWIG_TYPECHECK_INT64)
long long,
const long long &
""
%typecheck(SWIG_TYPECHECK_UINT64)
unsigned long long,
const unsigned long long &
""
%typecheck(SWIG_TYPECHECK_FLOAT)
float,
const float &
""
%typecheck(SWIG_TYPECHECK_DOUBLE)
double,
const double &
""
%typecheck(SWIG_TYPECHECK_STRING)
char *,
char[ANY],
char[]
""
%typecheck(SWIG_TYPECHECK_POINTER)
SWIGTYPE,
SWIGTYPE *,
SWIGTYPE &,
SWIGTYPE [],
SWIGTYPE (CLASS::*)
""
/* Exception handling */
%typemap(throws, canthrow=1) int,
long,
short,
unsigned int,
unsigned long,
unsigned short
%{ char error_msg[256];
sprintf(error_msg, "C++ $1_type exception thrown, value: %d", $1);
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, error_msg);
return $null; %}
%typemap(throws, canthrow=1) SWIGTYPE, SWIGTYPE &, SWIGTYPE *, SWIGTYPE [ANY]
%{ (void)$1;
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, "C++ $1_type exception thrown");
return $null; %}
%typemap(throws, canthrow=1) char *
%{ SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1);
return $null; %}
/* Typemaps for code generation in proxy classes and C# type wrapper classes */
/* The csin typemap is used for converting function parameter types from the type
* used in the proxy, module or type wrapper class to the type used in the PInvoke class. */
%typemap(csin) bool, const bool &,
char, const char &,
signed char, const signed char &,
unsigned char, const unsigned char &,
short, const short &,
unsigned short, const unsigned short &,
int, const int &,
unsigned int, const unsigned int &,
long, const long &,
unsigned long, const unsigned long &,
long long, const long long &,
unsigned long long, const unsigned long long &,
float, const float &,
double, const double &
"$csinput"
%typemap(csin) char *, char[ANY], char[] "$csinput"
%typemap(csin) SWIGTYPE "$&csclassname.getCPtr($csinput)"
%typemap(csin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] "$csclassname.getCPtr($csinput)"
%typemap(csin) SWIGTYPE (CLASS::*) "$csclassname.getCMemberPtr($csinput)"
/* The csout typemap is used for converting function return types from the return type
* used in the PInvoke class to the type returned by the proxy, module or type wrapper class.
* The $excode special variable is replaced by the excode typemap attribute code if the
* method can throw any exceptions from unmanaged code, otherwise replaced by nothing. */
// Macro used by the $excode special variable
%define SWIGEXCODE "\n if ($imclassname.SWIGPendingException.Pending) throw $imclassname.SWIGPendingException.Retrieve();" %enddef
%define SWIGEXCODE2 "\n if ($imclassname.SWIGPendingException.Pending) throw $imclassname.SWIGPendingException.Retrieve();" %enddef
%typemap(csout, excode=SWIGEXCODE) bool, const bool & {
bool ret = $imcall;$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) char, const char & {
char ret = $imcall;$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) signed char, const signed char & {
sbyte ret = $imcall;$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) unsigned char, const unsigned char & {
byte ret = $imcall;$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) short, const short & {
short ret = $imcall;$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) unsigned short, const unsigned short & {
ushort ret = $imcall;$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) int, const int & {
int ret = $imcall;$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) unsigned int, const unsigned int & {
uint ret = $imcall;$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) long, const long & {
int ret = $imcall;$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) unsigned long, const unsigned long & {
uint ret = $imcall;$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) long long, const long long & {
long ret = $imcall;$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) unsigned long long, const unsigned long long & {
ulong ret = $imcall;$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) float, const float & {
float ret = $imcall;$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) double, const double & {
double ret = $imcall;$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) char *, char[ANY], char[] {
string ret = $imcall;$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) void {
$imcall;$excode
}
%typemap(csout, excode=SWIGEXCODE) SWIGTYPE {
$&csclassname ret = new $&csclassname($imcall, true);$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) SWIGTYPE & {
$csclassname ret = new $csclassname($imcall, $owner);$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) SWIGTYPE *, SWIGTYPE [] {
IntPtr cPtr = $imcall;
$csclassname ret = (cPtr == IntPtr.Zero) ? null : new $csclassname(cPtr, $owner);$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) SWIGTYPE (CLASS::*) {
string cMemberPtr = $imcall;
$csclassname ret = (cMemberPtr == null) ? null : new $csclassname(cMemberPtr, $owner);$excode
return ret;
}
/* Properties */
%typemap(csvarin, excode=SWIGEXCODE2) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
set {
$imcall;$excode
} %}
%typemap(csvarin, excode=SWIGEXCODE2) char *, char[ANY], char[] %{
set {
$imcall;$excode
} %}
%typemap(csvarout, excode=SWIGEXCODE2) bool, const bool & %{
get {
bool ret = $imcall;$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) char, const char & %{
get {
char ret = $imcall;$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) signed char, const signed char & %{
get {
sbyte ret = $imcall;$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) unsigned char, const unsigned char & %{
get {
byte ret = $imcall;$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) short, const short & %{
get {
short ret = $imcall;$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) unsigned short, const unsigned short & %{
get {
ushort ret = $imcall;$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) int, const int & %{
get {
int ret = $imcall;$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) unsigned int, const unsigned int & %{
get {
uint ret = $imcall;$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) long, const long & %{
get {
int ret = $imcall;$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) unsigned long, const unsigned long & %{
get {
uint ret = $imcall;$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) long long, const long long & %{
get {
long ret = $imcall;$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) unsigned long long, const unsigned long long & %{
get {
ulong ret = $imcall;$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) float, const float & %{
get {
float ret = $imcall;$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) double, const double & %{
get {
double ret = $imcall;$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) char *, char[ANY], char[] %{
get {
string ret = $imcall;$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) void %{
get {
$imcall;$excode
} %}
%typemap(csvarout, excode=SWIGEXCODE2) SWIGTYPE %{
get {
$&csclassname ret = new $&csclassname($imcall, true);$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) SWIGTYPE & %{
get {
$csclassname ret = new $csclassname($imcall, $owner);$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) SWIGTYPE *, SWIGTYPE [] %{
get {
IntPtr cPtr = $imcall;
$csclassname ret = (cPtr == IntPtr.Zero) ? null : new $csclassname(cPtr, $owner);$excode
return ret;
} %}
%typemap(csvarout, excode=SWIGEXCODE2) SWIGTYPE (CLASS::*) %{
get {
string cMemberPtr = $imcall;
$csclassname ret = (cMemberPtr == null) ? null : new $csclassname(cMemberPtr, $owner);$excode
return ret;
} %}
/* Pointer reference typemaps */
%typemap(ctype) SWIGTYPE *& "void *"
%typemap(imtype, out="IntPtr") SWIGTYPE *& "HandleRef"
%typemap(cstype) SWIGTYPE *& "$*csclassname"
%typemap(csin) SWIGTYPE *& "$*csclassname.getCPtr($csinput)"
%typemap(csout, excode=SWIGEXCODE) SWIGTYPE *& {
IntPtr cPtr = $imcall;
$*csclassname ret = (cPtr == IntPtr.Zero) ? null : new $*csclassname(cPtr, $owner);$excode
return ret;
}
%typemap(in) SWIGTYPE *& ($*1_ltype temp = 0)
%{ temp = ($*1_ltype)$input;
$1 = &temp; %}
%typemap(out) SWIGTYPE *&
%{ $result = (void *)*$1; %}
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* Typemaps used for the generation of proxy and type wrapper class code */
%typemap(csbase) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
%typemap(csclassmodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "public class"
%typemap(cscode) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
%typemap(csimports) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "\nusing System;\nusing System.Runtime.InteropServices;\n"
%typemap(csinterfaces) SWIGTYPE "IDisposable"
%typemap(csinterfaces) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
%typemap(csinterfaces_derived) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
// Proxy classes (base classes, ie, not derived classes)
%typemap(csbody) SWIGTYPE %{
private HandleRef swigCPtr;
protected bool swigCMemOwn;
internal $csclassname(IntPtr cPtr, bool cMemoryOwn) {
swigCMemOwn = cMemoryOwn;
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr($csclassname obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
%}
// Derived proxy classes
%typemap(csbody_derived) SWIGTYPE %{
private HandleRef swigCPtr;
internal $csclassname(IntPtr cPtr, bool cMemoryOwn) : base($imclassname.$csclassnameUpcast(cPtr), cMemoryOwn) {
swigCPtr = new HandleRef(this, cPtr);
}
internal static HandleRef getCPtr($csclassname obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
%}
// Typewrapper classes
%typemap(csbody) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] %{
private HandleRef swigCPtr;
internal $csclassname(IntPtr cPtr, bool futureUse) {
swigCPtr = new HandleRef(this, cPtr);
}
protected $csclassname() {
swigCPtr = new HandleRef(null, IntPtr.Zero);
}
internal static HandleRef getCPtr($csclassname obj) {
return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
}
%}
%typemap(csbody) SWIGTYPE (CLASS::*) %{
private string swigCMemberPtr;
internal $csclassname(string cMemberPtr, bool futureUse) {
swigCMemberPtr = cMemberPtr;
}
protected $csclassname() {
swigCMemberPtr = null;
}
internal static string getCMemberPtr($csclassname obj) {
return obj.swigCMemberPtr;
}
%}
%typemap(csfinalize) SWIGTYPE %{
~$csclassname() {
Dispose();
}
%}
%typemap(csconstruct, excode=SWIGEXCODE,directorconnect="\n SwigDirectorConnect();") SWIGTYPE %{: this($imcall, true) {$excode$directorconnect
}
%}
%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") SWIGTYPE {
lock(this) {
if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
swigCMemOwn = false;
$imcall;
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
GC.SuppressFinalize(this);
}
}
%typemap(csdestruct_derived, methodname="Dispose", methodmodifiers="public") SWIGTYPE {
lock(this) {
if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
swigCMemOwn = false;
$imcall;
}
swigCPtr = new HandleRef(null, IntPtr.Zero);
GC.SuppressFinalize(this);
base.Dispose();
}
}
%typemap(directordisconnect, methodname="swigDirectorDisconnect") SWIGTYPE %{
protected void $methodname() {
swigCMemOwn = false;
$imcall;
}
%}
/* C# specific directives */
#define %csconst(flag) %feature("cs:const","flag")
#define %csconstvalue(value) %feature("cs:constvalue",value)
#define %csenum(wrapapproach) %feature("cs:enum","wrapapproach")
#define %csmethodmodifiers %feature("cs:methodmodifiers")
#define %csnothrowexception %feature("except")
#define %csattributes %feature("cs:attributes")
%pragma(csharp) imclassclassmodifiers="class"
%pragma(csharp) moduleclassmodifiers="public class"
%pragma(csharp) moduleimports=%{
using System;
using System.Runtime.InteropServices;
%}
%pragma(csharp) imclassimports=%{
using System;
using System.Runtime.InteropServices;
%}
/* Some ANSI C typemaps */
%apply unsigned long { size_t };
%apply const unsigned long & { const size_t & };
/* csharp keywords */
%include <csharpkw.swg>
// Default enum handling
%include <enums.swg>
/*
// Alternative char * typemaps.
%pragma(csharp) imclasscode=%{
public class SWIGStringMarshal : IDisposable {
public readonly HandleRef swigCPtr;
public SWIGStringMarshal(string str) {
swigCPtr = new HandleRef(this, System.Runtime.InteropServices.Marshal.StringToHGlobalAnsi(str));
}
public virtual void Dispose() {
System.Runtime.InteropServices.Marshal.FreeHGlobal(swigCPtr.Handle);
GC.SuppressFinalize(this);
}
}
%}
%typemap(imtype, out="IntPtr") char *, char[ANY], char[] "HandleRef"
%typemap(out) char *, char[ANY], char[] %{ $result = $1; %}
%typemap(csin) char *, char[ANY], char[] "new $imclassname.SWIGStringMarshal($csinput).swigCPtr"
%typemap(csout, excode=SWIGEXCODE) char *, char[ANY], char[] {
string ret = System.Runtime.InteropServices.Marshal.PtrToStringAnsi($imcall);$excode
return ret;
}
%typemap(csvarin, excode=SWIGEXCODE2) char *, char[ANY], char[] %{
set {
$imcall;$excode
} %}
%typemap(csvarout, excode=SWIGEXCODE2) char *, char[ANY], char[] %{
get {
string ret = System.Runtime.InteropServices.Marshal.PtrToStringAnsi($imcall);$excode
return ret;
} %}
*/
@@ -0,0 +1,329 @@
/* -----------------------------------------------------------------------------
* See the LICENSE file for information on copyright, usage and redistribution
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
*
* csharphead.swg
*
* Support code for exceptions if the SWIG_CSHARP_NO_EXCEPTION_HELPER is not defined
* Support code for strings if the SWIG_CSHARP_NO_STRING_HELPER is not defined
* ----------------------------------------------------------------------------- */
%insert(runtime) %{
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
%}
#if !defined(SWIG_CSHARP_NO_EXCEPTION_HELPER)
%insert(runtime) %{
/* Support for throwing C# exceptions from C/C++. There are two types:
* Exceptions that take a message and ArgumentExceptions that take a message and a parameter name. */
typedef enum {
SWIG_CSharpApplicationException,
SWIG_CSharpArithmeticException,
SWIG_CSharpDivideByZeroException,
SWIG_CSharpIndexOutOfRangeException,
SWIG_CSharpInvalidCastException,
SWIG_CSharpInvalidOperationException,
SWIG_CSharpIOException,
SWIG_CSharpNullReferenceException,
SWIG_CSharpOutOfMemoryException,
SWIG_CSharpOverflowException,
SWIG_CSharpSystemException
} SWIG_CSharpExceptionCodes;
typedef enum {
SWIG_CSharpArgumentException,
SWIG_CSharpArgumentNullException,
SWIG_CSharpArgumentOutOfRangeException
} SWIG_CSharpExceptionArgumentCodes;
typedef void (SWIGSTDCALL* SWIG_CSharpExceptionCallback_t)(const char *);
typedef void (SWIGSTDCALL* SWIG_CSharpExceptionArgumentCallback_t)(const char *, const char *);
typedef struct {
SWIG_CSharpExceptionCodes code;
SWIG_CSharpExceptionCallback_t callback;
} SWIG_CSharpException_t;
typedef struct {
SWIG_CSharpExceptionArgumentCodes code;
SWIG_CSharpExceptionArgumentCallback_t callback;
} SWIG_CSharpExceptionArgument_t;
static SWIG_CSharpException_t SWIG_csharp_exceptions[] = {
{ SWIG_CSharpApplicationException, NULL },
{ SWIG_CSharpArithmeticException, NULL },
{ SWIG_CSharpDivideByZeroException, NULL },
{ SWIG_CSharpIndexOutOfRangeException, NULL },
{ SWIG_CSharpInvalidCastException, NULL },
{ SWIG_CSharpInvalidOperationException, NULL },
{ SWIG_CSharpIOException, NULL },
{ SWIG_CSharpNullReferenceException, NULL },
{ SWIG_CSharpOutOfMemoryException, NULL },
{ SWIG_CSharpOverflowException, NULL },
{ SWIG_CSharpSystemException, NULL }
};
static SWIG_CSharpExceptionArgument_t SWIG_csharp_exceptions_argument[] = {
{ SWIG_CSharpArgumentException, NULL },
{ SWIG_CSharpArgumentNullException, NULL },
{ SWIG_CSharpArgumentOutOfRangeException, NULL },
};
static void SWIGUNUSED SWIG_CSharpSetPendingException(SWIG_CSharpExceptionCodes code, const char *msg) {
SWIG_CSharpExceptionCallback_t callback = SWIG_csharp_exceptions[SWIG_CSharpApplicationException].callback;
if (code >=0 && (size_t)code < sizeof(SWIG_csharp_exceptions)/sizeof(SWIG_CSharpException_t)) {
callback = SWIG_csharp_exceptions[code].callback;
}
callback(msg);
}
static void SWIGUNUSED SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpExceptionArgumentCodes code, const char *msg, const char *param_name) {
SWIG_CSharpExceptionArgumentCallback_t callback = SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentException].callback;
if (code >=0 && (size_t)code < sizeof(SWIG_csharp_exceptions_argument)/sizeof(SWIG_CSharpExceptionArgument_t)) {
callback = SWIG_csharp_exceptions_argument[code].callback;
}
callback(msg, param_name);
}
%}
%insert(runtime) %{
#ifdef __cplusplus
extern "C"
#endif
SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionCallbacks_$module(
SWIG_CSharpExceptionCallback_t applicationCallback,
SWIG_CSharpExceptionCallback_t arithmeticCallback,
SWIG_CSharpExceptionCallback_t divideByZeroCallback,
SWIG_CSharpExceptionCallback_t indexOutOfRangeCallback,
SWIG_CSharpExceptionCallback_t invalidCastCallback,
SWIG_CSharpExceptionCallback_t invalidOperationCallback,
SWIG_CSharpExceptionCallback_t ioCallback,
SWIG_CSharpExceptionCallback_t nullReferenceCallback,
SWIG_CSharpExceptionCallback_t outOfMemoryCallback,
SWIG_CSharpExceptionCallback_t overflowCallback,
SWIG_CSharpExceptionCallback_t systemCallback) {
SWIG_csharp_exceptions[SWIG_CSharpApplicationException].callback = applicationCallback;
SWIG_csharp_exceptions[SWIG_CSharpArithmeticException].callback = arithmeticCallback;
SWIG_csharp_exceptions[SWIG_CSharpDivideByZeroException].callback = divideByZeroCallback;
SWIG_csharp_exceptions[SWIG_CSharpIndexOutOfRangeException].callback = indexOutOfRangeCallback;
SWIG_csharp_exceptions[SWIG_CSharpInvalidCastException].callback = invalidCastCallback;
SWIG_csharp_exceptions[SWIG_CSharpInvalidOperationException].callback = invalidOperationCallback;
SWIG_csharp_exceptions[SWIG_CSharpIOException].callback = ioCallback;
SWIG_csharp_exceptions[SWIG_CSharpNullReferenceException].callback = nullReferenceCallback;
SWIG_csharp_exceptions[SWIG_CSharpOutOfMemoryException].callback = outOfMemoryCallback;
SWIG_csharp_exceptions[SWIG_CSharpOverflowException].callback = overflowCallback;
SWIG_csharp_exceptions[SWIG_CSharpSystemException].callback = systemCallback;
}
#ifdef __cplusplus
extern "C"
#endif
SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionArgumentCallbacks_$module(
SWIG_CSharpExceptionArgumentCallback_t argumentCallback,
SWIG_CSharpExceptionArgumentCallback_t argumentNullCallback,
SWIG_CSharpExceptionArgumentCallback_t argumentOutOfRangeCallback) {
SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentException].callback = argumentCallback;
SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentNullException].callback = argumentNullCallback;
SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentOutOfRangeException].callback = argumentOutOfRangeCallback;
}
%}
%pragma(csharp) imclasscode=%{
protected class SWIGExceptionHelper {
public delegate void ExceptionDelegate(string message);
public delegate void ExceptionArgumentDelegate(string message, string paramName);
static ExceptionDelegate applicationDelegate = new ExceptionDelegate(SetPendingApplicationException);
static ExceptionDelegate arithmeticDelegate = new ExceptionDelegate(SetPendingArithmeticException);
static ExceptionDelegate divideByZeroDelegate = new ExceptionDelegate(SetPendingDivideByZeroException);
static ExceptionDelegate indexOutOfRangeDelegate = new ExceptionDelegate(SetPendingIndexOutOfRangeException);
static ExceptionDelegate invalidCastDelegate = new ExceptionDelegate(SetPendingInvalidCastException);
static ExceptionDelegate invalidOperationDelegate = new ExceptionDelegate(SetPendingInvalidOperationException);
static ExceptionDelegate ioDelegate = new ExceptionDelegate(SetPendingIOException);
static ExceptionDelegate nullReferenceDelegate = new ExceptionDelegate(SetPendingNullReferenceException);
static ExceptionDelegate outOfMemoryDelegate = new ExceptionDelegate(SetPendingOutOfMemoryException);
static ExceptionDelegate overflowDelegate = new ExceptionDelegate(SetPendingOverflowException);
static ExceptionDelegate systemDelegate = new ExceptionDelegate(SetPendingSystemException);
static ExceptionArgumentDelegate argumentDelegate = new ExceptionArgumentDelegate(SetPendingArgumentException);
static ExceptionArgumentDelegate argumentNullDelegate = new ExceptionArgumentDelegate(SetPendingArgumentNullException);
static ExceptionArgumentDelegate argumentOutOfRangeDelegate = new ExceptionArgumentDelegate(SetPendingArgumentOutOfRangeException);
[DllImport("$dllimport", EntryPoint="SWIGRegisterExceptionCallbacks_$module")]
public static extern void SWIGRegisterExceptionCallbacks_$module(
ExceptionDelegate applicationDelegate,
ExceptionDelegate arithmeticDelegate,
ExceptionDelegate divideByZeroDelegate,
ExceptionDelegate indexOutOfRangeDelegate,
ExceptionDelegate invalidCastDelegate,
ExceptionDelegate invalidOperationDelegate,
ExceptionDelegate ioDelegate,
ExceptionDelegate nullReferenceDelegate,
ExceptionDelegate outOfMemoryDelegate,
ExceptionDelegate overflowDelegate,
ExceptionDelegate systemExceptionDelegate);
[DllImport("$dllimport", EntryPoint="SWIGRegisterExceptionArgumentCallbacks_$module")]
public static extern void SWIGRegisterExceptionCallbacksArgument_$module(
ExceptionArgumentDelegate argumentDelegate,
ExceptionArgumentDelegate argumentNullDelegate,
ExceptionArgumentDelegate argumentOutOfRangeDelegate);
static void SetPendingApplicationException(string message) {
SWIGPendingException.Set(new System.ApplicationException(message, SWIGPendingException.Retrieve()));
}
static void SetPendingArithmeticException(string message) {
SWIGPendingException.Set(new System.ArithmeticException(message, SWIGPendingException.Retrieve()));
}
static void SetPendingDivideByZeroException(string message) {
SWIGPendingException.Set(new System.DivideByZeroException(message, SWIGPendingException.Retrieve()));
}
static void SetPendingIndexOutOfRangeException(string message) {
SWIGPendingException.Set(new System.IndexOutOfRangeException(message, SWIGPendingException.Retrieve()));
}
static void SetPendingInvalidCastException(string message) {
SWIGPendingException.Set(new System.InvalidCastException(message, SWIGPendingException.Retrieve()));
}
static void SetPendingInvalidOperationException(string message) {
SWIGPendingException.Set(new System.InvalidOperationException(message, SWIGPendingException.Retrieve()));
}
static void SetPendingIOException(string message) {
SWIGPendingException.Set(new System.IO.IOException(message, SWIGPendingException.Retrieve()));
}
static void SetPendingNullReferenceException(string message) {
SWIGPendingException.Set(new System.NullReferenceException(message, SWIGPendingException.Retrieve()));
}
static void SetPendingOutOfMemoryException(string message) {
SWIGPendingException.Set(new System.OutOfMemoryException(message, SWIGPendingException.Retrieve()));
}
static void SetPendingOverflowException(string message) {
SWIGPendingException.Set(new System.OverflowException(message, SWIGPendingException.Retrieve()));
}
static void SetPendingSystemException(string message) {
SWIGPendingException.Set(new System.SystemException(message, SWIGPendingException.Retrieve()));
}
static void SetPendingArgumentException(string message, string paramName) {
SWIGPendingException.Set(new System.ArgumentException(message, paramName, SWIGPendingException.Retrieve()));
}
static void SetPendingArgumentNullException(string message, string paramName) {
Exception e = SWIGPendingException.Retrieve();
if (e != null) message = message + " Inner Exception: " + e.Message;
SWIGPendingException.Set(new System.ArgumentNullException(paramName, message));
}
static void SetPendingArgumentOutOfRangeException(string message, string paramName) {
Exception e = SWIGPendingException.Retrieve();
if (e != null) message = message + " Inner Exception: " + e.Message;
SWIGPendingException.Set(new System.ArgumentOutOfRangeException(paramName, message));
}
static SWIGExceptionHelper() {
SWIGRegisterExceptionCallbacks_$module(
applicationDelegate,
arithmeticDelegate,
divideByZeroDelegate,
indexOutOfRangeDelegate,
invalidCastDelegate,
invalidOperationDelegate,
ioDelegate,
nullReferenceDelegate,
outOfMemoryDelegate,
overflowDelegate,
systemDelegate);
SWIGRegisterExceptionCallbacksArgument_$module(
argumentDelegate,
argumentNullDelegate,
argumentOutOfRangeDelegate);
}
}
protected static SWIGExceptionHelper swigExceptionHelper = new SWIGExceptionHelper();
public class SWIGPendingException {
[ThreadStatic]
private static Exception pendingException = null;
private static int numExceptionsPending = 0;
public static bool Pending {
get {
bool pending = false;
if (numExceptionsPending > 0)
if (pendingException != null)
pending = true;
return pending;
}
}
public static void Set(Exception e) {
if (pendingException != null)
throw new ApplicationException("FATAL: An earlier pending exception from unmanaged code was missed and thus not thrown (" + pendingException.ToString() + ")", e);
pendingException = e;
lock(typeof($imclassname)) {
numExceptionsPending++;
}
}
public static Exception Retrieve() {
Exception e = null;
if (numExceptionsPending > 0) {
if (pendingException != null) {
e = pendingException;
pendingException = null;
lock(typeof($imclassname)) {
numExceptionsPending--;
}
}
}
return e;
}
}
%}
#endif // SWIG_CSHARP_NO_EXCEPTION_HELPER
#if !defined(SWIG_CSHARP_NO_STRING_HELPER)
%insert(runtime) %{
/* Callback for returning strings to C# without leaking memory */
typedef char * (SWIGSTDCALL* SWIG_CSharpStringHelperCallback)(const char *);
static SWIG_CSharpStringHelperCallback SWIG_csharp_string_callback = NULL;
%}
%pragma(csharp) imclasscode=%{
protected class SWIGStringHelper {
public delegate string SWIGStringDelegate(string message);
static SWIGStringDelegate stringDelegate = new SWIGStringDelegate(CreateString);
[DllImport("$dllimport", EntryPoint="SWIGRegisterStringCallback_$module")]
public static extern void SWIGRegisterStringCallback_$module(SWIGStringDelegate stringDelegate);
static string CreateString(string cString) {
return cString;
}
static SWIGStringHelper() {
SWIGRegisterStringCallback_$module(stringDelegate);
}
}
static protected SWIGStringHelper swigStringHelper = new SWIGStringHelper();
%}
%insert(runtime) %{
#ifdef __cplusplus
extern "C"
#endif
SWIGEXPORT void SWIGSTDCALL SWIGRegisterStringCallback_$module(SWIG_CSharpStringHelperCallback callback) {
SWIG_csharp_string_callback = callback;
}
%}
#endif // SWIG_CSHARP_NO_STRING_HELPER
%insert(runtime) %{
/* Contract support */
#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentOutOfRangeException, msg, ""); return nullreturn; } else
%}
@@ -0,0 +1,94 @@
#ifndef CSHARP_CSHARPKW_SWG_
#define CSHARP_CSHARPKW_SWG_
/* Warnings for C# keywords */
#define CSHARPKW(x) %namewarn("314:" #x " is a csharp keyword") #x
/*
from
http://www.jaggersoft.com/csharp_grammar.html#1.7%20Keywords
*/
CSHARPKW(abstract);
CSHARPKW(as);
CSHARPKW(base);
CSHARPKW(bool);
CSHARPKW(break);
CSHARPKW(byte);
CSHARPKW(case);
CSHARPKW(catch);
CSHARPKW(char);
CSHARPKW(checked);
CSHARPKW(class);
CSHARPKW(const);
CSHARPKW(continue);
CSHARPKW(decimal);
CSHARPKW(default);
CSHARPKW(delegate);
CSHARPKW(do);
CSHARPKW(double);
CSHARPKW(else);
CSHARPKW(enum);
CSHARPKW(event);
CSHARPKW(explicit);
CSHARPKW(extern);
CSHARPKW(false);
CSHARPKW(finally);
CSHARPKW(fixed);
CSHARPKW(float);
CSHARPKW(for);
CSHARPKW(foreach);
CSHARPKW(goto);
CSHARPKW(if);
CSHARPKW(implicit);
CSHARPKW(in);
CSHARPKW(int);
CSHARPKW(interface);
CSHARPKW(internal);
CSHARPKW(is);
CSHARPKW(lock);
CSHARPKW(long);
CSHARPKW(namespace);
CSHARPKW(new);
CSHARPKW(null);
CSHARPKW(object);
CSHARPKW(operator);
CSHARPKW(out);
CSHARPKW(override);
CSHARPKW(params);
CSHARPKW(private);
CSHARPKW(protected);
CSHARPKW(public);
CSHARPKW(readonly);
CSHARPKW(ref);
CSHARPKW(return);
CSHARPKW(sbyte);
CSHARPKW(sealed);
CSHARPKW(short);
CSHARPKW(sizeof);
CSHARPKW(stackalloc);
CSHARPKW(static);
CSHARPKW(struct);
CSHARPKW(string);
CSHARPKW(switch);
CSHARPKW(this);
CSHARPKW(throw);
CSHARPKW(true);
CSHARPKW(try);
CSHARPKW(typeof);
CSHARPKW(uint);
CSHARPKW(ulong);
CSHARPKW(unchecked);
CSHARPKW(unsafe);
CSHARPKW(ushort);
CSHARPKW(using);
CSHARPKW(virtual);
CSHARPKW(void);
CSHARPKW(volatile);
CSHARPKW(while);
#undef CSHARPKW
#endif //CSHARP_CSHARPKW_SWG_
@@ -0,0 +1,50 @@
/* -----------------------------------------------------------------------------
* See the LICENSE file for information on copyright, usage and redistribution
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
*
* director.swg
*
* This file contains support for director classes so that C# proxy
* methods can be called from C++.
* ----------------------------------------------------------------------------- */
#ifdef __cplusplus
#if defined(DEBUG_DIRECTOR_OWNED)
#include <iostream>
#endif
#include <string>
namespace Swig {
/* Director base class - not currently used in C# directors */
class Director {
};
/* Base class for director exceptions */
class DirectorException {
protected:
std::string swig_msg;
public:
DirectorException(const char* msg) : swig_msg(msg) {
}
DirectorException(const std::string &msg) : swig_msg(msg) {
}
const std::string& what() const {
return swig_msg;
}
virtual ~DirectorException() {
}
};
/* Pure virtual method exception */
class DirectorPureVirtualException : public Swig::DirectorException {
public:
DirectorPureVirtualException(const char* msg) : DirectorException(std::string("Attempt to invoke pure virtual method ") + msg) {
}
};
}
#endif /* __cplusplus */
@@ -0,0 +1,89 @@
/* -----------------------------------------------------------------------------
* See the LICENSE file for information on copyright, usage and redistribution
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
*
* enums.swg
*
* Include this file in order for C/C++ enums to be wrapped by proper C# enums.
* Note that the PINVOKE layer handles the enum as an int.
* ----------------------------------------------------------------------------- */
// const enum SWIGTYPE & typemaps
%typemap(ctype) const enum SWIGTYPE & "int"
%typemap(imtype) const enum SWIGTYPE & "int"
%typemap(cstype) const enum SWIGTYPE & "$*csclassname"
%typemap(in) const enum SWIGTYPE & ($*1_ltype temp)
%{ temp = ($*1_ltype)$input;
$1 = &temp; %}
%typemap(out) const enum SWIGTYPE & %{ $result = *$1; %}
%typemap(directorout,warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const enum SWIGTYPE &
%{ static $*1_ltype temp = ($*1_ltype)$input;
$result = &temp; %}
%typemap(directorin) const enum SWIGTYPE & "$input = $1_name;"
%typemap(csdirectorin) const enum SWIGTYPE & "($*csclassname)$iminput"
%typemap(csdirectorout) const enum SWIGTYPE & "(int)$cscall"
%typecheck(SWIG_TYPECHECK_POINTER) const enum SWIGTYPE & ""
%typemap(throws, canthrow=1) const enum SWIGTYPE &
%{ (void)$1;
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, "C++ $1_type exception thrown");
return $null; %}
%typemap(csin) const enum SWIGTYPE & "(int)$csinput"
%typemap(csout, excode=SWIGEXCODE) const enum SWIGTYPE & {
$*csclassname ret = ($*csclassname)$imcall;$excode
return ret;
}
%typemap(csvarout, excode=SWIGEXCODE2) const enum SWIGTYPE & %{
get {
$*csclassname ret = ($*csclassname)$imcall;$excode
return ret;
} %}
// enum SWIGTYPE typemaps
%typemap(ctype) enum SWIGTYPE "int"
%typemap(imtype) enum SWIGTYPE "int"
%typemap(cstype) enum SWIGTYPE "$csclassname"
%typemap(in) enum SWIGTYPE %{ $1 = ($1_ltype)$input; %}
%typemap(out) enum SWIGTYPE %{ $result = $1; %}
%typemap(directorout) enum SWIGTYPE %{ $result = ($1_ltype)$input; %}
%typemap(directorin) enum SWIGTYPE "$input = $1;"
%typemap(csdirectorin) enum SWIGTYPE "($csclassname)$iminput"
%typemap(csdirectorout) enum SWIGTYPE "(int)$cscall"
%typecheck(SWIG_TYPECHECK_POINTER) enum SWIGTYPE ""
%typemap(throws, canthrow=1) enum SWIGTYPE
%{ (void)$1;
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, "C++ $1_type exception thrown");
return $null; %}
%typemap(csin) enum SWIGTYPE "(int)$csinput"
%typemap(csout, excode=SWIGEXCODE) enum SWIGTYPE {
$csclassname ret = ($csclassname)$imcall;$excode
return ret;
}
%typemap(csvarout, excode=SWIGEXCODE2) enum SWIGTYPE %{
get {
$csclassname ret = ($csclassname)$imcall;$excode
return ret;
} %}
%typemap(csbase) enum SWIGTYPE ""
%typemap(csclassmodifiers) enum SWIGTYPE "public enum"
%typemap(cscode) enum SWIGTYPE ""
%typemap(csimports) enum SWIGTYPE ""
%typemap(csinterfaces) enum SWIGTYPE ""
%typemap(csbody) enum SWIGTYPE ""
%csenum(proper);
@@ -0,0 +1,91 @@
/* -----------------------------------------------------------------------------
* See the LICENSE file for information on copyright, usage and redistribution
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
*
* enumsimple.swg
*
* This file provides backwards compatible enum wrapping. SWIG versions 1.3.21
* and earlier wrapped global enums with constant integers in the module
* class. Enums declared within a C++ class were wrapped by constant integers
* in the C# proxy class.
* ----------------------------------------------------------------------------- */
// const enum SWIGTYPE & typemaps
%typemap(ctype) const enum SWIGTYPE & "int"
%typemap(imtype) const enum SWIGTYPE & "int"
%typemap(cstype) const enum SWIGTYPE & "int"
%typemap(in) const enum SWIGTYPE & ($*1_ltype temp)
%{ temp = ($*1_ltype)$input;
$1 = &temp; %}
%typemap(out) const enum SWIGTYPE & %{ $result = *$1; %}
%typemap(directorout,warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const enum SWIGTYPE &
%{ static $*1_ltype temp = ($*1_ltype)$input;
$result = &temp; %}
%typemap(directorin) const enum SWIGTYPE & "$input = $1_name;"
%typemap(csdirectorin) const enum SWIGTYPE & "$iminput"
%typemap(csdirectorout) const enum SWIGTYPE & "$cscall"
%typecheck(SWIG_TYPECHECK_INT32) const enum SWIGTYPE & ""
%typemap(throws, canthrow=1) const enum SWIGTYPE &
%{ (void)$1;
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, "C++ $1_type exception thrown");
return $null; %}
%typemap(csin) const enum SWIGTYPE & "$csinput"
%typemap(csout, excode=SWIGEXCODE) const enum SWIGTYPE & {
int ret = $imcall;$excode
return ret;
}
%typemap(csvarout, excode=SWIGEXCODE2) const enum SWIGTYPE & %{
get {
int ret = $imcall;$excode
return ret;
} %}
// enum SWIGTYPE typemaps
%typemap(ctype) enum SWIGTYPE "int"
%typemap(imtype) enum SWIGTYPE "int"
%typemap(cstype) enum SWIGTYPE "int"
%typemap(in) enum SWIGTYPE %{ $1 = ($1_ltype)$input; %}
%typemap(out) enum SWIGTYPE %{ $result = $1; %}
%typemap(directorout) enum SWIGTYPE %{ $result = ($1_ltype)$input; %}
%typemap(directorin) enum SWIGTYPE "$input = $1;"
%typemap(csdirectorin) enum SWIGTYPE "$iminput"
%typemap(csdirectorout) enum SWIGTYPE "$cscall"
%typecheck(SWIG_TYPECHECK_INT32) enum SWIGTYPE ""
%typemap(throws, canthrow=1) enum SWIGTYPE
%{ (void)$1;
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, "C++ $1_type exception thrown");
return $null; %}
%typemap(csin) enum SWIGTYPE "$csinput"
%typemap(csout, excode=SWIGEXCODE) enum SWIGTYPE {
int ret = $imcall;$excode
return ret;
}
%typemap(csvarout, excode=SWIGEXCODE2) enum SWIGTYPE %{
get {
int ret = $imcall;$excode
return ret;
} %}
%typemap(csbase) enum SWIGTYPE ""
%typemap(csclassmodifiers) enum SWIGTYPE ""
%typemap(cscode) enum SWIGTYPE ""
%typemap(csimports) enum SWIGTYPE ""
%typemap(csinterfaces) enum SWIGTYPE ""
%typemap(csbody) enum SWIGTYPE ""
%csenum(simple);
@@ -0,0 +1,133 @@
/* -----------------------------------------------------------------------------
* See the LICENSE file for information on copyright, usage and redistribution
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
*
* enumtypesafe.swg
*
* Include this file in order for C/C++ enums to be wrapped by the so called
* typesafe enum pattern. Each enum has an equivalent C# class named after the
* enum and each enum item is a static instance of this class.
* ----------------------------------------------------------------------------- */
// const enum SWIGTYPE & typemaps
%typemap(ctype) const enum SWIGTYPE & "int"
%typemap(imtype) const enum SWIGTYPE & "int"
%typemap(cstype) const enum SWIGTYPE & "$*csclassname"
%typemap(in) const enum SWIGTYPE & ($*1_ltype temp)
%{ temp = ($*1_ltype)$input;
$1 = &temp; %}
%typemap(out) const enum SWIGTYPE & %{ $result = *$1; %}
%typemap(directorout,warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const enum SWIGTYPE &
%{ static $*1_ltype temp = ($*1_ltype)$input;
$result = &temp; %}
%typemap(directorin) const enum SWIGTYPE & "$input = $1_name;"
%typemap(csdirectorin) const enum SWIGTYPE & "$*csclassname.swigToEnum($iminput)"
%typemap(csdirectorout) const enum SWIGTYPE & "$cscall.swigValue"
%typecheck(SWIG_TYPECHECK_POINTER) const enum SWIGTYPE & ""
%typemap(throws, canthrow=1) const enum SWIGTYPE &
%{ (void)$1;
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, "C++ $1_type exception thrown");
return $null; %}
%typemap(csin) const enum SWIGTYPE & "$csinput.swigValue"
%typemap(csout, excode=SWIGEXCODE) const enum SWIGTYPE & {
$*csclassname ret = $*csclassname.swigToEnum($imcall);$excode
return ret;
}
%typemap(csvarout, excode=SWIGEXCODE2) const enum SWIGTYPE & %{
get {
$*csclassname ret = $*csclassname.swigToEnum($imcall);$excode
return ret;
} %}
// enum SWIGTYPE typemaps
%typemap(ctype) enum SWIGTYPE "int"
%typemap(imtype) enum SWIGTYPE "int"
%typemap(cstype) enum SWIGTYPE "$csclassname"
%typemap(in) enum SWIGTYPE %{ $1 = ($1_ltype)$input; %}
%typemap(out) enum SWIGTYPE %{ $result = $1; %}
%typemap(directorout) enum SWIGTYPE %{ $result = ($1_ltype)$input; %}
%typemap(directorin) enum SWIGTYPE "$input = $1;"
%typemap(csdirectorin) enum SWIGTYPE "$csclassname.swigToEnum($iminput)"
%typemap(csdirectorout) enum SWIGTYPE "$cscall.swigValue"
%typecheck(SWIG_TYPECHECK_POINTER) enum SWIGTYPE ""
%typemap(throws, canthrow=1) enum SWIGTYPE
%{ (void)$1;
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, "C++ $1_type exception thrown");
return $null; %}
%typemap(csin) enum SWIGTYPE "$csinput.swigValue"
%typemap(csout, excode=SWIGEXCODE) enum SWIGTYPE {
$csclassname ret = $csclassname.swigToEnum($imcall);$excode
return ret;
}
%typemap(csvarout, excode=SWIGEXCODE2) enum SWIGTYPE %{
get {
$csclassname ret = $csclassname.swigToEnum($imcall);$excode
return ret;
} %}
%typemap(csbase) enum SWIGTYPE ""
%typemap(csclassmodifiers) enum SWIGTYPE "public sealed class"
%typemap(cscode) enum SWIGTYPE ""
%typemap(csimports) enum SWIGTYPE ""
%typemap(csinterfaces) enum SWIGTYPE ""
/*
* The swigToEnum method is used to find the C# enum from a C++ enum integer value. The default one here takes
* advantage of the fact that most enums do not have initial values specified, so the lookup is fast. If initial
* values are specified then a lengthy linear search through all possible enums might occur. Specific typemaps could be
* written to possibly optimise this lookup by taking advantage of characteristics peculiar to the targeted enum.
* The special variable, $enumvalues, is replaced with a comma separated list of all the enum values.
*/
%typemap(csbody) enum SWIGTYPE %{
public readonly int swigValue;
public static $csclassname swigToEnum(int swigValue) {
if (swigValue < swigValues.Length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
return swigValues[swigValue];
for (int i = 0; i < swigValues.Length; i++)
if (swigValues[i].swigValue == swigValue)
return swigValues[i];
throw new System.ArgumentOutOfRangeException("No enum $csclassname with value " + swigValue);
}
public override string ToString() {
return swigName;
}
private $csclassname(string swigName) {
this.swigName = swigName;
this.swigValue = swigNext++;
}
private $csclassname(string swigName, int swigValue) {
this.swigName = swigName;
this.swigValue = swigValue;
swigNext = swigValue+1;
}
private $csclassname(string swigName, $csclassname swigEnum) {
this.swigName = swigName;
this.swigValue = swigEnum.swigValue;
swigNext = this.swigValue+1;
}
private static $csclassname[] swigValues = { $enumvalues };
private static int swigNext = 0;
private readonly string swigName;
%}
%csenum(typesafe);
@@ -0,0 +1,5 @@
%include <std_except.i>
%apply size_t { std::size_t };
%apply const size_t& { const std::size_t& };
@@ -0,0 +1 @@
%include <std/_std_deque.i>
@@ -0,0 +1,33 @@
/* -----------------------------------------------------------------------------
* See the LICENSE file for information on copyright, usage and redistribution
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
*
* std_except.i
*
* Typemaps used by the STL wrappers that throw exceptions. These typemaps are
* used when methods are declared with an STL exception specification, such as
* size_t at() const throw (std::out_of_range);
* ----------------------------------------------------------------------------- */
%{
#include <stdexcept>
%}
namespace std
{
%ignore exception;
struct exception {};
}
%typemap(throws, canthrow=1) std::bad_exception "SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.what());\n return $null;"
%typemap(throws, canthrow=1) std::domain_error "SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.what());\n return $null;"
%typemap(throws, canthrow=1) std::exception "SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.what());\n return $null;"
%typemap(throws, canthrow=1) std::invalid_argument "SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentException, $1.what(), \"\");\n return $null;"
%typemap(throws, canthrow=1) std::length_error "SWIG_CSharpSetPendingException(SWIG_CSharpIndexOutOfRangeException, $1.what());\n return $null;"
%typemap(throws, canthrow=1) std::logic_error "SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.what());\n return $null;"
%typemap(throws, canthrow=1) std::out_of_range "SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentOutOfRangeException, 0, $1.what());\n return $null;"
%typemap(throws, canthrow=1) std::overflow_error "SWIG_CSharpSetPendingException(SWIG_CSharpOverflowException, $1.what());\n return $null;"
%typemap(throws, canthrow=1) std::range_error "SWIG_CSharpSetPendingException(SWIG_CSharpIndexOutOfRangeException, $1.what());\n return $null;"
%typemap(throws, canthrow=1) std::runtime_error "SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.what());\n return $null;"
%typemap(throws, canthrow=1) std::underflow_error "SWIG_CSharpSetPendingException(SWIG_CSharpOverflowException, $1.what());\n return $null;"
@@ -0,0 +1,175 @@
/* -----------------------------------------------------------------------------
* See the LICENSE file for information on copyright, usage and redistribution
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
*
* std_map.i
*
* SWIG typemaps for std::map
* ----------------------------------------------------------------------------- */
%include <std_common.i>
// ------------------------------------------------------------------------
// std::map
// ------------------------------------------------------------------------
%{
#include <map>
#include <algorithm>
#include <stdexcept>
%}
// exported class
namespace std {
template<class K, class T> class map {
// add typemaps here
public:
map();
map(const map<K,T> &);
unsigned int size() const;
bool empty() const;
void clear();
%extend {
T& get(const K& key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
throw std::out_of_range("key not found");
}
void set(const K& key, const T& x) {
(*self)[key] = x;
}
void del(const K& key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
self->erase(i);
else
throw std::out_of_range("key not found");
}
bool has_key(const K& key) {
std::map<K,T >::iterator i = self->find(key);
return i != self->end();
}
}
};
// specializations for built-ins
%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
template<class T> class map<K,T> {
// add typemaps here
public:
map();
map(const map<K,T> &);
unsigned int size() const;
bool empty() const;
void clear();
%extend {
T& get(K key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
throw std::out_of_range("key not found");
}
void set(K key, const T& x) {
(*self)[key] = x;
}
void del(K key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
self->erase(i);
else
throw std::out_of_range("key not found");
}
bool has_key(K key) {
std::map<K,T >::iterator i = self->find(key);
return i != self->end();
}
}
};
%enddef
%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO)
template<class K> class map<K,T> {
// add typemaps here
public:
map();
map(const map<K,T> &);
unsigned int size() const;
bool empty() const;
void clear();
%extend {
T get(const K& key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
throw std::out_of_range("key not found");
}
void set(const K& key, T x) {
(*self)[key] = x;
}
void del(const K& key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
self->erase(i);
else
throw std::out_of_range("key not found");
}
bool has_key(const K& key) {
std::map<K,T >::iterator i = self->find(key);
return i != self->end();
}
}
};
%enddef
%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO,
T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO)
template<> class map<K,T> {
// add typemaps here
public:
map();
map(const map<K,T> &);
unsigned int size() const;
bool empty() const;
void clear();
%extend {
T get(K key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;
else
throw std::out_of_range("key not found");
}
void set(K key, T x) {
(*self)[key] = x;
}
void del(K key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
self->erase(i);
else
throw std::out_of_range("key not found");
}
bool has_key(K key) {
std::map<K,T >::iterator i = self->find(key);
return i != self->end();
}
}
};
%enddef
// add specializations here
}
@@ -0,0 +1,37 @@
/* -----------------------------------------------------------------------------
* See the LICENSE file for information on copyright, usage and redistribution
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
*
* std_pair.i
*
* SWIG typemaps for std::pair
* ----------------------------------------------------------------------------- */
%include <std_common.i>
%include <exception.i>
// ------------------------------------------------------------------------
// std::pair
// ------------------------------------------------------------------------
%{
#include <utility>
%}
namespace std {
template<class T, class U> struct pair {
pair();
pair(T t, U u);
pair(const pair& p);
template <class U1, class U2> pair(const pair<U1, U2> &p);
T first;
U second;
};
// add specializations here
}
@@ -0,0 +1,114 @@
/* -----------------------------------------------------------------------------
* See the LICENSE file for information on copyright, usage and redistribution
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
*
* std_string.i
*
* Typemaps for std::string and const std::string&
* These are mapped to a C# String and are passed around by value.
*
* To use non-const std::string references use the following %apply. Note
* that they are passed by value.
* %apply const std::string & {std::string &};
* ----------------------------------------------------------------------------- */
%{
#include <string>
%}
namespace std {
%naturalvar string;
class string;
// string
%typemap(ctype) string "char *"
%typemap(imtype) string "string"
%typemap(cstype) string "string"
%typemap(csdirectorin) string "$iminput"
%typemap(csdirectorout) string "$cscall"
%typemap(in, canthrow=1) string
%{ if (!$input) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0);
return $null;
}
$1.assign($input); %}
%typemap(out) string %{ $result = SWIG_csharp_string_callback($1.c_str()); %}
%typemap(directorout, canthrow=1) string
%{ if (!$input) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0);
return $null;
}
$result.assign($input); %}
%typemap(directorin) string %{ $input = SWIG_csharp_string_callback($1.c_str()); %}
%typemap(csin) string "$csinput"
%typemap(csout, excode=SWIGEXCODE) string {
string ret = $imcall;$excode
return ret;
}
%typemap(typecheck) string = char *;
%typemap(throws, canthrow=1) string
%{ SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.c_str());
return $null; %}
// const string &
%typemap(ctype) const string & "char *"
%typemap(imtype) const string & "string"
%typemap(cstype) const string & "string"
%typemap(csdirectorin) const string & "$iminput"
%typemap(csdirectorout) const string & "$cscall"
%typemap(in, canthrow=1) const string &
%{ if (!$input) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0);
return $null;
}
std::string $1_str($input);
$1 = &$1_str; %}
%typemap(out) const string & %{ $result = SWIG_csharp_string_callback($1->c_str()); %}
%typemap(csin) const string & "$csinput"
%typemap(csout, excode=SWIGEXCODE) const string & {
string ret = $imcall;$excode
return ret;
}
%typemap(directorout, canthrow=1, warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const string &
%{ if (!$input) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null string", 0);
return $null;
}
/* possible thread/reentrant code problem */
static std::string $1_str;
$1_str = $input;
$result = &$1_str; %}
%typemap(directorin) const string & %{ $input = SWIG_csharp_string_callback($1.c_str()); %}
%typemap(csvarin, excode=SWIGEXCODE2) const string & %{
set {
$imcall;$excode
} %}
%typemap(csvarout, excode=SWIGEXCODE2) const string & %{
get {
string ret = $imcall;$excode
return ret;
} %}
%typemap(typecheck) const string & = char *;
%typemap(throws, canthrow=1) const string &
%{ SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, $1.c_str());
return $null; %}
}
@@ -0,0 +1,384 @@
/* -----------------------------------------------------------------------------
* See the LICENSE file for information on copyright, usage and redistribution
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
*
* std_vector.i
*
* SWIG typemaps for std::vector
* C# implementation
* The C# wrapper is made to look and feel like a typesafe C# System.Collections.ArrayList
* All the methods in IList are defined, but we don't derive from IList as this is a typesafe collection.
* Warning: heavy macro usage in this file. Use swig -E to get a sane view on the real file contents!
*
* Very often the C# generated code will not compile as the C++ template type is not the same as the C#
* proxy type, so use the SWIG_STD_VECTOR_SPECIALIZE or SWIG_STD_VECTOR_SPECIALIZE_MINIMUM macro, eg
*
* SWIG_STD_VECTOR_SPECIALIZE_MINIMUM(Klass, SomeNamespace::Klass)
* %template(VectKlass) std::vector<SomeNamespace::Klass>;
* ----------------------------------------------------------------------------- */
// Warning: Use the typemaps here in the expectation that the macros they are in will change name.
%include <std_common.i>
// MACRO for use within the std::vector class body
// CSTYPE and CTYPE respectively correspond to the types in the cstype and ctype typemaps
%define SWIG_STD_VECTOR_MINIMUM(CSTYPE, CTYPE...)
%typemap(csinterfaces) std::vector<CTYPE > "IDisposable, System.Collections.IEnumerable";
%typemap(cscode) std::vector<CTYPE > %{
public $csclassname(System.Collections.ICollection c) : this() {
if (c == null)
throw new ArgumentNullException("c");
foreach (CSTYPE element in c) {
this.Add(element);
}
}
public bool IsFixedSize {
get {
return false;
}
}
public bool IsReadOnly {
get {
return false;
}
}
public CSTYPE this[int index] {
get {
return getitem(index);
}
set {
setitem(index, value);
}
}
public int Capacity {
get {
return (int)capacity();
}
set {
if (value < size())
throw new ArgumentOutOfRangeException("Capacity");
reserve((uint)value);
}
}
public int Count {
get {
return (int)size();
}
}
public bool IsSynchronized {
get {
return false;
}
}
public void CopyTo(System.Array array) {
CopyTo(0, array, 0, this.Count);
}
public void CopyTo(System.Array array, int arrayIndex) {
CopyTo(0, array, arrayIndex, this.Count);
}
public void CopyTo(int index, System.Array array, int arrayIndex, int count) {
if (array == null)
throw new ArgumentNullException("array");
if (index < 0)
throw new ArgumentOutOfRangeException("index", "Value is less than zero");
if (arrayIndex < 0)
throw new ArgumentOutOfRangeException("arrayIndex", "Value is less than zero");
if (count < 0)
throw new ArgumentOutOfRangeException("count", "Value is less than zero");
if (array.Rank > 1)
throw new ArgumentException("Multi dimensional array.");
if (index+count > this.Count || arrayIndex+count > array.Length)
throw new ArgumentException("Number of elements to copy is too large.");
for (int i=0; i<count; i++)
array.SetValue(getitemcopy(index+i), arrayIndex+i);
}
// Type-safe version of IEnumerable.GetEnumerator
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() {
return new $csclassnameEnumerator(this);
}
public $csclassnameEnumerator GetEnumerator() {
return new $csclassnameEnumerator(this);
}
// Type-safe enumerator
/// Note that the IEnumerator documentation requires an InvalidOperationException to be thrown
/// whenever the collection is modified. This has been done for changes in the size of the
/// collection but not when one of the elements of the collection is modified as it is a bit
/// tricky to detect unmanaged code that modifies the collection under our feet.
public sealed class $csclassnameEnumerator : System.Collections.IEnumerator {
private $csclassname collectionRef;
private int currentIndex;
private object currentObject;
private int currentSize;
public $csclassnameEnumerator($csclassname collection) {
collectionRef = collection;
currentIndex = -1;
currentObject = null;
currentSize = collectionRef.Count;
}
// Type-safe iterator Current
public CSTYPE Current {
get {
if (currentIndex == -1)
throw new InvalidOperationException("Enumeration not started.");
if (currentIndex > currentSize - 1)
throw new InvalidOperationException("Enumeration finished.");
if (currentObject == null)
throw new InvalidOperationException("Collection modified.");
return (CSTYPE)currentObject;
}
}
// Type-unsafe IEnumerator.Current
object System.Collections.IEnumerator.Current {
get {
return Current;
}
}
public bool MoveNext() {
int size = collectionRef.Count;
bool moveOkay = (currentIndex+1 < size) && (size == currentSize);
if (moveOkay) {
currentIndex++;
currentObject = collectionRef[currentIndex];
} else {
currentObject = null;
}
return moveOkay;
}
public void Reset() {
currentIndex = -1;
currentObject = null;
if (collectionRef.Count != currentSize) {
throw new InvalidOperationException("Collection modified.");
}
}
}
%}
public:
typedef size_t size_type;
typedef CTYPE value_type;
typedef const value_type& const_reference;
%rename(Clear) clear;
void clear();
%rename(Add) push_back;
void push_back(const value_type& x);
size_type size() const;
size_type capacity() const;
void reserve(size_type n);
%newobject GetRange(int index, int count);
%newobject Repeat(const value_type& value, int count);
vector();
%extend {
vector(int capacity) throw (std::out_of_range) {
std::vector<CTYPE >* pv = 0;
if (capacity >= 0) {
pv = new std::vector<CTYPE >();
pv->reserve(capacity);
} else {
throw std::out_of_range("capacity");
}
return pv;
}
CTYPE getitemcopy(int index) throw (std::out_of_range) {
if (index>=0 && index<(int)self->size())
return (*self)[index];
else
throw std::out_of_range("index");
}
const_reference getitem(int index) throw (std::out_of_range) {
if (index>=0 && index<(int)self->size())
return (*self)[index];
else
throw std::out_of_range("index");
}
void setitem(int index, const value_type& val) throw (std::out_of_range) {
if (index>=0 && index<(int)self->size())
(*self)[index] = val;
else
throw std::out_of_range("index");
}
// Takes a deep copy of the elements unlike ArrayList.AddRange
void AddRange(const std::vector<CTYPE >& values) {
self->insert(self->end(), values.begin(), values.end());
}
// Takes a deep copy of the elements unlike ArrayList.GetRange
std::vector<CTYPE > *GetRange(int index, int count) throw (std::out_of_range, std::invalid_argument) {
if (index < 0)
throw std::out_of_range("index");
if (count < 0)
throw std::out_of_range("count");
if (index >= (int)self->size()+1 || index+count > (int)self->size())
throw std::invalid_argument("invalid range");
return new std::vector<CTYPE >(self->begin()+index, self->begin()+index+count);
}
void Insert(int index, const value_type& x) throw (std::out_of_range) {
if (index>=0 && index<(int)self->size()+1)
self->insert(self->begin()+index, x);
else
throw std::out_of_range("index");
}
// Takes a deep copy of the elements unlike ArrayList.InsertRange
void InsertRange(int index, const std::vector<CTYPE >& values) throw (std::out_of_range) {
if (index>=0 && index<(int)self->size()+1)
self->insert(self->begin()+index, values.begin(), values.end());
else
throw std::out_of_range("index");
}
void RemoveAt(int index) throw (std::out_of_range) {
if (index>=0 && index<(int)self->size())
self->erase(self->begin() + index);
else
throw std::out_of_range("index");
}
void RemoveRange(int index, int count) throw (std::out_of_range, std::invalid_argument) {
if (index < 0)
throw std::out_of_range("index");
if (count < 0)
throw std::out_of_range("count");
if (index >= (int)self->size()+1 || index+count > (int)self->size())
throw std::invalid_argument("invalid range");
self->erase(self->begin()+index, self->begin()+index+count);
}
static std::vector<CTYPE > *Repeat(const value_type& value, int count) throw (std::out_of_range) {
if (count < 0)
throw std::out_of_range("count");
return new std::vector<CTYPE >(count, value);
}
void Reverse() {
std::reverse(self->begin(), self->end());
}
void Reverse(int index, int count) throw (std::out_of_range, std::invalid_argument) {
if (index < 0)
throw std::out_of_range("index");
if (count < 0)
throw std::out_of_range("count");
if (index >= (int)self->size()+1 || index+count > (int)self->size())
throw std::invalid_argument("invalid range");
std::reverse(self->begin()+index, self->begin()+index+count);
}
// Takes a deep copy of the elements unlike ArrayList.SetRange
void SetRange(int index, const std::vector<CTYPE >& values) throw (std::out_of_range) {
if (index < 0)
throw std::out_of_range("index");
if (index+values.size() > self->size())
throw std::out_of_range("index");
std::copy(values.begin(), values.end(), self->begin()+index);
}
}
%enddef
// Extra methods added to the collection class if operator== is defined for the class being wrapped
// CSTYPE and CTYPE respectively correspond to the types in the cstype and ctype typemaps
%define SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(CSTYPE, CTYPE...)
%extend {
bool Contains(const value_type& value) {
return std::find(self->begin(), self->end(), value) != self->end();
}
int IndexOf(const value_type& value) {
int index = -1;
std::vector<CTYPE >::iterator it = std::find(self->begin(), self->end(), value);
if (it != self->end())
index = (int)(it - self->begin());
return index;
}
int LastIndexOf(const value_type& value) {
int index = -1;
std::vector<CTYPE >::reverse_iterator rit = std::find(self->rbegin(), self->rend(), value);
if (rit != self->rend())
index = (int)(self->rend() - 1 - rit);
return index;
}
void Remove(const value_type& value) {
std::vector<CTYPE >::iterator it = std::find(self->begin(), self->end(), value);
if (it != self->end())
self->erase(it);
}
}
%enddef
// Macros for std::vector class specializations
// CSTYPE and CTYPE respectively correspond to the types in the cstype and ctype typemaps
%define SWIG_STD_VECTOR_SPECIALIZE(CSTYPE, CTYPE...)
namespace std {
template<> class vector<CTYPE > {
SWIG_STD_VECTOR_MINIMUM(CSTYPE, CTYPE)
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(CSTYPE, CTYPE)
};
}
%enddef
%define SWIG_STD_VECTOR_SPECIALIZE_MINIMUM(CSTYPE, CTYPE...)
namespace std {
template<> class vector<CTYPE > {
SWIG_STD_VECTOR_MINIMUM(CSTYPE, CTYPE)
};
}
%enddef
%{
#include <vector>
#include <algorithm>
#include <stdexcept>
%}
%csmethodmodifiers std::vector::getitemcopy "private"
%csmethodmodifiers std::vector::getitem "private"
%csmethodmodifiers std::vector::setitem "private"
%csmethodmodifiers std::vector::size "private"
%csmethodmodifiers std::vector::capacity "private"
%csmethodmodifiers std::vector::reserve "private"
namespace std {
// primary (unspecialized) class template for std::vector
// does not require operator== to be defined
template<class T> class vector {
SWIG_STD_VECTOR_MINIMUM(T, T)
};
// specializations for pointers
template<class T> class vector<T*> {
SWIG_STD_VECTOR_MINIMUM(T, T*)
};
template<class T> class vector<const T*> {
SWIG_STD_VECTOR_MINIMUM(T, const T*)
};
}
// template specializations for std::vector
// these provide extra collections methods as operator== is defined
SWIG_STD_VECTOR_SPECIALIZE(bool, bool)
SWIG_STD_VECTOR_SPECIALIZE(char, char)
SWIG_STD_VECTOR_SPECIALIZE(sbyte, signed char)
SWIG_STD_VECTOR_SPECIALIZE(byte, unsigned char)
SWIG_STD_VECTOR_SPECIALIZE(short, short)
SWIG_STD_VECTOR_SPECIALIZE(ushort, unsigned short)
SWIG_STD_VECTOR_SPECIALIZE(int, int)
SWIG_STD_VECTOR_SPECIALIZE(uint, unsigned int)
SWIG_STD_VECTOR_SPECIALIZE(int, long)
SWIG_STD_VECTOR_SPECIALIZE(uint, unsigned long)
SWIG_STD_VECTOR_SPECIALIZE(long, long long)
SWIG_STD_VECTOR_SPECIALIZE(ulong, unsigned long long)
SWIG_STD_VECTOR_SPECIALIZE(float, float)
SWIG_STD_VECTOR_SPECIALIZE(double, double)
SWIG_STD_VECTOR_SPECIALIZE(string, std::string) // also requires a %include <std_string.i>
@@ -0,0 +1,117 @@
/* -----------------------------------------------------------------------------
* See the LICENSE file for information on copyright, usage and redistribution
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
*
* std_wstring.i
*
* Typemaps for std::wstring and const std::wstring&
* These are mapped to a C# String and are passed around by value.
*
* To use non-const std::wstring references use the following %apply. Note
* that they are passed by value.
* %apply const std::wstring & {std::wstring &};
* ----------------------------------------------------------------------------- */
%include <wchar.i>
%{
#include <string>
%}
namespace std {
%naturalvar wstring;
class wstring;
// wstring
%typemap(ctype, out="void *") wstring "wchar_t *"
%typemap(imtype, inattributes="[MarshalAs(UnmanagedType.LPWStr)]") wstring "string"
%typemap(cstype) wstring "string"
%typemap(csdirectorin) wstring "$iminput"
%typemap(csdirectorout) wstring "$cscall"
%typemap(in, canthrow=1) wstring
%{ if (!$input) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0);
return $null;
}
$1.assign($input); %}
%typemap(out) wstring %{ $result = SWIG_csharp_wstring_callback($1.c_str()); %}
%typemap(directorout, canthrow=1) wstring
%{ if (!$input) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0);
return $null;
}
$result.assign($input); %}
%typemap(directorin) wstring %{ $input = SWIG_csharp_wstring_callback($1.c_str()); %}
%typemap(csin) wstring "$csinput"
%typemap(csout, excode=SWIGEXCODE) wstring {
string ret = $imcall;$excode
return ret;
}
%typemap(typecheck) wstring = wchar_t *;
%typemap(throws, canthrow=1) wstring
%{ std::string message($1.begin(), $1.end());
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, message.c_str());
return $null; %}
// const wstring &
%typemap(ctype, out="void *") const wstring & "wchar_t *"
%typemap(imtype, inattributes="[MarshalAs(UnmanagedType.LPWStr)]") const wstring & "string"
%typemap(cstype) const wstring & "string"
%typemap(csdirectorin) const wstring & "$iminput"
%typemap(csdirectorout) const wstring & "$cscall"
%typemap(in, canthrow=1) const wstring &
%{ if (!$input) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0);
return $null;
}
std::wstring $1_str($input);
$1 = &$1_str; %}
%typemap(out) const wstring & %{ $result = SWIG_csharp_wstring_callback($1->c_str()); %}
%typemap(csin) const wstring & "$csinput"
%typemap(csout, excode=SWIGEXCODE) const wstring & {
string ret = $imcall;$excode
return ret;
}
%typemap(directorout, canthrow=1, warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const wstring &
%{ if (!$input) {
SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0);
return $null;
}
/* possible thread/reentrant code problem */
static std::wstring $1_str;
$1_str = $input;
$result = &$1_str; %}
%typemap(directorin) const wstring & %{ $input = SWIG_csharp_wstring_callback($1.c_str()); %}
%typemap(csvarin, excode=SWIGEXCODE2) const wstring & %{
set {
$imcall;$excode
} %}
%typemap(csvarout, excode=SWIGEXCODE2) const wstring & %{
get {
string ret = $imcall;$excode
return ret;
} %}
%typemap(typecheck) const wstring & = wchar_t *;
%typemap(throws, canthrow=1) const wstring &
%{ std::string message($1.begin(), $1.end());
SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, message.c_str());
return $null; %}
}
+15
View File
@@ -0,0 +1,15 @@
/* -----------------------------------------------------------------------------
* See the LICENSE file for information on copyright, usage and redistribution
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
*
* stl.i
*
* Initial STL definition. extended as needed in each language
* ----------------------------------------------------------------------------- */
%include <std_common.i>
%include <std_string.i>
%include <std_vector.i>
%include <std_map.i>
%include <std_pair.i>
@@ -0,0 +1,291 @@
/* -----------------------------------------------------------------------------
* See the LICENSE file for information on copyright, usage and redistribution
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
*
* typemaps.i
*
* Pointer and reference handling typemap library
*
* These mappings provide support for input/output arguments and common
* uses for C/C++ pointers and C++ references.
* ----------------------------------------------------------------------------- */
/*
INPUT typemaps
--------------
These typemaps are used for pointer/reference parameters that are input only
and are mapped to a C# input parameter.
The following typemaps can be applied to turn a pointer or reference into a simple
input value. That is, instead of passing a pointer or reference to an object,
you would use a real value instead.
bool *INPUT, bool &INPUT
signed char *INPUT, signed char &INPUT
unsigned char *INPUT, unsigned char &INPUT
short *INPUT, short &INPUT
unsigned short *INPUT, unsigned short &INPUT
int *INPUT, int &INPUT
unsigned int *INPUT, unsigned int &INPUT
long *INPUT, long &INPUT
unsigned long *INPUT, unsigned long &INPUT
long long *INPUT, long long &INPUT
unsigned long long *INPUT, unsigned long long &INPUT
float *INPUT, float &INPUT
double *INPUT, double &INPUT
To use these, suppose you had a C function like this :
double fadd(double *a, double *b) {
return *a+*b;
}
You could wrap it with SWIG as follows :
%include <typemaps.i>
double fadd(double *INPUT, double *INPUT);
or you can use the %apply directive :
%include <typemaps.i>
%apply double *INPUT { double *a, double *b };
double fadd(double *a, double *b);
In C# you could then use it like this:
double answer = modulename.fadd(10.0, 20.0);
*/
%define INPUT_TYPEMAP(TYPE, CTYPE, CSTYPE)
%typemap(ctype) TYPE *INPUT, TYPE &INPUT "CTYPE"
%typemap(imtype) TYPE *INPUT, TYPE &INPUT "CSTYPE"
%typemap(cstype) TYPE *INPUT, TYPE &INPUT "CSTYPE"
%typemap(csin) TYPE *INPUT, TYPE &INPUT "$csinput"
%typemap(csdirectorin) TYPE *INPUT, TYPE &INPUT "$iminput"
%typemap(csdirectorout) TYPE *INPUT, TYPE &INPUT "$cscall"
%typemap(in) TYPE *INPUT, TYPE &INPUT
%{ $1 = ($1_ltype)&$input; %}
%typemap(directorout) TYPE *INPUT, TYPE &INPUT
%{ $result = ($1_ltype)&$input; %}
%typemap(directorin) TYPE &INPUT
%{ $input = (CTYPE *)$1; %}
%typemap(directorin) TYPE *INPUT
%{ $input = (CTYPE *)$1; %}
%typemap(typecheck) TYPE *INPUT = TYPE;
%typemap(typecheck) TYPE &INPUT = TYPE;
%enddef
INPUT_TYPEMAP(bool, unsigned int, bool)
//INPUT_TYPEMAP(char, char, char)
INPUT_TYPEMAP(signed char, signed char, sbyte)
INPUT_TYPEMAP(unsigned char, unsigned char, byte)
INPUT_TYPEMAP(short, short, short)
INPUT_TYPEMAP(unsigned short, unsigned short, ushort)
INPUT_TYPEMAP(int, int, int)
INPUT_TYPEMAP(unsigned int, unsigned int, uint)
INPUT_TYPEMAP(long, long, int)
INPUT_TYPEMAP(unsigned long, unsigned long, uint)
INPUT_TYPEMAP(long long, long long, long)
INPUT_TYPEMAP(unsigned long long, unsigned long long, ulong)
INPUT_TYPEMAP(float, float, float)
INPUT_TYPEMAP(double, double, double)
#undef INPUT_TYPEMAP
/*
OUTPUT typemaps
---------------
These typemaps are used for pointer/reference parameters that are output only and
are mapped to a C# output parameter.
The following typemaps can be applied to turn a pointer or reference into an "output"
value. When calling a function, no input value would be given for
a parameter, but an output value would be returned. In C#, the 'out' keyword is
used when passing the parameter to a function that takes an output parameter.
bool *OUTPUT, bool &OUTPUT
signed char *OUTPUT, signed char &OUTPUT
unsigned char *OUTPUT, unsigned char &OUTPUT
short *OUTPUT, short &OUTPUT
unsigned short *OUTPUT, unsigned short &OUTPUT
int *OUTPUT, int &OUTPUT
unsigned int *OUTPUT, unsigned int &OUTPUT
long *OUTPUT, long &OUTPUT
unsigned long *OUTPUT, unsigned long &OUTPUT
long long *OUTPUT, long long &OUTPUT
unsigned long long *OUTPUT, unsigned long long &OUTPUT
float *OUTPUT, float &OUTPUT
double *OUTPUT, double &OUTPUT
For example, suppose you were trying to wrap the modf() function in the
C math library which splits x into integral and fractional parts (and
returns the integer part in one of its parameters):
double modf(double x, double *ip);
You could wrap it with SWIG as follows :
%include <typemaps.i>
double modf(double x, double *OUTPUT);
or you can use the %apply directive :
%include <typemaps.i>
%apply double *OUTPUT { double *ip };
double modf(double x, double *ip);
The C# output of the function would be the function return value and the
value returned in the second output parameter. In C# you would use it like this:
double dptr;
double fraction = modulename.modf(5, out dptr);
*/
%define OUTPUT_TYPEMAP(TYPE, CTYPE, CSTYPE, TYPECHECKPRECEDENCE)
%typemap(ctype) TYPE *OUTPUT, TYPE &OUTPUT "CTYPE *"
%typemap(imtype) TYPE *OUTPUT, TYPE &OUTPUT "out CSTYPE"
%typemap(cstype) TYPE *OUTPUT, TYPE &OUTPUT "out CSTYPE"
%typemap(csin) TYPE *OUTPUT, TYPE &OUTPUT "out $csinput"
%typemap(csdirectorin) TYPE *OUTPUT, TYPE &OUTPUT "$iminput"
%typemap(csdirectorout) TYPE *OUTPUT, TYPE &OUTPUT "$cscall"
%typemap(in) TYPE *OUTPUT, TYPE &OUTPUT
%{ $1 = ($1_ltype)$input; %}
%typemap(directorout,warning="Need to provide TYPE *OUTPUT directorout typemap") TYPE *OUTPUT, TYPE &OUTPUT {
}
%typemap(directorin) TYPE &OUTPUT
%{ $input = &$1; %}
%typemap(directorin,warning="Need to provide TYPE *OUTPUT directorin typemap, TYPE array length is unknown") TYPE *OUTPUT
{
}
%typecheck(SWIG_TYPECHECK_##TYPECHECKPRECEDENCE) TYPE *OUTPUT, TYPE &OUTPUT ""
%enddef
OUTPUT_TYPEMAP(bool, unsigned int, bool, BOOL_PTR)
//OUTPUT_TYPEMAP(char, char, char, CHAR_PTR)
OUTPUT_TYPEMAP(signed char, signed char, sbyte, INT8_PTR)
OUTPUT_TYPEMAP(unsigned char, unsigned char, byte, UINT8_PTR)
OUTPUT_TYPEMAP(short, short, short, INT16_PTR)
OUTPUT_TYPEMAP(unsigned short, unsigned short, ushort, UINT16_PTR)
OUTPUT_TYPEMAP(int, int, int, INT32_PTR)
OUTPUT_TYPEMAP(unsigned int, unsigned int, uint, UINT32_PTR)
OUTPUT_TYPEMAP(long, long, int, INT32_PTR)
OUTPUT_TYPEMAP(unsigned long, unsigned long, uint, UINT32_PTR)
OUTPUT_TYPEMAP(long long, long long, long, INT64_PTR)
OUTPUT_TYPEMAP(unsigned long long, unsigned long long, ulong, UINT64_PTR)
OUTPUT_TYPEMAP(float, float, float, FLOAT_PTR)
OUTPUT_TYPEMAP(double, double, double, DOUBLE_PTR)
#undef OUTPUT_TYPEMAP
/*
INOUT typemaps
--------------
These typemaps are for pointer/reference parameters that are both input and
output and are mapped to a C# reference parameter.
The following typemaps can be applied to turn a pointer or reference into a
reference parameters, that is the parameter is both an input and an output.
In C#, the 'ref' keyword is used for reference parameters.
bool *INOUT, bool &INOUT
signed char *INOUT, signed char &INOUT
unsigned char *INOUT, unsigned char &INOUT
short *INOUT, short &INOUT
unsigned short *INOUT, unsigned short &INOUT
int *INOUT, int &INOUT
unsigned int *INOUT, unsigned int &INOUT
long *INOUT, long &INOUT
unsigned long *INOUT, unsigned long &INOUT
long long *INOUT, long long &INOUT
unsigned long long *INOUT, unsigned long long &INOUT
float *INOUT, float &INOUT
double *INOUT, double &INOUT
For example, suppose you were trying to wrap the following function :
void neg(double *x) {
*x = -(*x);
}
You could wrap it with SWIG as follows :
%include <typemaps.i>
void neg(double *INOUT);
or you can use the %apply directive :
%include <typemaps.i>
%apply double *INOUT { double *x };
void neg(double *x);
The C# output of the function would be the new value returned by the
reference parameter. In C# you would use it like this:
double x = 5.0;
neg(ref x);
The implementation of the OUTPUT and INOUT typemaps is different to the scripting
languages in that the scripting languages will return the output value as part
of the function return value.
*/
%define INOUT_TYPEMAP(TYPE, CTYPE, CSTYPE, TYPECHECKPRECEDENCE)
%typemap(ctype) TYPE *INOUT, TYPE &INOUT "CTYPE *"
%typemap(imtype) TYPE *INOUT, TYPE &INOUT "ref CSTYPE"
%typemap(cstype) TYPE *INOUT, TYPE &INOUT "ref CSTYPE"
%typemap(csin) TYPE *INOUT, TYPE &INOUT "ref $csinput"
%typemap(csdirectorin) TYPE *INOUT, TYPE &INOUT "$iminput"
%typemap(csdirectorout) TYPE *INOUT, TYPE &INOUT "$cscall"
%typemap(in) TYPE *INOUT, TYPE &INOUT
%{ $1 = ($1_ltype)$input; %}
%typemap(directorout,warning="Need to provide TYPE *INOUT directorout typemap") TYPE *INOUT, TYPE &INOUT {
}
%typemap(directorin) TYPE &INOUT
%{ $input = &$1; %}
%typemap(directorin,warning="Need to provide TYPE *INOUT directorin typemap, TYPE array length is unknown") TYPE *INOUT, TYPE &INOUT
{
}
%typecheck(SWIG_TYPECHECK_##TYPECHECKPRECEDENCE) TYPE *INOUT, TYPE &INOUT ""
%enddef
INOUT_TYPEMAP(bool, unsigned int, bool, BOOL_PTR)
//INOUT_TYPEMAP(char, char, char, CHAR_PTR)
INOUT_TYPEMAP(signed char, signed char, sbyte, INT8_PTR)
INOUT_TYPEMAP(unsigned char, unsigned char, byte, UINT8_PTR)
INOUT_TYPEMAP(short, short, short, INT16_PTR)
INOUT_TYPEMAP(unsigned short, unsigned short, ushort, UINT16_PTR)
INOUT_TYPEMAP(int, int, int, INT32_PTR)
INOUT_TYPEMAP(unsigned int, unsigned int, uint, UINT32_PTR)
INOUT_TYPEMAP(long, long, int, INT32_PTR)
INOUT_TYPEMAP(unsigned long, unsigned long, uint, UINT32_PTR)
INOUT_TYPEMAP(long long, long long, long, INT64_PTR)
INOUT_TYPEMAP(unsigned long long, unsigned long long, ulong, UINT64_PTR)
INOUT_TYPEMAP(float, float, float, FLOAT_PTR)
INOUT_TYPEMAP(double, double, double, DOUBLE_PTR)
#undef INOUT_TYPEMAP
+105
View File
@@ -0,0 +1,105 @@
/* -----------------------------------------------------------------------------
* See the LICENSE file for information on copyright, usage and redistribution
* of SWIG, and the README file for authors - http://www.swig.org/release.html.
*
* wchar.i
*
* Typemaps for the wchar_t type
* These are mapped to a C# String and are passed around by value.
*
* Support code for wide strings can be turned off by defining SWIG_CSHARP_NO_WSTRING_HELPER
*
* ----------------------------------------------------------------------------- */
#if !defined(SWIG_CSHARP_NO_WSTRING_HELPER)
#if !defined(SWIG_CSHARP_WSTRING_HELPER_)
#define SWIG_CSHARP_WSTRING_HELPER_
%insert(runtime) %{
/* Callback for returning strings to C# without leaking memory */
typedef void * (SWIGSTDCALL* SWIG_CSharpWStringHelperCallback)(const wchar_t *);
static SWIG_CSharpWStringHelperCallback SWIG_csharp_wstring_callback = NULL;
%}
%pragma(csharp) imclasscode=%{
protected class SWIGWStringHelper {
public delegate string SWIGWStringDelegate(IntPtr message);
static SWIGWStringDelegate wstringDelegate = new SWIGWStringDelegate(CreateWString);
[DllImport("$dllimport", EntryPoint="SWIGRegisterWStringCallback_$module")]
public static extern void SWIGRegisterWStringCallback_$module(SWIGWStringDelegate wstringDelegate);
static string CreateWString([MarshalAs(UnmanagedType.LPWStr)]IntPtr cString) {
return System.Runtime.InteropServices.Marshal.PtrToStringUni(cString);
}
static SWIGWStringHelper() {
SWIGRegisterWStringCallback_$module(wstringDelegate);
}
}
static protected SWIGWStringHelper swigWStringHelper = new SWIGWStringHelper();
%}
%insert(runtime) %{
#ifdef __cplusplus
extern "C"
#endif
SWIGEXPORT void SWIGSTDCALL SWIGRegisterWStringCallback_$module(SWIG_CSharpWStringHelperCallback callback) {
SWIG_csharp_wstring_callback = callback;
}
%}
#endif // SWIG_CSHARP_WSTRING_HELPER_
#endif // SWIG_CSHARP_NO_WSTRING_HELPER
// wchar_t
%typemap(ctype) wchar_t "wchar_t"
%typemap(imtype) wchar_t "char"
%typemap(cstype) wchar_t "char"
%typemap(csin) wchar_t "$csinput"
%typemap(csout, excode=SWIGEXCODE) wchar_t {
char ret = $imcall;$excode
return ret;
}
%typemap(csvarin, excode=SWIGEXCODE2) wchar_t %{
set {
$imcall;$excode
} %}
%typemap(csvarout, excode=SWIGEXCODE2) wchar_t %{
get {
char ret = $imcall;$excode
return ret;
} %}
%typemap(in) wchar_t %{ $1 = ($1_ltype)$input; %}
%typemap(out) wchar_t %{ $result = (wchar_t)$1; %}
%typemap(typecheck) wchar_t = char;
// wchar_t *
%typemap(ctype) wchar_t * "wchar_t *"
%typemap(imtype, inattributes="[MarshalAs(UnmanagedType.LPWStr)]", out="IntPtr" ) wchar_t * "string"
%typemap(cstype) wchar_t * "string"
%typemap(csin) wchar_t * "$csinput"
%typemap(csout, excode=SWIGEXCODE) wchar_t * {
string ret = System.Runtime.InteropServices.Marshal.PtrToStringUni($imcall);$excode
return ret;
}
%typemap(csvarin, excode=SWIGEXCODE2) wchar_t * %{
set {
$imcall;$excode
} %}
%typemap(csvarout, excode=SWIGEXCODE2) wchar_t * %{
get {
string ret = $imcall;$excode
return ret;
} %}
%typemap(in) wchar_t * %{ $1 = ($1_ltype)$input; %}
%typemap(out) wchar_t * %{ $result = (wchar_t *)$1; %}
%typemap(typecheck) wchar_t * = char *;