mirror of https://github.com/aria2/aria2
mkapiref.py: Add class name to member functions and methods
parent
31f88ef387
commit
e47b012969
|
@ -74,9 +74,30 @@ class StructDoc:
|
||||||
print(' {}'.format(line))
|
print(' {}'.format(line))
|
||||||
print()
|
print()
|
||||||
for name, content in self.members:
|
for name, content in self.members:
|
||||||
print(''' .. {}:: {}'''.format(\
|
name = name.strip()
|
||||||
'function' if name.endswith(')') else self.member_domain,
|
# For function (e.g., int foo())
|
||||||
name))
|
m = re.match(r'(.+)\s+([^ ]+\(.*)', name)
|
||||||
|
if not m:
|
||||||
|
# For variable (e.g., bool a)
|
||||||
|
m = re.match(r'(.+)\s+([^ ]+)', name)
|
||||||
|
if m:
|
||||||
|
print(''' .. {}:: {} {}::{}'''.format(
|
||||||
|
'function' if name.endswith(')') else self.member_domain,
|
||||||
|
m.group(1),
|
||||||
|
self.name,
|
||||||
|
m.group(2)))
|
||||||
|
else:
|
||||||
|
if name.endswith(')'):
|
||||||
|
# For function, without return type, like
|
||||||
|
# constructor
|
||||||
|
print(''' .. {}:: {}::{}'''.format(
|
||||||
|
'function' if name.endswith(')') else self.member_domain,
|
||||||
|
self.name, name))
|
||||||
|
else:
|
||||||
|
# enum
|
||||||
|
print(''' .. {}:: {}'''.format(
|
||||||
|
'function' if name.endswith(')') else self.member_domain,
|
||||||
|
name))
|
||||||
print()
|
print()
|
||||||
for line in content:
|
for line in content:
|
||||||
print(''' {}'''.format(line))
|
print(''' {}'''.format(line))
|
||||||
|
|
Loading…
Reference in New Issue