summaryrefslogtreecommitdiff
path: root/devtools/swigwin-1.3.34/Lib/csharp/std_wstring.i
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /devtools/swigwin-1.3.34/Lib/csharp/std_wstring.i
downloadarchived-source-engine-2018-hl2-src-3bf9df6b2785fa6d951086978a3e66f49427166a.tar.xz
archived-source-engine-2018-hl2-src-3bf9df6b2785fa6d951086978a3e66f49427166a.zip
Diffstat (limited to 'devtools/swigwin-1.3.34/Lib/csharp/std_wstring.i')
-rw-r--r--devtools/swigwin-1.3.34/Lib/csharp/std_wstring.i117
1 files changed, 117 insertions, 0 deletions
diff --git a/devtools/swigwin-1.3.34/Lib/csharp/std_wstring.i b/devtools/swigwin-1.3.34/Lib/csharp/std_wstring.i
new file mode 100644
index 0000000..938070e
--- /dev/null
+++ b/devtools/swigwin-1.3.34/Lib/csharp/std_wstring.i
@@ -0,0 +1,117 @@
+/* -----------------------------------------------------------------------------
+ * See the LICENSE file for information on copyright, usage and redistribution
+ * of SWIG, and the README file for authors - http://www.swig.org/release.html.
+ *
+ * std_wstring.i
+ *
+ * Typemaps for std::wstring and const std::wstring&
+ * These are mapped to a C# String and are passed around by value.
+ *
+ * To use non-const std::wstring references use the following %apply. Note
+ * that they are passed by value.
+ * %apply const std::wstring & {std::wstring &};
+ * ----------------------------------------------------------------------------- */
+
+%include <wchar.i>
+
+%{
+#include <string>
+%}
+
+namespace std {
+
+%naturalvar wstring;
+
+class wstring;
+
+// wstring
+%typemap(ctype, out="void *") wstring "wchar_t *"
+%typemap(imtype, inattributes="[MarshalAs(UnmanagedType.LPWStr)]") wstring "string"
+%typemap(cstype) wstring "string"
+%typemap(csdirectorin) wstring "$iminput"
+%typemap(csdirectorout) wstring "$cscall"
+
+%typemap(in, canthrow=1) wstring
+%{ if (!$input) {
+ SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0);
+ return $null;
+ }
+ $1.assign($input); %}
+%typemap(out) wstring %{ $result = SWIG_csharp_wstring_callback($1.c_str()); %}
+
+%typemap(directorout, canthrow=1) wstring
+%{ if (!$input) {
+ SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0);
+ return $null;
+ }
+ $result.assign($input); %}
+
+%typemap(directorin) wstring %{ $input = SWIG_csharp_wstring_callback($1.c_str()); %}
+
+%typemap(csin) wstring "$csinput"
+%typemap(csout, excode=SWIGEXCODE) wstring {
+ string ret = $imcall;$excode
+ return ret;
+ }
+
+%typemap(typecheck) wstring = wchar_t *;
+
+%typemap(throws, canthrow=1) wstring
+%{ std::string message($1.begin(), $1.end());
+ SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, message.c_str());
+ return $null; %}
+
+// const wstring &
+%typemap(ctype, out="void *") const wstring & "wchar_t *"
+%typemap(imtype, inattributes="[MarshalAs(UnmanagedType.LPWStr)]") const wstring & "string"
+%typemap(cstype) const wstring & "string"
+
+%typemap(csdirectorin) const wstring & "$iminput"
+%typemap(csdirectorout) const wstring & "$cscall"
+
+%typemap(in, canthrow=1) const wstring &
+%{ if (!$input) {
+ SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0);
+ return $null;
+ }
+ std::wstring $1_str($input);
+ $1 = &$1_str; %}
+%typemap(out) const wstring & %{ $result = SWIG_csharp_wstring_callback($1->c_str()); %}
+
+%typemap(csin) const wstring & "$csinput"
+%typemap(csout, excode=SWIGEXCODE) const wstring & {
+ string ret = $imcall;$excode
+ return ret;
+ }
+
+%typemap(directorout, canthrow=1, warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const wstring &
+%{ if (!$input) {
+ SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "null wstring", 0);
+ return $null;
+ }
+ /* possible thread/reentrant code problem */
+ static std::wstring $1_str;
+ $1_str = $input;
+ $result = &$1_str; %}
+
+%typemap(directorin) const wstring & %{ $input = SWIG_csharp_wstring_callback($1.c_str()); %}
+
+%typemap(csvarin, excode=SWIGEXCODE2) const wstring & %{
+ set {
+ $imcall;$excode
+ } %}
+%typemap(csvarout, excode=SWIGEXCODE2) const wstring & %{
+ get {
+ string ret = $imcall;$excode
+ return ret;
+ } %}
+
+%typemap(typecheck) const wstring & = wchar_t *;
+
+%typemap(throws, canthrow=1) const wstring &
+%{ std::string message($1.begin(), $1.end());
+ SWIG_CSharpSetPendingException(SWIG_CSharpApplicationException, message.c_str());
+ return $null; %}
+
+}
+