Files
fs2open.github.com/code/scripting/scripting_doc.h
T
asarium 4a6628e16f Unify and clean up Lua documentation generation
I added a pretty generic container structure for the scripting
documentation when adding JSON output. However, I did not use that new
structure for the HTML output since that was just too much work.

This moves the HTML output over to the new structure so now the
scripting API handling code is independent from how the resulting
documentation is generated. I also moved that code out of the main
scripting code which removes quite a lot of clutter in those files.

This is mostly a straight port of the old code with no significant
changes (except the changes to make it use the new data).
2020-06-13 16:46:26 +02:00

92 lines
1.8 KiB
C++

#pragma once
#include "globalincs/pstypes.h"
#include "scripting/ade_doc.h"
#include "scripting/doc_parser.h"
#include "scripting/hook_api.h"
namespace scripting {
enum class ElementType {
Unknown,
Library,
Class,
Function,
Operator,
Property,
};
struct DocumentationElement {
virtual ~DocumentationElement() = default;
ElementType type = ElementType::Unknown;
SCP_string name;
SCP_string shortName;
SCP_string description;
gameversion::version deprecationVersion;
SCP_string deprecationMessage;
SCP_vector<std::unique_ptr<DocumentationElement>> children;
};
struct DocumentationElementClass : public DocumentationElement {
~DocumentationElementClass() override = default;
SCP_string superClass;
};
struct DocumentationElementProperty : public DocumentationElement {
~DocumentationElementProperty() override = default;
scripting::ade_type_info getterType;
SCP_string setterType;
SCP_string returnDocumentation;
};
struct DocumentationElementFunction : public DocumentationElement {
~DocumentationElementFunction() override = default;
scripting::ade_type_info returnType;
struct argument_list {
SCP_string simple;
SCP_vector<scripting::argument_def> arguments;
};
SCP_vector<argument_list> overloads;
SCP_string returnDocumentation;
};
struct DocumentationEnum {
SCP_string name;
int value;
};
struct DocumentationAction {
SCP_string name;
SCP_string description;
SCP_vector<HookVariableDocumentation> parameters;
bool overridable;
};
struct ScriptingDocumentation {
SCP_string name;
SCP_vector<SCP_string> conditions;
SCP_vector<HookVariableDocumentation> globalVariables;
SCP_vector<DocumentationAction> actions;
SCP_vector<std::unique_ptr<DocumentationElement>> elements;
SCP_vector<DocumentationEnum> enumerations;
};
}