| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | /*************************************************************************/ | 
					
						
							|  |  |  | /*  doc_dump.cpp                                                         */ | 
					
						
							|  |  |  | /*************************************************************************/ | 
					
						
							|  |  |  | /*                       This file is part of:                           */ | 
					
						
							|  |  |  | /*                           GODOT ENGINE                                */ | 
					
						
							|  |  |  | /*                    http://www.godotengine.org                         */ | 
					
						
							|  |  |  | /*************************************************************************/ | 
					
						
							| 
									
										
										
										
											2017-01-01 22:01:57 +01:00
										 |  |  | /* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur.                 */ | 
					
						
							| 
									
										
										
										
											2017-04-08 00:11:42 +02:00
										 |  |  | /* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md)    */ | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | /*                                                                       */ | 
					
						
							|  |  |  | /* Permission is hereby granted, free of charge, to any person obtaining */ | 
					
						
							|  |  |  | /* a copy of this software and associated documentation files (the       */ | 
					
						
							|  |  |  | /* "Software"), to deal in the Software without restriction, including   */ | 
					
						
							|  |  |  | /* without limitation the rights to use, copy, modify, merge, publish,   */ | 
					
						
							|  |  |  | /* distribute, sublicense, and/or sell copies of the Software, and to    */ | 
					
						
							|  |  |  | /* permit persons to whom the Software is furnished to do so, subject to */ | 
					
						
							|  |  |  | /* the following conditions:                                             */ | 
					
						
							|  |  |  | /*                                                                       */ | 
					
						
							|  |  |  | /* The above copyright notice and this permission notice shall be        */ | 
					
						
							|  |  |  | /* included in all copies or substantial portions of the Software.       */ | 
					
						
							|  |  |  | /*                                                                       */ | 
					
						
							|  |  |  | /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */ | 
					
						
							|  |  |  | /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */ | 
					
						
							|  |  |  | /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ | 
					
						
							|  |  |  | /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */ | 
					
						
							|  |  |  | /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */ | 
					
						
							|  |  |  | /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */ | 
					
						
							|  |  |  | /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */ | 
					
						
							|  |  |  | /*************************************************************************/ | 
					
						
							|  |  |  | #include "doc_dump.h"
 | 
					
						
							| 
									
										
										
										
											2017-01-16 08:04:19 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | #include "os/file_access.h"
 | 
					
						
							|  |  |  | #include "scene/main/node.h"
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | #include "version.h"
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | static void _write_string(FileAccess *f, int p_tablevel, const String &p_string) { | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	String tab; | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	for (int i = 0; i < p_tablevel; i++) | 
					
						
							|  |  |  | 		tab += "\t"; | 
					
						
							|  |  |  | 	f->store_string(tab + p_string + "\n"); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct _ConstantSort { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	String name; | 
					
						
							|  |  |  | 	int value; | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	bool operator<(const _ConstantSort &p_c) const { | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 		String left_a = name.find("_") == -1 ? name : name.substr(0, name.find("_")); | 
					
						
							|  |  |  | 		String left_b = p_c.name.find("_") == -1 ? p_c.name : p_c.name.substr(0, p_c.name.find("_")); | 
					
						
							|  |  |  | 		if (left_a == left_b) | 
					
						
							|  |  |  | 			return value < p_c.value; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 		else | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 			return left_a < left_b; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	} | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | static String _escape_string(const String &p_str) { | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	String ret = p_str; | 
					
						
							|  |  |  | 	ret = ret.replace("&", "&"); | 
					
						
							|  |  |  | 	ret = ret.replace("<", ">"); | 
					
						
							|  |  |  | 	ret = ret.replace(">", "<"); | 
					
						
							|  |  |  | 	ret = ret.replace("'", "'"); | 
					
						
							|  |  |  | 	ret = ret.replace("\"", """); | 
					
						
							|  |  |  | 	for (char i = 1; i < 32; i++) { | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 		char chr[2] = { i, 0 }; | 
					
						
							|  |  |  | 		ret = ret.replace(chr, "&#" + String::num(i) + ";"); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	ret = ret.utf8(); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	return ret; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | void DocDump::dump(const String &p_file) { | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-29 00:29:49 -03:00
										 |  |  | 	List<StringName> class_list; | 
					
						
							| 
									
										
										
										
											2017-01-02 23:03:46 -03:00
										 |  |  | 	ClassDB::get_class_list(&class_list); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-29 00:29:49 -03:00
										 |  |  | 	class_list.sort_custom<StringName::AlphCompare>(); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	FileAccess *f = FileAccess::open(p_file, FileAccess::WRITE); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	_write_string(f, 0, "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	_write_string(f, 0, "<doc version=\"" + String(VERSION_MKSTRING) + "\" name=\"Engine Types\">"); | 
					
						
							|  |  |  | 	while (class_list.size()) { | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 		String name = class_list.front()->get(); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 		String header = "<class name=\"" + name + "\""; | 
					
						
							|  |  |  | 		String inherits = ClassDB::get_parent_class(name); | 
					
						
							|  |  |  | 		if (inherits != "") | 
					
						
							|  |  |  | 			header += " inherits=\"" + inherits + "\""; | 
					
						
							|  |  |  | 		String category = ClassDB::get_category(name); | 
					
						
							|  |  |  | 		if (category == "") | 
					
						
							|  |  |  | 			category = "Core"; | 
					
						
							|  |  |  | 		header += " category=\"" + category + "\""; | 
					
						
							|  |  |  | 		header += ">"; | 
					
						
							|  |  |  | 		_write_string(f, 0, header); | 
					
						
							|  |  |  | 		_write_string(f, 1, "<brief_description>"); | 
					
						
							|  |  |  | 		_write_string(f, 1, "</brief_description>"); | 
					
						
							|  |  |  | 		_write_string(f, 1, "<description>"); | 
					
						
							|  |  |  | 		_write_string(f, 1, "</description>"); | 
					
						
							|  |  |  | 		_write_string(f, 1, "<methods>"); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		List<MethodInfo> method_list; | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 		ClassDB::get_method_list(name, &method_list, true); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 		method_list.sort(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 		for (List<MethodInfo>::Element *E = method_list.front(); E; E = E->next()) { | 
					
						
							|  |  |  | 			if (E->get().name == "" || E->get().name[0] == '_') | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 				continue; //hiden
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 			MethodBind *m = ClassDB::get_method(name, E->get().name); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			String qualifiers; | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 			if (E->get().flags & METHOD_FLAG_CONST) | 
					
						
							|  |  |  | 				qualifiers += "qualifiers=\"const\""; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 			_write_string(f, 2, "<method name=\"" + _escape_string(E->get().name) + "\" " + qualifiers + " >"); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 			for (int i = -1; i < E->get().arguments.size(); i++) { | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 				PropertyInfo arginfo; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 				if (i == -1) { | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 					arginfo = E->get().return_val; | 
					
						
							|  |  |  | 					String type_name = (arginfo.hint == PROPERTY_HINT_RESOURCE_TYPE) ? arginfo.hint_string : Variant::get_type_name(arginfo.type); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 					if (arginfo.type == Variant::NIL) | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 						continue; | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 					_write_string(f, 3, "<return type=\"" + type_name + "\">"); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 				} else { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 					arginfo = E->get().arguments[i]; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 					String type_name; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 					if (arginfo.hint == PROPERTY_HINT_RESOURCE_TYPE) | 
					
						
							|  |  |  | 						type_name = arginfo.hint_string; | 
					
						
							|  |  |  | 					else if (arginfo.type == Variant::NIL) | 
					
						
							|  |  |  | 						type_name = "var"; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 					else | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 						type_name = Variant::get_type_name(arginfo.type); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 					if (m && m->has_default_argument(i)) { | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 						Variant default_arg = m->get_default_argument(i); | 
					
						
							|  |  |  | 						String default_arg_text = String(_escape_string(m->get_default_argument(i))); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 						switch (default_arg.get_type()) { | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 							case Variant::NIL: | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 								default_arg_text = "NULL"; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 								break; | 
					
						
							|  |  |  | 							// atomic types
 | 
					
						
							|  |  |  | 							case Variant::BOOL: | 
					
						
							|  |  |  | 								if (bool(default_arg)) | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 									default_arg_text = "true"; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 								else | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 									default_arg_text = "false"; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 								break; | 
					
						
							|  |  |  | 							case Variant::INT: | 
					
						
							|  |  |  | 							case Variant::REAL: | 
					
						
							|  |  |  | 								//keep it
 | 
					
						
							|  |  |  | 								break; | 
					
						
							| 
									
										
										
										
											2017-05-17 18:45:56 +02:00
										 |  |  | 							case Variant::STRING: | 
					
						
							|  |  |  | 							case Variant::NODE_PATH: | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 								default_arg_text = "\"" + default_arg_text + "\""; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 								break; | 
					
						
							|  |  |  | 							case Variant::TRANSFORM: | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 								if (default_arg.operator Transform() == Transform()) { | 
					
						
							|  |  |  | 									default_arg_text = ""; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 								} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 								default_arg_text = Variant::get_type_name(default_arg.get_type()) + "(" + default_arg_text + ")"; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 								break; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-17 18:45:56 +02:00
										 |  |  | 							case Variant::VECTOR2: | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 							case Variant::RECT2: | 
					
						
							|  |  |  | 							case Variant::VECTOR3: | 
					
						
							|  |  |  | 							case Variant::PLANE: | 
					
						
							|  |  |  | 							case Variant::QUAT: | 
					
						
							| 
									
										
										
										
											2017-05-17 18:45:56 +02:00
										 |  |  | 							case Variant::RECT3: | 
					
						
							| 
									
										
										
										
											2017-01-11 00:52:51 -03:00
										 |  |  | 							case Variant::BASIS: | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 							case Variant::COLOR: | 
					
						
							| 
									
										
										
										
											2017-01-11 00:52:51 -03:00
										 |  |  | 							case Variant::POOL_BYTE_ARRAY: | 
					
						
							|  |  |  | 							case Variant::POOL_INT_ARRAY: | 
					
						
							|  |  |  | 							case Variant::POOL_REAL_ARRAY: | 
					
						
							| 
									
										
										
										
											2017-05-17 18:45:56 +02:00
										 |  |  | 							case Variant::POOL_STRING_ARRAY: | 
					
						
							| 
									
										
										
										
											2017-01-11 00:52:51 -03:00
										 |  |  | 							case Variant::POOL_VECTOR3_ARRAY: | 
					
						
							|  |  |  | 							case Variant::POOL_COLOR_ARRAY: | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 								default_arg_text = Variant::get_type_name(default_arg.get_type()) + "(" + default_arg_text + ")"; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 								break; | 
					
						
							|  |  |  | 							case Variant::OBJECT: | 
					
						
							|  |  |  | 							case Variant::INPUT_EVENT: | 
					
						
							| 
									
										
										
										
											2017-05-17 18:45:56 +02:00
										 |  |  | 							case Variant::DICTIONARY: | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 							case Variant::ARRAY: | 
					
						
							|  |  |  | 							case Variant::_RID: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 							default: {} | 
					
						
							|  |  |  | 						} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 						_write_string(f, 3, "<argument index=\"" + itos(i) + "\" name=\"" + _escape_string(arginfo.name) + "\" type=\"" + type_name + "\" default=\"" + _escape_string(default_arg_text) + "\">"); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 					} else | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 						_write_string(f, 3, "<argument index=\"" + itos(i) + "\" name=\"" + arginfo.name + "\" type=\"" + type_name + "\">"); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 				} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				String hint; | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 				switch (arginfo.hint) { | 
					
						
							|  |  |  | 					case PROPERTY_HINT_DIR: hint = "A directory."; break; | 
					
						
							|  |  |  | 					case PROPERTY_HINT_RANGE: hint = "Range - min: " + arginfo.hint_string.get_slice(",", 0) + " max: " + arginfo.hint_string.get_slice(",", 1) + " step: " + arginfo.hint_string.get_slice(",", 2); break; | 
					
						
							|  |  |  | 					case PROPERTY_HINT_ENUM: | 
					
						
							|  |  |  | 						hint = "Values: "; | 
					
						
							|  |  |  | 						for (int j = 0; j < arginfo.hint_string.get_slice_count(","); j++) { | 
					
						
							|  |  |  | 							if (j > 0) hint += ", "; | 
					
						
							|  |  |  | 							hint += arginfo.hint_string.get_slice(",", j) + "=" + itos(j); | 
					
						
							|  |  |  | 						} | 
					
						
							|  |  |  | 						break; | 
					
						
							|  |  |  | 					case PROPERTY_HINT_LENGTH: hint = "Length: " + arginfo.hint_string; break; | 
					
						
							|  |  |  | 					case PROPERTY_HINT_FLAGS: | 
					
						
							|  |  |  | 						hint = "Values: "; | 
					
						
							|  |  |  | 						for (int j = 0; j < arginfo.hint_string.get_slice_count(","); j++) { | 
					
						
							|  |  |  | 							if (j > 0) hint += ", "; | 
					
						
							|  |  |  | 							hint += arginfo.hint_string.get_slice(",", j) + "=" + itos(1 << j); | 
					
						
							|  |  |  | 						} | 
					
						
							|  |  |  | 						break; | 
					
						
							|  |  |  | 					case PROPERTY_HINT_FILE: hint = "A file:"; break; | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 					default: {} | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 						//case PROPERTY_HINT_RESOURCE_TYPE: hint="Type: "+arginfo.hint_string; break;
 | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 				}; | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 				if (hint != "") | 
					
						
							|  |  |  | 					_write_string(f, 4, hint); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 				_write_string(f, 3, (i == -1) ? "</return>" : "</argument>"); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 			_write_string(f, 3, "<description>"); | 
					
						
							|  |  |  | 			_write_string(f, 3, "</description>"); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 			_write_string(f, 2, "</method>"); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 		_write_string(f, 1, "</methods>"); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		List<MethodInfo> signal_list; | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 		ClassDB::get_signal_list(name, &signal_list, true); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		if (signal_list.size()) { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 			_write_string(f, 1, "<signals>"); | 
					
						
							|  |  |  | 			for (List<MethodInfo>::Element *EV = signal_list.front(); EV; EV = EV->next()) { | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 				_write_string(f, 2, "<signal name=\"" + EV->get().name + "\">"); | 
					
						
							|  |  |  | 				for (int i = 0; i < EV->get().arguments.size(); i++) { | 
					
						
							|  |  |  | 					PropertyInfo arginfo = EV->get().arguments[i]; | 
					
						
							|  |  |  | 					_write_string(f, 3, "<argument index=\"" + itos(i) + "\" name=\"" + arginfo.name + "\" type=\"" + Variant::get_type_name(arginfo.type) + "\">"); | 
					
						
							|  |  |  | 					_write_string(f, 3, "</argument>"); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 				} | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 				_write_string(f, 3, "<description>"); | 
					
						
							|  |  |  | 				_write_string(f, 3, "</description>"); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 				_write_string(f, 2, "</signal>"); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 			_write_string(f, 1, "</signals>"); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 		_write_string(f, 1, "<constants>"); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		List<String> constant_list; | 
					
						
							| 
									
										
										
										
											2017-01-02 23:03:46 -03:00
										 |  |  | 		ClassDB::get_integer_constant_list(name, &constant_list, true); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		/* constants are sorted in a special way */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		List<_ConstantSort> constant_sort; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 		for (List<String>::Element *E = constant_list.front(); E; E = E->next()) { | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 			_ConstantSort cs; | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 			cs.name = E->get(); | 
					
						
							|  |  |  | 			cs.value = ClassDB::get_integer_constant(name, E->get()); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 			constant_sort.push_back(cs); | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		constant_sort.sort(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 		for (List<_ConstantSort>::Element *E = constant_sort.front(); E; E = E->next()) { | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 			_write_string(f, 2, "<constant name=\"" + E->get().name + "\" value=\"" + itos(E->get().value) + "\">"); | 
					
						
							|  |  |  | 			_write_string(f, 2, "</constant>"); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 		_write_string(f, 1, "</constants>"); | 
					
						
							|  |  |  | 		_write_string(f, 0, "</class>"); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		class_list.erase(name); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-05 16:44:50 +01:00
										 |  |  | 	_write_string(f, 0, "</doc>"); | 
					
						
							| 
									
										
										
										
											2014-02-09 22:10:30 -03:00
										 |  |  | 	f->close(); | 
					
						
							|  |  |  | 	memdelete(f); | 
					
						
							|  |  |  | } |