/* ----------------------------------------------------------------------------- * wchar.i * * Typemaps for the wchar_t type * wchar_t * is mapped to a C# Unicode string (UTF16) and is passed around by value. * wchar_t * support includes wchar_t as a 2 byte type (Windows) and a 4 byte type * (most Unix systems). * * 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_ %fragment(""); // TODO: %fragment("") const wchar_t * { if ($input && sizeof(wchar_t) == 2) { $1 = ($1_type) (new wchar_t[wcslen((const wchar_t *)$input)+1]); wcscpy((wchar_t *)$1, (const wchar_t *)$input); } else { $1 = $input; $input = 0; } } %typemap(globalin,fragment="") wchar_t * { delete [] $1; if ($input && sizeof(wchar_t) == 2) { $1 = ($1_type) (new wchar_t[wcslen((const wchar_t *)$input)+1]); wcscpy((wchar_t *)$1, (const wchar_t *)$input); } else { $1 = $input; $input = 0; } } %typemap(globalin,warning=SWIGWARN_TYPEMAP_WCHARLEAK_MSG,fragment="") const wchar_t * { if ($input && sizeof(wchar_t) == 2) { $1 = ($1_type) (new wchar_t[wcslen((const wchar_t *)$input)+1]); wcscpy((wchar_t *)$1, (const wchar_t *)$input); } else { $1 = $input; $input = 0; } } #else %typemap(memberin,fragment="") wchar_t * { free($1); if ($input && sizeof(wchar_t) == 2) { $1 = ($1_type) malloc(wcslen((const wchar_t *)$input)+1); wcscpy((wchar_t *)$1, (const wchar_t *)$input); } else { $1 = $input; $input = 0; } } %typemap(memberin,warning=SWIGWARN_TYPEMAP_WCHARLEAK_MSG,fragment="") const wchar_t * { if ($input && sizeof(wchar_t) == 2) { $1 = ($1_type) malloc(wcslen((const wchar_t *)$input)+1); wcscpy((wchar_t *)$1, (const wchar_t *)$input); } else { $1 = $input; $input = 0; } } %typemap(globalin,fragment="") wchar_t * { free($1); if ($input && sizeof(wchar_t) == 2) { $1 = ($1_type) malloc(wcslen((const wchar_t *)$input)+1); wcscpy((wchar_t *)$1, (const wchar_t *)$input); } else { $1 = $input; $input = 0; } } %typemap(globalin,warning=SWIGWARN_TYPEMAP_WCHARLEAK_MSG,fragment="") const wchar_t * { if ($input && sizeof(wchar_t) == 2) { $1 = ($1_type) malloc(wcslen((const wchar_t *)$input)+1); wcscpy((wchar_t *)$1, (const wchar_t *)$input); } else { $1 = $input; $input = 0; } } #endif