Add ILibcFunction (#1283)

This commit is contained in:
MidoriKami 2023-06-24 23:45:00 -07:00 committed by GitHub
parent 0ac5c240f6
commit 1346daccf8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 14 deletions

View file

@ -0,0 +1,26 @@
using System.Text;
using Dalamud.Game.Libc;
namespace Dalamud.Plugin.Services;
/// <summary>
/// This class handles creating cstrings utilizing native game methods.
/// </summary>
public interface ILibcFunction
{
/// <summary>
/// Create a new string from the given bytes.
/// </summary>
/// <param name="content">The bytes to convert.</param>
/// <returns>An owned std string object.</returns>
public OwnedStdString NewString(byte[] content);
/// <summary>
/// Create a new string form the given bytes.
/// </summary>
/// <param name="content">The bytes to convert.</param>
/// <param name="encoding">A non-default encoding.</param>
/// <returns>An owned std string object.</returns>
public OwnedStdString NewString(string content, Encoding? encoding = null);
}