mirror of
https://github.com/aria2/aria2.git
synced 2025-01-24 02:31:29 +00:00
mkapiref.py: Add class name to member functions and methods
This commit is contained in:
parent
31f88ef387
commit
e47b012969
@ -74,9 +74,30 @@ class StructDoc:
|
||||
print(' {}'.format(line))
|
||||
print()
|
||||
for name, content in self.members:
|
||||
print(''' .. {}:: {}'''.format(\
|
||||
'function' if name.endswith(')') else self.member_domain,
|
||||
name))
|
||||
name = name.strip()
|
||||
# For function (e.g., int foo())
|
||||
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()
|
||||
for line in content:
|
||||
print(''' {}'''.format(line))
|
||||
|
Loading…
Reference in New Issue
Block a user