Skip to content

Commit 2246fe3

Browse files
committed
Documentation update
1 parent 0bf73d0 commit 2246fe3

29 files changed

+176
-83
lines changed

Thunder.qbs

+1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ Project {
8686
"modules/physics/bullet/bullet.qbs",
8787
"modules/renders/rendergl/rendergl.qbs",
8888
"modules/vms/angel/angel.qbs",
89+
//"modules/gui/gui.qbs",
8990
//"modules/editor/editor.qbs",
9091
"worldeditor/worldeditor.qbs",
9192
"builder/builder.qbs",

doc/config.qdocconf

+7-5
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ sourcedirs += \
1414
../thirdparty/next/src
1515

1616
excludedirs += \
17-
../engine/src/adapters \
18-
../engine/src/analytics \
19-
../engine/src/converters \
20-
../engine/src/filters \
21-
../engine/src/postprocess
17+
../engine/includes/adapters \
18+
../engine/includes/analytics \
19+
../engine/includes/converters \
20+
../engine/includes/filters \
21+
../engine/includes/postprocess \
22+
../engine/includes/systems \
23+
../thirdparty/assimp
2224

2325
sources.fileextensions = "*.cpp *.qdoc *.mm *.qml"
2426
headers.fileextensions = "*.h *.ch *.h++ *.hh *.hpp *.hxx"

doc/htmlparser.py

+73-9
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,53 @@ def __init__(self, name):
2929
self.tags = None
3030
self.modificators = None
3131

32+
class TypeDef:
33+
def __init__(self, name):
34+
self.name = name
35+
self.description = None # type: Optional[str]
36+
self.enumValues = None # ype: Optional[List]
37+
3238
class ClassDef:
3339
def __init__(self, name):
3440
self.name = name
35-
self.inherits = None # type: Optional[str]
36-
self.description = None # type: Optional[str]
37-
self.methods = OrderedDict() # type: OrderedDict[str, List[MethodDef]]
41+
self.inherits = None # type: Optional[str]
42+
self.description = None # type: Optional[str]
43+
self.methods = OrderedDict() # type: OrderedDict[str, List[MethodDef]]
44+
self.types = list() # type: List[TypeDef]
45+
46+
def extractTypes(element, classDef):
47+
content = list(element)
48+
methods = element.findall(".//*[@class='fn']")
49+
50+
for fn in methods:
51+
result = re.search(r'(.*) (?:(.*))?', "".join(fn.itertext()))
52+
if result is not None:
53+
#Retrieve name
54+
group2 = result.group(2)
55+
nameIndex = group2.rfind("::") + 2
56+
typedDef = TypeDef(group2[nameIndex:])
57+
58+
#Retrieve description fields
59+
typedDef.description = list()
60+
61+
index = content.index(fn) + 1
62+
while(len(element) > index and element[index].tag != "h3"): #Extract enums
63+
table = element[index].find(".//*[@class='valuelist']")
64+
if table is not None:
65+
typedDef.enumValues = list()
66+
for row in table:
67+
rowList = list()
68+
for column in row:
69+
rowList.append("".join(column.itertext()))
70+
typedDef.enumValues.append(rowList)
71+
72+
else:
73+
desc = DescriptionDef("".join(element[index].itertext()))
74+
typedDef.description.append(desc)
75+
76+
index += 1
77+
78+
classDef.types.append(typedDef)
3879

3980
def extractMembers(element, classDef):
4081
content = list(element)
@@ -100,12 +141,22 @@ def extractMembers(element, classDef):
100141
classDef.methods[methodDef.name].append(methodDef)
101142

102143
def parseFile(file):
103-
tree = ET.parse(file)
104-
root = tree.getroot()
144+
print(file)
145+
146+
f = open(file, "r")
147+
data = f.read()
148+
f.close()
149+
150+
data = data.replace("<meta charset=\"utf-8\">", "<meta charset=\"utf-8\"/>")
151+
data = data.replace("&hellip;", "...")
152+
153+
root = ET.fromstring(data)
154+
155+
#tree = ET.parse(file)
156+
#root = tree.getroot()
105157

106158
descr = root.find(".//*[@class='descr']")
107159
if descr is not None:
108-
print(file)
109160
title = root.find(".//*[@class='title']")
110161
classDef = ClassDef(title.text.replace(" Class", ""))
111162

@@ -114,6 +165,10 @@ def parseFile(file):
114165
for p in elements:
115166
classDef.description.append("".join(p.itertext()))
116167

168+
types = root.find(".//*[@class='types']")
169+
if types is not None:
170+
extractTypes(types, classDef)
171+
117172
func = root.find(".//*[@class='func']")
118173
if func is not None:
119174
extractMembers(func, classDef)
@@ -131,10 +186,19 @@ def parseFile(file):
131186
return None
132187

133188
def parseModule(file, files):
134-
tree = ET.parse(file)
135-
root = tree.getroot()
189+
print ("module " + file)
190+
191+
f = open(file, "r")
192+
data = f.read()
193+
f.close()
194+
195+
data = data.replace("<meta charset=\"utf-8\">", "<meta charset=\"utf-8\"/>")
196+
data = data.replace("&hellip;", "...")
197+
198+
root = ET.fromstring(data)
136199

137-
print ("parseModule " + file)
200+
#tree = ET.parse(file)
201+
#root = tree.getroot()
138202

139203
result = list()
140204
for td in root.findall(".//*[@class='tblName']"):

doc/page.rst

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Public Methods
1616

1717
${public}
1818

19+
${enums}
20+
1921
.. _api_${className}_static:
2022
Static Methods
2123
--------------

doc/qdoctorst.py

+21-1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,26 @@ def composeMethods(classDef):
9292
result += "----\n\n"
9393
return result
9494

95+
def composeEnums(classDef):
96+
result = ""
97+
if len(classDef.types) > 0:
98+
result += ".. _api_" + classDef.name + "_enums:\nPublic Enums\n--------------\n\n"
99+
for type in classDef.types:
100+
result += ".. _api_{0}_{1}:\n".format(classDef.name, type.name)
101+
result += "**enum {0}::{1}**\n\n".format(classDef.name, type.name)
102+
103+
for description in type.description:
104+
result += description.text + "\n\n"
105+
106+
table = Texttable(512)
107+
table.set_cols_align(["r", "l", "l"])
108+
109+
if type.enumValues is not None:
110+
for row in type.enumValues:
111+
table.add_row([row[0], row[1], row[2]])
112+
113+
result += table.draw() + "\n\n"
114+
return result;
95115

96116
def main():
97117
try:
@@ -105,7 +125,6 @@ def main():
105125

106126
files = list()
107127

108-
109128
fileList = (f for f in os.listdir("html") if f.endswith(".html"))
110129
for curFile in fileList:
111130
filename = os.path.splitext(curFile)[0]
@@ -130,6 +149,7 @@ def main():
130149
d["public"] = composeTable(classDef, False)
131150
d["static"] = composeTable(classDef, True)
132151
d["methods"] = composeMethods(classDef)
152+
d["enums"] = composeEnums(classDef)
133153
f.write(s.substitute(d))
134154
f.close()
135155

engine/includes/components/camera.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,16 @@ class NEXT_LIBRARY_EXPORT Camera : public Component {
4848
void setRatio (float ratio);
4949

5050
float nearPlane () const;
51-
void setNear (const float value);
51+
void setNear (const float distance);
5252

5353
float farPlane () const;
54-
void setFar (const float value);
54+
void setFar (const float distance);
5555

5656
float focal () const;
5757
void setFocal (const float focal);
5858

5959
float fov () const;
60-
void setFov (const float value);
60+
void setFov (const float angle);
6161

6262
Vector4 color () const;
6363
void setColor (const Vector4 &color);

engine/includes/log.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,17 @@ class NEXT_LIBRARY_EXPORT Log {
3131

3232
Log &operator<< (bool b);
3333

34-
Log &operator<< (uint8_t c);
35-
Log &operator<< (int8_t c);
34+
Log &operator<< (unsigned char c);
35+
Log &operator<< (char c);
3636

37-
Log &operator<< (uint16_t s);
38-
Log &operator<< (int16_t s);
37+
Log &operator<< (unsigned short s);
38+
Log &operator<< (short s);
3939

40-
Log &operator<< (uint32_t i);
41-
Log &operator<< (int32_t i);
40+
Log &operator<< (unsigned int i);
41+
Log &operator<< (int i);
4242

43-
Log &operator<< (uint64_t i);
44-
Log &operator<< (int64_t i);
43+
Log &operator<< (unsigned long long i);
44+
Log &operator<< (long long i);
4545

4646
Log &operator<< (float f);
4747
Log &operator<< (double d);

engine/includes/resources/translator.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ class NEXT_LIBRARY_EXPORT Translator : public Resource {
2323
void setPair(const string &source, const string &translation);
2424

2525
private:
26-
void loadUserData (const VariantMap &data) override;
27-
VariantMap saveUserData () const override;
26+
void loadUserData(const VariantMap &data) override;
27+
VariantMap saveUserData() const override;
2828

2929
private:
3030
TranslatorPrivate *p_ptr;

engine/src/components/actor.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ bool Actor::isEnabled() const {
203203
return p_ptr->m_Enable;
204204
}
205205
/*!
206-
Marks this Actor as enabled or disabled.
206+
Marks this Actor as \a enabled or disabled.
207207
Disabled Actors becomes invisible for the user.
208208
*/
209209
void Actor::setEnabled(const bool enabled) {
@@ -350,6 +350,7 @@ void Actor::clearCloneRef () {
350350
}
351351
/*!
352352
Makes the actor a child of the \a parent.
353+
\note Please ignore the \a force flag it will be provided by the default.
353354
*/
354355
void Actor::setParent(Object *parent, bool force) {
355356
PROFILE_FUNCTION();

engine/src/components/camera.cpp

+13-13
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ Pipeline *Camera::pipeline() {
100100
return p_ptr->m_pPipeline;
101101
}
102102
/*!
103-
Attaches render pipeline to the camera.
103+
Attaches render \a pipeline to the camera.
104104
*/
105105
void Camera::setPipeline(Pipeline *pipeline) {
106106
p_ptr->m_pPipeline = pipeline;
@@ -202,11 +202,11 @@ float Camera::fov() const {
202202
return p_ptr->m_FOV;
203203
}
204204
/*!
205-
Sets field of view angle for the camera in degrees.
205+
Sets field of view \a angle for the camera in degrees.
206206
\note Applicable only for the perspective mode.
207207
*/
208-
void Camera::setFov(const float value) {
209-
p_ptr->m_FOV = value;
208+
void Camera::setFov(const float angle) {
209+
p_ptr->m_FOV = angle;
210210
}
211211
/*!
212212
Returns a distance to near cut plane.
@@ -215,10 +215,10 @@ float Camera::nearPlane() const {
215215
return p_ptr->m_Near;
216216
}
217217
/*!
218-
Sets a distance to near cut plane.
218+
Sets a \a distance to near cut plane.
219219
*/
220-
void Camera::setNear(float value) {
221-
p_ptr->m_Near = value;
220+
void Camera::setNear(const float distance) {
221+
p_ptr->m_Near = distance;
222222
}
223223
/*!
224224
Returns a distance to far cut plane.
@@ -227,10 +227,10 @@ float Camera::farPlane() const {
227227
return p_ptr->m_Far;
228228
}
229229
/*!
230-
Sets a distance to far cut plane.
230+
Sets a \a distance to far cut plane.
231231
*/
232-
void Camera::setFar(const float value) {
233-
p_ptr->m_Far = value;
232+
void Camera::setFar(const float distance) {
233+
p_ptr->m_Far = distance;
234234
}
235235
/*!
236236
Returns the aspect ratio (width divided by height).
@@ -251,7 +251,7 @@ float Camera::focal() const {
251251
return p_ptr->m_Focal;
252252
}
253253
/*!
254-
Sets a focal distance for the camera.
254+
Sets a \a focal distance for the camera.
255255
*/
256256
void Camera::setFocal(const float focal) {
257257
p_ptr->m_Focal = focal;
@@ -299,7 +299,7 @@ Camera *Camera::current() {
299299
return CameraPrivate::s_pCurrent;
300300
}
301301
/*!
302-
Sets current active camera.
302+
Sets \a current active camera.
303303
*/
304304
void Camera::setCurrent(Camera *current) {
305305
CameraPrivate::s_pCurrent = current;
@@ -355,7 +355,7 @@ array<Vector3, 8> Camera::frustumCorners(bool ortho, float sigma, float ratio, c
355355
fc - up * fh - right * fw};
356356
}
357357
/*!
358-
Filters out an incoming \a list which are not in the frustum.
358+
Filters out an incoming \a list which are not in the \a frustum.
359359
Returns filtered list.
360360
*/
361361
Object::ObjectList Camera::frustumCulling(ObjectList &list, const array<Vector3, 8> &frustum) {

engine/src/components/spriterender.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ Vector2 SpriteRender::size() const {
254254
return p_ptr->m_Size;
255255
}
256256
/*!
257-
Sets a new size of sprite.
257+
Sets a new \a size of sprite.
258258
*/
259259
void SpriteRender::setSize(const Vector2 &size) {
260260
p_ptr->m_Size = size;

engine/src/components/transform.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Quaternion Transform::quaternion() const {
8282
return p_ptr->m_Rotation;
8383
}
8484
/*!
85-
Changes the \a rotation of the Transform in local space by provided Quaternion.
85+
Changes the rotation \a quaternion of the Transform in local space by provided Quaternion.
8686
*/
8787
void Transform::setQuaternion(const Quaternion &quaternion) {
8888
p_ptr->m_Rotation = quaternion;

engine/src/input.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Vector4 Input::mouseDelta() {
6666
return s_pPlatform->mouseDelta();
6767
}
6868
/*!
69-
Returns the states of mouse buttons.
69+
Returns the state of mouse \a button.
7070
Please refer to Input::MouseButton to see possible buttons.
7171
Example code:
7272
\code

0 commit comments

Comments
 (0)