doc_data.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /**************************************************************************/
  2. /* doc_data.h */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  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. #include "core/io/xml_parser.h"
  33. #include "core/map.h"
  34. #include "core/variant.h"
  35. class DocData {
  36. public:
  37. struct ArgumentDoc {
  38. String name;
  39. String type;
  40. String enumeration;
  41. String default_value;
  42. };
  43. struct MethodDoc {
  44. String name;
  45. String return_type;
  46. String return_enum;
  47. String qualifiers;
  48. String description;
  49. Vector<ArgumentDoc> arguments;
  50. bool operator<(const MethodDoc &p_md) const {
  51. return name < p_md.name;
  52. }
  53. };
  54. struct ConstantDoc {
  55. String name;
  56. String value;
  57. bool is_value_valid;
  58. String enumeration;
  59. String description;
  60. };
  61. struct PropertyDoc {
  62. String name;
  63. String type;
  64. String enumeration;
  65. String description;
  66. String setter, getter;
  67. String default_value;
  68. bool overridden;
  69. String overrides;
  70. bool operator<(const PropertyDoc &p_prop) const {
  71. return name < p_prop.name;
  72. }
  73. PropertyDoc() {
  74. overridden = false;
  75. }
  76. };
  77. struct ThemeItemDoc {
  78. String name;
  79. String type;
  80. String data_type;
  81. String description;
  82. String default_value;
  83. bool operator<(const ThemeItemDoc &p_theme_item) const {
  84. // First sort by the data type, then by name.
  85. if (data_type == p_theme_item.data_type) {
  86. return name < p_theme_item.name;
  87. }
  88. return data_type < p_theme_item.data_type;
  89. }
  90. };
  91. struct TutorialDoc {
  92. String link;
  93. String title;
  94. };
  95. struct ClassDoc {
  96. String name;
  97. String inherits;
  98. String category;
  99. String brief_description;
  100. String description;
  101. Vector<TutorialDoc> tutorials;
  102. Vector<MethodDoc> methods;
  103. Vector<MethodDoc> signals;
  104. Vector<ConstantDoc> constants;
  105. Vector<PropertyDoc> properties;
  106. Vector<ThemeItemDoc> theme_properties;
  107. };
  108. String version;
  109. Map<String, ClassDoc> class_list;
  110. Error _load(Ref<XMLParser> parser);
  111. public:
  112. void merge_from(const DocData &p_data);
  113. void remove_from(const DocData &p_data);
  114. void generate(bool p_basic_types = false);
  115. Error load_classes(const String &p_dir);
  116. static Error erase_classes(const String &p_dir);
  117. Error save_classes(const String &p_default_path, const Map<String, String> &p_class_path);
  118. Error load_compressed(const uint8_t *p_data, int p_compressed_size, int p_uncompressed_size);
  119. };
  120. #endif // DOC_DATA_H