BNM 2.4.0
 
Loading...
Searching...
No Matches
BNM::Defaults Namespace Reference

Namespace that helps to get references to primitives and common used C# and Unity types. More...

Classes

struct  DefaultTypeRef
 Struct that holds reference to Il2CppClass. More...
 

Functions

template<typename T>
constexpr DefaultTypeRef Get ()
 Method that helps to get il2cpp class type from C++ and BNM types.
 
template<typename T>
IL2CPP::Il2CppObject * Box (T value)
 Simple method for boxing values.
 

Detailed Description

Namespace that helps to get references to primitives and common used C# and Unity types.

Function Documentation

◆ Box()

template<typename T>
IL2CPP::Il2CppObject * BNM::Defaults::Box ( T value)
inline

Simple method for boxing values.

Parameters
valueValue that needs to be packed
Template Parameters
TValue type

Method is based on BNM::Defaults::Get so only types supported by it will be boxed. Others will result null.

Returns
Boxed value if type is supported, otherwise null.

◆ Get()

template<typename T>
DefaultTypeRef BNM::Defaults::Get ( )
constexpr

Method that helps to get il2cpp class type from C++ and BNM types.

Template Parameters
TClass type

Supported types list:

C++, C# keyword, .NET type
void, void, System.Void
bool, bool, System.Boolean
BNM::Types::byte (uint8_t), byte, System.Byte
BNM::Types::sbyte (int8_t), sbyte, System.SByte
short (int16_t), short, System.Int16
BNM::Types::ushort (uint16_t), ushort, System.UInt16
int (int32_t), int, System.Int32
BNM::Types::uint (unsigned int), uint, System.UInt32
BNM::Types::nint (intptr_t), nint, System.IntPtr
BNM::Types::nuint (uintptr_t), nuint, System.UIntPtr
long, long, System.Int64
BNM::Types::ulong (unsigned long), ulong, System.UInt64
float, float, System.Single
double, double, System.Double
BNM::Types::decimal, decimal, System.Double
BNM::IL2CPP::Il2CppString * (or) BNM::Structures::Mono::String *, string, System.String
Any other pointer, object, System.Object
Namespace that has types and helpers to work with Unity objects.
Definition Defaults.hpp:31
String type implementation.
Definition BasicMonoStructures.hpp:93
Definition Color.hpp:71
Definition Color.hpp:11
Definition Matrix3x3.hpp:12
Definition Matrix4x4.hpp:26
Definition Quaternion.hpp:6
Definition Ray.hpp:6
Definition RaycastHit2D.hpp:8
Definition RaycastHit.hpp:9
Definition Vector2.hpp:7
Definition Vector3.hpp:10
Definition Vector4.hpp:10
UnityEngine.MonoBehaviour implementation.
Definition UnityStructures.hpp:72
UnityEngine.Object implementation.
Definition UnityStructures.hpp:33
Returns
Type reference if type is listed, otherwise empty reference.