当前位置: 首页>>代码示例>>C++>>正文


C++ MethodBind::get_return_info方法代码示例

本文整理汇总了C++中MethodBind::get_return_info方法的典型用法代码示例。如果您正苦于以下问题:C++ MethodBind::get_return_info方法的具体用法?C++ MethodBind::get_return_info怎么用?C++ MethodBind::get_return_info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MethodBind的用法示例。


在下文中一共展示了MethodBind::get_return_info方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: get_method_list

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;
	}
}
开发者ID:KellyThomas,项目名称:godot,代码行数:72,代码来源:class_db.cpp

示例2: generate

void DocData::generate(bool p_basic_types) {

	List<StringName> classes;
	ClassDB::get_class_list(&classes);
	classes.sort_custom<StringName::AlphCompare>();

	bool skip_setter_getter_methods = true;

	while (classes.size()) {

		Set<StringName> setters_getters;

		String name = classes.front()->get();
		String cname = name;
		if (cname.begins_with("_")) //proxy class
			cname = cname.substr(1, name.length());

		class_list[cname] = ClassDoc();
		ClassDoc &c = class_list[cname];
		c.name = cname;
		c.inherits = ClassDB::get_parent_class(name);
		c.category = ClassDB::get_category(name);

		List<PropertyInfo> properties;
		ClassDB::get_property_list(name, &properties, true);

		for (List<PropertyInfo>::Element *E = properties.front(); E; E = E->next()) {
			if (E->get().usage & PROPERTY_USAGE_GROUP || E->get().usage & PROPERTY_USAGE_CATEGORY || E->get().usage & PROPERTY_USAGE_INTERNAL)
				continue;

			PropertyDoc prop;
			StringName setter = ClassDB::get_property_setter(name, E->get().name);
			StringName getter = ClassDB::get_property_getter(name, E->get().name);

			prop.name = E->get().name;
			prop.setter = setter;
			prop.getter = getter;

			bool found_type = false;
			if (getter != StringName()) {
				MethodBind *mb = ClassDB::get_method(name, getter);
				if (mb) {
					PropertyInfo retinfo = mb->get_return_info();

					found_type = true;
					if (retinfo.type == Variant::INT && retinfo.usage & PROPERTY_USAGE_CLASS_IS_ENUM) {
						prop.enumeration = retinfo.class_name;
						prop.type = "int";
					} else if (retinfo.class_name != StringName()) {
						prop.type = retinfo.class_name;
					} else if (retinfo.hint == PROPERTY_HINT_RESOURCE_TYPE) {

						prop.type = retinfo.hint_string;
					} else if (retinfo.type == Variant::NIL && retinfo.usage & PROPERTY_USAGE_NIL_IS_VARIANT) {

						prop.type = "Variant";
					} else if (retinfo.type == Variant::NIL) {
						prop.type = "void";
					} else {
						prop.type = Variant::get_type_name(retinfo.type);
					}
				}

				setters_getters.insert(getter);
			}

			if (setter != StringName()) {

				setters_getters.insert(setter);
			}

			if (!found_type) {

				if (E->get().type == Variant::OBJECT && E->get().hint == PROPERTY_HINT_RESOURCE_TYPE)
					prop.type = E->get().hint_string;
				else
					prop.type = Variant::get_type_name(E->get().type);
			}

			c.properties.push_back(prop);
		}

		List<MethodInfo> method_list;
		ClassDB::get_method_list(name, &method_list, true);
		method_list.sort();

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

			if (E->get().name == "" || (E->get().name[0] == '_' && !(E->get().flags & METHOD_FLAG_VIRTUAL)))
				continue; //hidden, don't count

			if (skip_setter_getter_methods && setters_getters.has(E->get().name) && E->get().name.find("/") == -1)
				continue;

			MethodDoc method;

			method.name = E->get().name;

			if (E->get().flags & METHOD_FLAG_VIRTUAL)
				method.qualifiers = "virtual";
//.........这里部分代码省略.........
开发者ID:Ranakhamis,项目名称:godot,代码行数:101,代码来源:doc_data.cpp


注:本文中的MethodBind::get_return_info方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。