doc_data.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. #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. String enumeration;
  58. String description;
  59. };
  60. struct PropertyDoc {
  61. String name;
  62. String type;
  63. String enumeration;
  64. String description;
  65. String setter, getter;
  66. bool operator<(const PropertyDoc &p_prop) const {
  67. return name < p_prop.name;
  68. }
  69. };
  70. struct ClassDoc {
  71. String name;
  72. String inherits;
  73. String category;
  74. String brief_description;
  75. String description;
  76. Vector<String> tutorials;
  77. String demos;
  78. Vector<MethodDoc> methods;
  79. Vector<MethodDoc> signals;
  80. Vector<ConstantDoc> constants;
  81. Vector<PropertyDoc> properties;
  82. Vector<PropertyDoc> theme_properties;
  83. };
  84. String version;
  85. Map<String, ClassDoc> class_list;
  86. Error _load(Ref<XMLParser> parser);
  87. public:
  88. void merge_from(const DocData &p_data);
  89. void remove_from(const DocData &p_data);
  90. void generate(bool p_basic_types = false);
  91. Error load_classes(const String &p_dir);
  92. static Error erase_classes(const String &p_dir);
  93. Error save_classes(const String &p_default_path, const Map<String, String> &p_class_path);
  94. Error load_compressed(const uint8_t *p_data, int p_compressed_size, int p_uncompressed_size);
  95. };
  96. #endif // DOC_DATA_H