예제 #1
0
void ClassDB::get_method_list(StringName p_class, List<MethodInfo> *p_methods, bool p_no_inheritance, bool p_exclude_from_properties) {

	OBJTYPE_RLOCK;

	ClassInfo *type = classes.getptr(p_class);

	while (type) {

		if (type->disabled) {

			if (p_no_inheritance)
				break;

			type = type->inherits_ptr;
			continue;
		}

#ifdef DEBUG_METHODS_ENABLED

		for (List<MethodInfo>::Element *E = type->virtual_methods.front(); E; E = E->next()) {

			p_methods->push_back(E->get());
		}

		for (List<StringName>::Element *E = type->method_order.front(); E; E = E->next()) {

			MethodBind *method = type->method_map.get(E->get());
			MethodInfo minfo;
			minfo.name = E->get();
			minfo.id = method->get_method_id();

			if (p_exclude_from_properties && type->methods_in_properties.has(minfo.name))
				continue;

			for (int i = 0; i < method->get_argument_count(); i++) {

				//Variant::Type t=method->get_argument_type(i);

				minfo.arguments.push_back(method->get_argument_info(i));
			}

			minfo.return_val = method->get_return_info();
			minfo.flags = method->get_hint_flags();

			for (int i = 0; i < method->get_argument_count(); i++) {
				if (method->has_default_argument(i))
					minfo.default_arguments.push_back(method->get_default_argument(i));
			}

			p_methods->push_back(minfo);
		}

#else

		const StringName *K = NULL;

		while ((K = type->method_map.next(K))) {

			MethodBind *m = type->method_map[*K];
			MethodInfo mi;
			mi.name = m->get_name();
			p_methods->push_back(mi);
		}

#endif

		if (p_no_inheritance)
			break;

		type = type->inherits_ptr;
	}
}