14 #ifndef _INC_MSCLR_MARSHAL_ATL
15 #define _INC_MSCLR_MARSHAL_ATL
21 #include <atlcomcli.h>
29 inline System::String^
marshal_as(
const CComBSTR& _from_object)
31 if (_from_object.m_str ==
NULL)
36 return System::Runtime::InteropServices::Marshal::PtrToStringBSTR(System::IntPtr(_from_object.m_str));
40 inline CComBSTR
marshal_as(System::String^
const& _from_object)
42 if (_from_object ==
nullptr)
44 return CComBSTR(static_cast<const wchar_t*>(
NULL));
46 if(_from_object->Length == 0)
48 return CComBSTR(static_cast<const wchar_t*>(L
""));
52 return CComBSTR( _from_object->Length, static_cast<const wchar_t *>(_pinned_ptr));
56 inline System::String^
marshal_as(
const CStringA& _from_obj)
62 inline System::String^
marshal_as(
const CStringW& _from_obj)
69 inline CStringA
marshal_as(System::String^
const & _from_obj)
71 if (_from_obj ==
nullptr)
84 int _length =
static_cast<int>(_size)-1;
87 char* _dest_buf = _to_obj.GetBuffer(_length);
90 _to_obj.ReleaseBuffer(_length);
96 inline CStringW
marshal_as(System::String^
const & _from_obj)
98 if (_from_obj ==
nullptr)
103 return CStringW(static_cast<const wchar_t *>(_pinned_ptr), _from_obj->Length);
#define _EXCEPTION_NULLPTR
Definition: marshal.h:39
Definition: appdomain.h:36
_Check_return_ size_t GetAnsiStringSize(System::String^_str)
Definition: marshal.h:78
System::String InternalAnsiToStringHelper(_In_reads_z_(_count+1) const char *_src, size_t _count)
Definition: marshal.h:147
#define NULL
Definition: crtdbg.h:30
__const_Char_ptr PtrToStringChars(__const_String_handle s)
Definition: vcclr.h:40
_To_Type marshal_as(_In_z_ const char _from_object[])
Definition: marshal.h:187
void WriteAnsiString(_Out_writes_all_(_size) _Post_z_ char *_buf, size_t _size, System::String^_str)
Definition: marshal.h:93
#define INT_MAX
Definition: limits.h:40
System::String InternalUnicodeToStringHelper(_In_reads_z_(_count+1) const wchar_t *_src, size_t _count)
Definition: marshal.h:165