Add C# wchar_t * director typemaps

More Python std::wstring directors Python testing
This commit is contained in:
William S Fulton 2022-05-04 19:33:47 +01:00
commit bb39235c9c
5 changed files with 30 additions and 8 deletions

View file

@ -17,11 +17,9 @@ public class runme
if (b.get_first() != "hello world!")
throw new ApplicationException("Incorrect get_first:" + b.get_first());
/*
b.call_process_func();
if (b.smem != "hello")
throw new ApplicationException("Incorrect smem:" + b.smem);
*/
b.call_process_wstring_func();
if (b.smem != "hello (wstring)")

View file

@ -39,15 +39,11 @@ struct A
std::vector<std::wstring> m_strings;
virtual const wchar_t * wchar_out() { return L"ciao"; }
#if !defined(SWIGCSHARP)
virtual void process_text(const wchar_t *text) {}
#else
// temp until wchar_t* fixed
virtual void process_text(std::wstring text) {}
virtual void process_wstring_text(std::wstring text) {}
virtual void process_wstring_ref_text(const std::wstring& text) {}
#endif
virtual std::wstring multiple_params_val(const std::wstring& p1, const std::wstring& p2, std::wstring p3, std::wstring p4) const
{ return get_first(); }

View file

@ -12,6 +12,12 @@ class B(A):
def process_text(self, s):
self.smem = s
def process_wstring_text(self, s):
self.smem = s + " (wstring)"
def process_wstring_ref_text(self, s):
self.smem = s + " (wstring ref)"
b = B("hello")
@ -24,3 +30,13 @@ b.call_process_func()
if b.smem != "hello":
raise RuntimeError("smem: {}".format(smem))
b.call_process_wstring_func()
if b.smem != "hello (wstring)":
raise RuntimeError("smem: {}".format(smem))
b.call_process_wstring_ref_func()
if b.smem != "hello (wstring ref)":
raise RuntimeError("smem: {}".format(smem))