GenericClass.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #pragma once
  2. #include <stdint.h>
  3. #include "il2cpp-config.h"
  4. struct Il2CppClass;
  5. struct Il2CppGenericClass;
  6. struct Il2CppGenericContext;
  7. namespace il2cpp
  8. {
  9. namespace vm
  10. {
  11. class LIBIL2CPP_CODEGEN_API GenericClass
  12. {
  13. public:
  14. // exported
  15. public:
  16. //internal
  17. static Il2CppClass* GetClass(Il2CppGenericClass *gclass, bool throwOnError = true);
  18. static Il2CppGenericContext* GetContext(Il2CppGenericClass *gclass);
  19. static Il2CppClass* GetTypeDefinition(Il2CppGenericClass *gclass);
  20. static bool IsEnum(Il2CppGenericClass *gclass);
  21. static bool IsValueType(Il2CppGenericClass *gclass);
  22. static void SetupEvents(Il2CppClass* genericInstanceType);
  23. static void SetupFields(Il2CppClass* genericInstanceType);
  24. static void SetupMethods(Il2CppClass* genericInstanceType);
  25. static void SetupProperties(Il2CppClass* genericInstanceType);
  26. static bool HasSameGenericTypeDefinition(const Il2CppGenericClass* gclass1, const Il2CppGenericClass* gclass2)
  27. {
  28. IL2CPP_ASSERT(gclass1->type->type == IL2CPP_TYPE_VALUETYPE || gclass1->type->type == IL2CPP_TYPE_CLASS);
  29. IL2CPP_ASSERT(gclass2->type->type == IL2CPP_TYPE_VALUETYPE || gclass2->type->type == IL2CPP_TYPE_CLASS);
  30. return gclass1->type->data.typeHandle == gclass2->type->data.typeHandle;
  31. }
  32. private:
  33. static Il2CppClass* CreateClass(Il2CppGenericClass *gclass, bool throwOnError = true);
  34. };
  35. } /* namespace vm */
  36. } /* namespace il2cpp */