コード例 #1
0
ファイル: gd_mono_class.cpp プロジェクト: UgisBrekis/godot
void GDMonoClass::fetch_attributes() {

	ERR_FAIL_COND(attributes != NULL);

	attributes = mono_custom_attrs_from_class(get_mono_ptr());
	attrs_fetched = true;
}
コード例 #2
0
ファイル: monodiet.c プロジェクト: ANahr/mono
static void
handle_type (MonoClass *klass, guint32 flags)
{
	int i;
	guint32 missing;
	MonoCustomAttrInfo* cattrs;
	gpointer val = NULL, oldkey = NULL;
	MonoProperty* prop;
	MonoEvent* event;
	MonoMethod* method;
	MonoClassField* field;
	gpointer iter;
	
	if (g_hash_table_lookup_extended (type_table, klass, &oldkey, &val)) {
		missing = flags & ~(GPOINTER_TO_UINT (val));
	} else {
		missing = flags;
	}
	if (!missing)
		return;
	g_hash_table_insert (type_table, klass, GUINT_TO_POINTER (missing));
	if (verbose)
		g_print ("#processing klass: %s.%s\n", klass->name_space, klass->name);
	mono_class_init (klass);
	if (klass->parent)
		add_type (klass->parent);
	if (klass->nested_in)
		add_type (klass->nested_in);
	iter = NULL;
	while ((method = mono_class_get_methods (klass, &iter))) {
		if ((missing & TYPE_METHODS) || strcmp (method->name, ".cctor") == 0)
			add_types_from_method (method);
	}
	if (klass->enumtype) {
		add_field (mono_class_get_field_from_name (klass, "value__"));
	}
	if (force_enums || (missing & TYPE_FIELDS)) {
		iter = NULL;
		while ((field = mono_class_get_fields (klass, &iter)))
			add_field (field);
	}
	iter = NULL;
	while ((prop = mono_class_get_properties (klass, &iter))) {
		cattrs = mono_custom_attrs_from_property (klass, prop);
		handle_cattrs (cattrs);
	}
	iter = NULL;
	while ((event = mono_class_get_events (klass, &iter))) {
		cattrs = mono_custom_attrs_from_event (klass, event);
		handle_cattrs (cattrs);
	}
	for (i = 0; i < klass->interface_count; ++i)
		add_type (klass->interfaces [i]);
	cattrs = mono_custom_attrs_from_class (klass);
	handle_cattrs (cattrs);
}