Make manual overloads for string-returning functinos

This commit is contained in:
Soreepeong 2025-08-04 19:29:18 +09:00
parent 334a02e69a
commit 4b1857e40d
12 changed files with 239 additions and 462 deletions

View file

@ -1,7 +1,14 @@
using System.Runtime.CompilerServices;
using System.Text;
namespace Dalamud.Bindings.ImGui;
public unsafe partial struct ImGuiTextBuffer
{
public readonly Span<byte> Span => new(this.Buf.Data, this.Buf.Size);
public override readonly string ToString() => Encoding.UTF8.GetString(this.Span);
public void append(ImU8String str)
{
fixed (ImGuiTextBuffer* thisPtr = &this)
@ -9,7 +16,11 @@ public unsafe partial struct ImGuiTextBuffer
}
}
public partial struct ImGuiTextBufferPtr
public unsafe partial struct ImGuiTextBufferPtr
{
public readonly Span<byte> Span => new(Unsafe.AsRef(in this).Buf.Data, Unsafe.AsRef(in this).Buf.Size);
public override readonly string ToString() => Encoding.UTF8.GetString(this.Span);
public void append(ImU8String str) => ImGui.append(this, str);
}