GDMono::MemberVisibility GDMonoField::get_visibility() { switch (mono_field_get_flags(mono_field) & MONO_FIELD_ATTR_FIELD_ACCESS_MASK) { case MONO_FIELD_ATTR_PRIVATE: return GDMono::PRIVATE; case MONO_FIELD_ATTR_FAM_AND_ASSEM: return GDMono::PROTECTED_AND_INTERNAL; case MONO_FIELD_ATTR_ASSEMBLY: return GDMono::INTERNAL; case MONO_FIELD_ATTR_FAMILY: return GDMono::PROTECTED; case MONO_FIELD_ATTR_PUBLIC: return GDMono::PUBLIC; default: ERR_FAIL_V(GDMono::PRIVATE); } }
MonoFieldVisibility MonoField::getVisibility() { uint32_t flags = mono_field_get_flags(mField) & MONO_FIELD_ATTR_FIELD_ACCESS_MASK; if(flags == MONO_FIELD_ATTR_PRIVATE) return MonoFieldVisibility::Private; else if(flags == MONO_FIELD_ATTR_FAM_AND_ASSEM) return MonoFieldVisibility::ProtectedInternal; else if(flags == MONO_FIELD_ATTR_ASSEMBLY) return MonoFieldVisibility::Internal; else if(flags == MONO_FIELD_ATTR_FAMILY) return MonoFieldVisibility::Protected; else if(flags == MONO_FIELD_ATTR_PUBLIC) return MonoFieldVisibility::Public; assert(false); return MonoFieldVisibility::Private; }
Vector<MonoClassField *> GDMonoClass::get_enum_fields() { bool class_is_enum = mono_class_is_enum(mono_class); ERR_FAIL_COND_V(!class_is_enum, Vector<MonoClassField *>()); Vector<MonoClassField *> enum_fields; void *iter = NULL; MonoClassField *raw_field = NULL; while ((raw_field = mono_class_get_fields(get_mono_ptr(), &iter)) != NULL) { uint32_t field_flags = mono_field_get_flags(raw_field); // Enums have an instance field named value__ which holds the value of the enum. // Enum constants are static, so we will use this to ignore the value__ field. if (field_flags & MONO_FIELD_ATTR_PUBLIC && field_flags & MONO_FIELD_ATTR_STATIC) { enum_fields.push_back(raw_field); } } return enum_fields; }
void CPipeServer::EnumFieldsInClass() { void *c=(void *)ReadQword(); void *iter=NULL; void *field; do { field=mono_class_get_fields(c, &iter); WriteQword((UINT_PTR)field); if (field) { char *name; void *fieldtype=mono_field_get_type(field); WriteQword((UINT_PTR)fieldtype); WriteDword(mono_type_get_type(fieldtype)); WriteQword((UINT_PTR)mono_field_get_parent(field)); WriteDword((UINT_PTR)mono_field_get_offset(field)); WriteDword(mono_field_get_flags(field)); name=mono_field_get_name(field); WriteWord(strlen(name)); Write(name, strlen(name)); name=mono_type_get_name(fieldtype); if (name) { WriteWord(strlen(name)); Write(name, strlen(name)); g_free(name); } else WriteWord(0); } } while (field); }
bool MonoField::isStatic() { uint32_t flags = mono_field_get_flags(mField); return (flags & MONO_FIELD_ATTR_STATIC) != 0; }
bool GDMonoField::is_static() { return mono_field_get_flags(mono_field) & MONO_FIELD_ATTR_STATIC; }