1 /*************************************************************************/ 2 /* doc_data.h */ 3 /*************************************************************************/ 4 /* This file is part of: */ 5 /* GODOT ENGINE */ 6 /* https://godotengine.org */ 7 /*************************************************************************/ 8 /* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ 9 /* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ 10 /* */ 11 /* Permission is hereby granted, free of charge, to any person obtaining */ 12 /* a copy of this software and associated documentation files (the */ 13 /* "Software"), to deal in the Software without restriction, including */ 14 /* without limitation the rights to use, copy, modify, merge, publish, */ 15 /* distribute, sublicense, and/or sell copies of the Software, and to */ 16 /* permit persons to whom the Software is furnished to do so, subject to */ 17 /* the following conditions: */ 18 /* */ 19 /* The above copyright notice and this permission notice shall be */ 20 /* included in all copies or substantial portions of the Software. */ 21 /* */ 22 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ 23 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ 24 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ 25 /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ 26 /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ 27 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ 28 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ 29 /*************************************************************************/ 30 #ifndef DOC_DATA_H 31 #define DOC_DATA_H 32 33 #include "io/xml_parser.h" 34 #include "map.h" 35 #include "variant.h" 36 37 class DocData { 38 public: 39 struct ArgumentDoc { 40 41 String name; 42 String type; 43 String default_value; 44 }; 45 46 struct MethodDoc { 47 48 String name; 49 String return_type; 50 String qualifiers; 51 String description; 52 Vector<ArgumentDoc> arguments; 53 bool operator<(const MethodDoc &p_md) const { 54 return name < p_md.name; 55 } 56 }; 57 58 struct ConstantDoc { 59 60 String name; 61 String value; 62 String description; 63 }; 64 65 struct PropertyDoc { 66 67 String name; 68 String type; 69 String description; 70 bool operator<(const PropertyDoc &p_prop) const { 71 return name < p_prop.name; 72 } 73 }; 74 75 struct ClassDoc { 76 77 String name; 78 String inherits; 79 String category; 80 String brief_description; 81 String description; 82 Vector<MethodDoc> methods; 83 Vector<MethodDoc> signals; 84 Vector<ConstantDoc> constants; 85 Vector<PropertyDoc> properties; 86 Vector<PropertyDoc> theme_properties; 87 }; 88 89 String version; 90 91 Map<String, ClassDoc> class_list; 92 Error _load(Ref<XMLParser> parser); 93 94 public: 95 void merge_from(const DocData &p_data); 96 void generate(bool p_basic_types = false); 97 Error load(const String &p_path); 98 Error save(const String &p_path); 99 100 Error load_compressed(const uint8_t *p_data, int p_compressed_size, int p_uncompressed_size); 101 }; 102 103 #endif // DOC_DATA_H 104