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