diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-07-05 22:53:49 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-07-05 22:53:49 (GMT) |
commit | f50dabccaae935457ea6f09a349d54855d60e7d5 (patch) | |
tree | 133f714be2b946b240d34c7cf3e6c1f5b5963f30 /src/bindings/swig/csharp/uscxml.i | |
parent | dec6466d01757ab8e93d867e5a6d214bcafaf428 (diff) | |
download | uscxml-f50dabccaae935457ea6f09a349d54855d60e7d5.zip uscxml-f50dabccaae935457ea6f09a349d54855d60e7d5.tar.gz uscxml-f50dabccaae935457ea6f09a349d54855d60e7d5.tar.bz2 |
Binary data in bindings
Diffstat (limited to 'src/bindings/swig/csharp/uscxml.i')
-rw-r--r-- | src/bindings/swig/csharp/uscxml.i | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/bindings/swig/csharp/uscxml.i b/src/bindings/swig/csharp/uscxml.i index 2a1ac07..bd8c669 100644 --- a/src/bindings/swig/csharp/uscxml.i +++ b/src/bindings/swig/csharp/uscxml.i @@ -157,6 +157,41 @@ WRAP_TO_STRING(uscxml::InvokeRequest); // Beautify important classes //*********************************************** + +// byte[] signature for Blob get/setData +// see http://permalink.gmane.org/gmane.comp.programming.swig/5804 + +%csmethodmodifiers uscxml::Blob::Blob(const char* data, size_t size, const std::string& mimeType) "private"; +%typemap(cscode) uscxml::Blob %{ + public Blob(byte[] data, string mimeType) : this(uscxmlNativeCSharpPINVOKE.new_Blob(data, (uint)data.Length, mimeType), true) { + if (uscxmlNativeCSharpPINVOKE.SWIGPendingException.Pending) throw uscxmlNativeCSharpPINVOKE.SWIGPendingException.Retrieve(); + } +%} + +%typemap(imtype, out="System.IntPtr") const char *data "byte[]" +%typemap(cstype) const char *data "byte[]" +%typemap(in) const char *data %{ $1 = ($1_ltype)$input; %} +%typemap(csin) const char *data "$csinput" + +%typemap(imtype, out="System.IntPtr") char* getData "byte[]" +%typemap(cstype) char* getData "byte[]" + +%typemap(csout) char* getData %{ + { + byte[] ret = new byte[this.getSize()]; + System.IntPtr data = $imcall; + System.Runtime.InteropServices.Marshal.Copy(data, ret, 0, (int)this.getSize()); + return ret; + } +%} + +// make sure we do not get the default with SWIG_csharp_string_callback +%typemap(out) char* getData { + $result = (char *)result; +} + + + %csmethodmodifiers uscxml::Event::getParamMap() "private"; %csmethodmodifiers uscxml::Event::getParamMapKeys() "private"; %csmethodmodifiers uscxml::Event::setParamMap(const std::map<std::string, std::list<uscxml::Data> >&) "private"; |