Fix naming for function pointers with strings

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
This commit is contained in:
Dimitar Dobrev 2021-10-02 17:03:46 +03:00
Родитель f97ad43ce4
Коммит 1e60113327
4 изменённых файлов: 6 добавлений и 2 удалений

Просмотреть файл

@ -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");

Просмотреть файл

@ -103,7 +103,7 @@ namespace CppSharp.Types.Std
// This is not really right. ASCII is 7-bit only - the 8th bit is stripped; ANSI has
// multi-byte support via a code page. MarshalAs(UnmanagedType.LPStr) marshals as ANSI.
// Perhaps we need a CppSharp.Runtime.ASCIIMarshaller?
return new CustomType("[MarshalAs(UnmanagedType.LPStr)] string");
return new CustomType("[MarshalAs(UnmanagedType.LPStr)] string");
else if (encoding == Encoding.UTF8)
return new CustomType("[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(CppSharp.Runtime.UTF8Marshaller))] string");
else if (encoding == Encoding.Unicode || encoding == Encoding.BigEndianUnicode)

Просмотреть файл

@ -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"ქართული ენა")

Просмотреть файл

@ -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