python: Add docstrings for enum constants.
This commit is contained in:
parent
8fb7efe203
commit
ef9643a2bb
|
@ -617,7 +617,7 @@ ENABLED_SECTIONS =
|
|||
# documentation regardless of this setting.
|
||||
# Minimum value: 0, maximum value: 10000, default value: 30.
|
||||
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
MAX_INITIALIZER_LINES = 0
|
||||
|
||||
# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
|
||||
# the bottom of the documentation of classes and structs. If set to YES the list
|
||||
|
|
|
@ -36,6 +36,7 @@ for compound in index.findall('compound'):
|
|||
class_name = compound.find('name').text
|
||||
if not class_name.startswith('sigrok::'):
|
||||
continue
|
||||
trimmed_name = class_name.split('::')[1]
|
||||
doc = ElementTree.parse("%s/%s.xml" % (input_dir, compound.attrib['refid']))
|
||||
cls = doc.find('compounddef')
|
||||
brief = get_text(cls.find('briefdescription'))
|
||||
|
@ -64,27 +65,30 @@ for compound in index.findall('compound'):
|
|||
if description:
|
||||
parameters[name] = description
|
||||
if brief:
|
||||
if language == 'python':
|
||||
if language == 'python' and kind == 'public-func':
|
||||
print(str.join('\n', [
|
||||
'%%feature("docstring") %s::%s "%s' % (
|
||||
class_name, member_name, brief)] + [
|
||||
'@param %s %s' % (name, desc)
|
||||
for name, desc in parameters.items()]) + '";')
|
||||
elif language == 'java':
|
||||
if kind == 'public-func':
|
||||
elif language == 'java' and kind == 'public-func':
|
||||
print(str.join('\n', [
|
||||
'%%javamethodmodifiers %s::%s "/** %s' % (
|
||||
class_name, member_name, brief)] + [
|
||||
' * @param %s %s' % (name, desc)
|
||||
for name, desc in parameters.items()])
|
||||
+ ' */\npublic"')
|
||||
elif kind == 'public-static-attrib':
|
||||
constants.append((member_name, brief))
|
||||
elif kind == 'public-static-attrib':
|
||||
constants.append((member_name, brief))
|
||||
if language == 'java' and constants:
|
||||
print('%%typemap(javacode) %s %%{' % class_name)
|
||||
for member_name, brief in constants:
|
||||
trimmed_name = class_name.split('::')[1]
|
||||
print(' /** %s */\n public static final %s %s = new %s(classesJNI.%s_%s_get(), false);\n' % (
|
||||
brief, trimmed_name, member_name, trimmed_name,
|
||||
trimmed_name, member_name))
|
||||
print('%}')
|
||||
elif language == 'python' and constants:
|
||||
print('%%extend %s {\n%%pythoncode %%{' % class_name)
|
||||
for member_name, brief in constants:
|
||||
print(' ## @brief %s\n %s = None' % (brief, member_name))
|
||||
print('%}\n}')
|
||||
|
|
Loading…
Reference in New Issue