//
// Generated by Brutal.Jolt.Generate; do not edit by hand.
#nullable enable
using Brutal.Interop;
using Brutal.Numerics;
namespace Brutal.JoltApi
{
///
///
/// C++:
/// Jolt/Core/Factory.h:13
///
/// class Factory
///
///
///
///
/// This class is responsible for creating instances of classes based on their name or hash and is mainly used
/// for deserialization of saved data.
///
///
[InteropHandle]
public readonly partial struct Factory : IDisposable
{
public static Factory Create() => Jolt.PInvoke.Factory_Create();
///
///
/// C++:
/// Jolt/Core/Factory.h:19
///
/// void * CreateObject(const char *inName)
///
///
///
///
/// Create an object
///
///
public unsafe Ptr CreateObject(RefString8 name)
{
fixed (byte* name_fixed = name)
{
return Jolt.PInvoke.Factory_CreateObject(this, name_fixed);
}
}
///
///
/// C++:
/// Jolt/Core/Factory.h:22
///
/// const RTTI * Find(const char *inName)
///
///
///
///
/// Find type info for a specific class by name
///
///
/// The returned handle is borrowed from its owner; don't Dispose it.
///
///
public unsafe RTTI Find(RefString8 name)
{
fixed (byte* name_fixed = name)
{
return Jolt.PInvoke.Factory_Find(this, name_fixed);
}
}
///
///
/// C++:
/// Jolt/Core/Factory.h:25
///
/// const RTTI * Find(uint32 inHash)
///
///
///
///
/// Find type info for a specific class by hash
///
///
/// The returned handle is borrowed from its owner; don't Dispose it.
///
///
public RTTI Find(uint hash) => Jolt.PInvoke.Factory_Find_2(this, hash);
///
///
/// C++:
/// Jolt/Core/Factory.h:28
///
/// bool Register(const RTTI *inRTTI)
///
///
///
///
/// Register an object with the factory. Returns false on failure.
///
///
public bool Register(RTTI rTTI) => Jolt.PInvoke.Factory_Register(this, rTTI);
///
///
/// C++:
/// Jolt/Core/Factory.h:34
///
/// void Clear()
///
///
///
///
/// Unregisters all types
///
///
public void Clear() => Jolt.PInvoke.Factory_Clear(this);
public void Dispose() => Jolt.PInvoke.Factory_Destroy(this);
}
}