mirror of
https://github.com/ModOrganizer2/modorganizer-installer_fomod_csharp.git
synced 2026-07-27 14:07:20 -07:00
Better marshalling functions.
This commit is contained in:
+5
-1
@@ -22,13 +22,17 @@ namespace CSharp {
|
||||
return msclr::interop::marshal_as<std::wstring>(value);
|
||||
}
|
||||
inline QString to_qstring(System::String^ value) {
|
||||
return QString::fromStdString(to_string(value));
|
||||
msclr::interop::marshal_context ctx;
|
||||
return QString::fromWCharArray(ctx.marshal_as<const wchar_t*>(value));
|
||||
}
|
||||
|
||||
template <class Str>
|
||||
inline System::String^ from_string(Str const& string) {
|
||||
return msclr::interop::marshal_as<System::String^>(string);
|
||||
}
|
||||
inline System::String^ from_string(QString const& string) {
|
||||
return msclr::interop::marshal_as<System::String^>(string.toStdWString().c_str());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user