Browse Source

Fix naming for function pointers with strings

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/1376/head
Dimitar Dobrev 4 years ago
parent
commit
1e60113327
  1. 4
      src/Generator/Passes/DelegatesPass.cs
  2. 1
      tests/CSharp/CSharp.cpp
  3. 1
      tests/CSharp/CSharp.h

4
src/Generator/Passes/DelegatesPass.cs

@ -276,7 +276,9 @@ namespace CppSharp.Passes @@ -276,7 +276,9 @@ namespace CppSharp.Passes
// TODO: all of this needs proper general fixing by only leaving type names
return types.Replace("global::System.", string.Empty)
.Replace("[MarshalAs(UnmanagedType.LPUTF8Str)] ", string.Empty)
.Replace("[MarshalAs(UnmanagedType.LPWStr)] ", string.Empty)
.Replace("[MarshalAs(UnmanagedType.LPWStr)] string", "wstring")
.Replace("[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string", "string8")
.Replace("[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF32Marshaller))] string", "string32")
.Replace("global::", string.Empty).Replace("*", "Ptr")
.Replace('.', '_').Replace(' ', '_').Replace("::", "_")
.Replace("[]", "Array");

1
tests/CSharp/CSharp.cpp

@ -1489,6 +1489,7 @@ void TestChar32String::UpdateString(const char32_t* s) @@ -1489,6 +1489,7 @@ void TestChar32String::UpdateString(const char32_t* s)
}
const char32_t* TestChar32String::RetrieveString() { return thirtyTwoBitConst; }
void TestChar32String::functionPointerUTF32(void(*ptr)(const char32_t*)) {}
TestChar16String::TestChar16String() :
sixteenBitConst(u"ქართული ენა")

1
tests/CSharp/CSharp.h

@ -1165,6 +1165,7 @@ public: @@ -1165,6 +1165,7 @@ public:
void UpdateString(const char32_t* s);
const char32_t* RetrieveString();
void functionPointerUTF32(void(*ptr)(const char32_t*));
};
class DLL_API TestChar16String

Loading…
Cancel
Save