File: scripting_doc.h

package info (click to toggle)
freespace2 24.2.0%2Brepack-1
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid
  • size: 43,716 kB
  • sloc: cpp: 595,001; ansic: 21,741; python: 1,174; sh: 457; makefile: 248; xml: 181
file content (103 lines) | stat: -rw-r--r-- 2,142 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#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;
	scripting::ade_type_info 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<SCP_string> genericTypes;
	};

	SCP_vector<argument_list> overloads;

	SCP_string returnDocumentation;
};

struct DocumentationEnum {
	SCP_string name;
	int value;
};

struct DocumentationOption {
	SCP_string title;
	SCP_string description;
	SCP_string key;
};

struct DocumentationAction {
	SCP_string name;
	SCP_string description;
	SCP_vector<HookVariableDocumentation> parameters;
	const SCP_unordered_map<SCP_string, const std::unique_ptr<const ParseableCondition>>& conditions;
	const tl::optional<HookDeprecationOptions>& deprecation;
	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;
	
	SCP_vector<DocumentationOption> options;
};

}