1 /* -----------------------------------------------------------------------------
\r
2 * See the LICENSE file for information on copyright, usage and redistribution
\r
3 * of SWIG, and the README file for authors - http://www.swig.org/release.html.
\r
7 * Typemaps for the wchar_t type
\r
8 * These are mapped to a C# String and are passed around by value.
\r
10 * Support code for wide strings can be turned off by defining SWIG_CSHARP_NO_WSTRING_HELPER
\r
12 * ----------------------------------------------------------------------------- */
\r
14 #if !defined(SWIG_CSHARP_NO_WSTRING_HELPER)
\r
15 #if !defined(SWIG_CSHARP_WSTRING_HELPER_)
\r
16 #define SWIG_CSHARP_WSTRING_HELPER_
\r
18 /* Callback for returning strings to C# without leaking memory */
\r
19 typedef void * (SWIGSTDCALL* SWIG_CSharpWStringHelperCallback)(const wchar_t *);
\r
20 static SWIG_CSharpWStringHelperCallback SWIG_csharp_wstring_callback = NULL;
\r
23 %pragma(csharp) imclasscode=%{
\r
24 protected class SWIGWStringHelper {
\r
26 public delegate string SWIGWStringDelegate(IntPtr message);
\r
27 static SWIGWStringDelegate wstringDelegate = new SWIGWStringDelegate(CreateWString);
\r
29 [DllImport("$dllimport", EntryPoint="SWIGRegisterWStringCallback_$module")]
\r
30 public static extern void SWIGRegisterWStringCallback_$module(SWIGWStringDelegate wstringDelegate);
\r
32 static string CreateWString([MarshalAs(UnmanagedType.LPWStr)]IntPtr cString) {
\r
33 return System.Runtime.InteropServices.Marshal.PtrToStringUni(cString);
\r
36 static SWIGWStringHelper() {
\r
37 SWIGRegisterWStringCallback_$module(wstringDelegate);
\r
41 static protected SWIGWStringHelper swigWStringHelper = new SWIGWStringHelper();
\r
48 SWIGEXPORT void SWIGSTDCALL SWIGRegisterWStringCallback_$module(SWIG_CSharpWStringHelperCallback callback) {
\r
49 SWIG_csharp_wstring_callback = callback;
\r
52 #endif // SWIG_CSHARP_WSTRING_HELPER_
\r
53 #endif // SWIG_CSHARP_NO_WSTRING_HELPER
\r
57 %typemap(ctype) wchar_t "wchar_t"
\r
58 %typemap(imtype) wchar_t "char"
\r
59 %typemap(cstype) wchar_t "char"
\r
61 %typemap(csin) wchar_t "$csinput"
\r
62 %typemap(csout, excode=SWIGEXCODE) wchar_t {
\r
63 char ret = $imcall;$excode
\r
66 %typemap(csvarin, excode=SWIGEXCODE2) wchar_t %{
\r
70 %typemap(csvarout, excode=SWIGEXCODE2) wchar_t %{
\r
72 char ret = $imcall;$excode
\r
76 %typemap(in) wchar_t %{ $1 = ($1_ltype)$input; %}
\r
77 %typemap(out) wchar_t %{ $result = (wchar_t)$1; %}
\r
79 %typemap(typecheck) wchar_t = char;
\r
82 %typemap(ctype) wchar_t * "wchar_t *"
\r
83 %typemap(imtype, inattributes="[MarshalAs(UnmanagedType.LPWStr)]", out="IntPtr" ) wchar_t * "string"
\r
84 %typemap(cstype) wchar_t * "string"
\r
86 %typemap(csin) wchar_t * "$csinput"
\r
87 %typemap(csout, excode=SWIGEXCODE) wchar_t * {
\r
88 string ret = System.Runtime.InteropServices.Marshal.PtrToStringUni($imcall);$excode
\r
91 %typemap(csvarin, excode=SWIGEXCODE2) wchar_t * %{
\r
95 %typemap(csvarout, excode=SWIGEXCODE2) wchar_t * %{
\r
97 string ret = $imcall;$excode
\r
101 %typemap(in) wchar_t * %{ $1 = ($1_ltype)$input; %}
\r
102 %typemap(out) wchar_t * %{ $result = (wchar_t *)$1; %}
\r
104 %typemap(typecheck) wchar_t * = char *;
\r