GenericClass.h 1.6 KB

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