mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-25 20:48:24 +01:00
188 lines
7.1 KiB
C#
188 lines
7.1 KiB
C#
// <auto-generated/>
|
|
// Generated by Brutal.Jolt.Generate; do not edit by hand.
|
|
#nullable enable
|
|
|
|
using System.Runtime.CompilerServices;
|
|
using Brutal.Interop;
|
|
using Brutal.Numerics;
|
|
|
|
namespace Brutal.JoltApi
|
|
{
|
|
/// <summary>
|
|
/// <para>
|
|
/// This class is responsible for creating instances of classes based on their name or hash and is mainly used
|
|
/// for deserialization of saved data.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Core/Factory.h#L13">Jolt/Core/Factory.h:13</see>
|
|
/// <br/>
|
|
/// <c>class Factory</c>
|
|
/// </para>
|
|
/// </summary>
|
|
[InteropHandle]
|
|
public readonly partial struct Factory : IDisposable
|
|
{
|
|
public static Factory Create() => Jolt.PInvoke.Factory_Create();
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Create an object
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Core/Factory.h#L19">Jolt/Core/Factory.h:19</see>
|
|
/// <br/>
|
|
/// <c>void * CreateObject(const char *inName)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public unsafe Ptr CreateObject(RefString8 name)
|
|
{
|
|
fixed (byte* name_fixed = name)
|
|
{
|
|
return Jolt.PInvoke.Factory_CreateObject(this, name_fixed);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Find type info for a specific class by name
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Core/Factory.h#L22">Jolt/Core/Factory.h:22</see>
|
|
/// <br/>
|
|
/// <c>const RTTI * Find(const char *inName)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// The returned handle is borrowed from its owner; don't Dispose it.
|
|
/// </para>
|
|
/// </remarks>
|
|
public unsafe RTTI Find(RefString8 name)
|
|
{
|
|
fixed (byte* name_fixed = name)
|
|
{
|
|
return Jolt.PInvoke.Factory_Find(this, name_fixed);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Find type info for a specific class by hash
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Core/Factory.h#L25">Jolt/Core/Factory.h:25</see>
|
|
/// <br/>
|
|
/// <c>const RTTI * Find(uint32 inHash)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// The returned handle is borrowed from its owner; don't Dispose it.
|
|
/// </para>
|
|
/// </remarks>
|
|
public RTTI Find(uint hash) => Jolt.PInvoke.Factory_Find_2(this, hash);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Register an object with the factory. Returns false on failure.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Core/Factory.h#L28">Jolt/Core/Factory.h:28</see>
|
|
/// <br/>
|
|
/// <c>bool Register(const RTTI *inRTTI)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public bool Register(RTTI rtti) => Jolt.PInvoke.Factory_Register(this, rtti);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Register a list of objects with the factory. Returns false on failure.
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Core/Factory.h#L31">Jolt/Core/Factory.h:31</see>
|
|
/// <br/>
|
|
/// <c>bool Register(const RTTI **inRTTIs, uint inNumber)</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// rTTIs is a buffer of RTTI handles you allocate and size; the handles the call writes into it are
|
|
/// borrowed from their owner - don't Dispose them.
|
|
/// </para>
|
|
/// </remarks>
|
|
public unsafe bool Register(Ptr<RTTI> rTTIs, uint number) =>
|
|
Jolt.PInvoke.Factory_Register_2(this, rTTIs, number);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Unregisters all types
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Core/Factory.h#L34">Jolt/Core/Factory.h:34</see>
|
|
/// <br/>
|
|
/// <c>void Clear()</c>
|
|
/// </para>
|
|
/// </summary>
|
|
public void Clear() => Jolt.PInvoke.Factory_Clear(this);
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Get all registered classes
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Core/Factory.h#L37">Jolt/Core/Factory.h:37</see>
|
|
/// <br/>
|
|
/// <c>Array<const RTTI *> GetAllClasses() const</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// Returns an owned native buffer - read it through AsSpan() and Dispose it when you are done with it. The
|
|
/// handles in it are borrowed from the object that owns them: don't Dispose them, and don't read them once
|
|
/// that owner is gone - the buffer keeps the pointers alive, not the objects.
|
|
/// </para>
|
|
/// </remarks>
|
|
public NativeArray<RTTI> GetAllClasses() => new NativeArray<RTTI>(Jolt.PInvoke.Factory_GetAllClasses(this));
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Singleton factory instance
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Core/Factory.h#L40">Jolt/Core/Factory.h:40</see>
|
|
/// <br/>
|
|
/// <c>static Factory * sInstance</c>
|
|
/// </para>
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// <para>
|
|
/// The returned handle is borrowed from its owner; don't Dispose it.
|
|
/// </para>
|
|
/// </remarks>
|
|
internal static Factory GetInstance() => Jolt.PInvoke.Factory_GetInstance();
|
|
|
|
/// <summary>
|
|
/// <para>
|
|
/// Singleton factory instance
|
|
/// </para>
|
|
/// <para>
|
|
/// C++:
|
|
/// <see href="https://github.com/jrouwe/JoltPhysics/blob/e77f175595e64cb44218cc9d9d56fc365ad0e36a/Jolt/Core/Factory.h#L40">Jolt/Core/Factory.h:40</see>
|
|
/// <br/>
|
|
/// <c>static Factory * sInstance</c>
|
|
/// </para>
|
|
/// </summary>
|
|
internal static void SetInstance(Factory value) => Jolt.PInvoke.Factory_SetInstance(value);
|
|
|
|
public void Dispose() => Jolt.PInvoke.Factory_Destroy(this);
|
|
}
|
|
}
|