Files
BlenderSharp/CodeGenerator/StrExt.cs
2025-03-04 18:03:40 +01:00

30 lines
1.2 KiB
C#

using System.Runtime.CompilerServices;
namespace CodeGenerator {
public static class StrExt {
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string ParseFName(this string str) {
str = str.Replace("*", "");
return str;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string ParseFType(this string str) {
return str switch {
"char" => typeof(char).AssemblyQualifiedName,
"short" => typeof(short).AssemblyQualifiedName,
"int" => typeof(int).AssemblyQualifiedName,
"float" => typeof(float).AssemblyQualifiedName,
"double" => typeof(double).AssemblyQualifiedName,
"string" => typeof(string).AssemblyQualifiedName,
"void" => typeof(object).AssemblyQualifiedName,
"ushort" => typeof(ushort).AssemblyQualifiedName,
"uchar" => typeof(byte).AssemblyQualifiedName,
"int64_t" => typeof(long).AssemblyQualifiedName,
"int8_t" => typeof(sbyte).AssemblyQualifiedName,
"uint64_t" => typeof(ulong).AssemblyQualifiedName,
_ => str
};
}
}
}