PageRenderTime 42ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/test-suite/li_std_wstring.i

#
Swig | 89 lines | 63 code | 26 blank | 0 comment | 0 complexity | cea09b6aa71e0e82fe69ac3f5d4b842c MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  1. %module li_std_wstring
  2. %include <std_basic_string.i>
  3. %include <std_wstring.i>
  4. %inline %{
  5. struct A : std::wstring
  6. {
  7. A(const std::wstring& s) : std::wstring(s)
  8. {
  9. }
  10. };
  11. struct B
  12. {
  13. B(const std::wstring& s) : cname(0), name(s), a(s)
  14. {
  15. }
  16. char *cname;
  17. std::wstring name;
  18. A a;
  19. };
  20. wchar_t test_wcvalue(wchar_t x) {
  21. return x;
  22. }
  23. const wchar_t* test_ccvalue(const wchar_t* x) {
  24. return x;
  25. }
  26. wchar_t* test_cvalue(wchar_t* x) {
  27. return x;
  28. }
  29. std::wstring test_value(std::wstring x) {
  30. return x;
  31. }
  32. const std::wstring& test_const_reference(const std::wstring &x) {
  33. return x;
  34. }
  35. void test_pointer(std::wstring *x) {
  36. }
  37. std::wstring *test_pointer_out() {
  38. static std::wstring x = L"x";
  39. return &x;
  40. }
  41. void test_const_pointer(const std::wstring *x) {
  42. }
  43. const std::wstring *test_const_pointer_out() {
  44. static std::wstring x = L"x";
  45. return &x;
  46. }
  47. void test_reference(std::wstring &x) {
  48. }
  49. std::wstring& test_reference_out() {
  50. static std::wstring x = L"x";
  51. return x;
  52. }
  53. #if defined(_MSC_VER)
  54. #pragma warning(disable: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
  55. #endif
  56. void test_throw() throw(std::wstring){
  57. static std::wstring x = L"x";
  58. throw x;
  59. }
  60. #if defined(_MSC_VER)
  61. #pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow)
  62. #endif
  63. %}