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.
|
# documentation regardless of this setting.
|
||||||
# Minimum value: 0, maximum value: 10000, default value: 30.
|
# 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
|
# 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
|
# 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
|
class_name = compound.find('name').text
|
||||||
if not class_name.startswith('sigrok::'):
|
if not class_name.startswith('sigrok::'):
|
||||||
continue
|
continue
|
||||||
|
trimmed_name = class_name.split('::')[1]
|
||||||
doc = ElementTree.parse("%s/%s.xml" % (input_dir, compound.attrib['refid']))
|
doc = ElementTree.parse("%s/%s.xml" % (input_dir, compound.attrib['refid']))
|
||||||
cls = doc.find('compounddef')
|
cls = doc.find('compounddef')
|
||||||
brief = get_text(cls.find('briefdescription'))
|
brief = get_text(cls.find('briefdescription'))
|
||||||
|
@ -64,27 +65,30 @@ for compound in index.findall('compound'):
|
||||||
if description:
|
if description:
|
||||||
parameters[name] = description
|
parameters[name] = description
|
||||||
if brief:
|
if brief:
|
||||||
if language == 'python':
|
if language == 'python' and kind == 'public-func':
|
||||||
print(str.join('\n', [
|
print(str.join('\n', [
|
||||||
'%%feature("docstring") %s::%s "%s' % (
|
'%%feature("docstring") %s::%s "%s' % (
|
||||||
class_name, member_name, brief)] + [
|
class_name, member_name, brief)] + [
|
||||||
'@param %s %s' % (name, desc)
|
'@param %s %s' % (name, desc)
|
||||||
for name, desc in parameters.items()]) + '";')
|
for name, desc in parameters.items()]) + '";')
|
||||||
elif language == 'java':
|
elif language == 'java' and kind == 'public-func':
|
||||||
if kind == 'public-func':
|
|
||||||
print(str.join('\n', [
|
print(str.join('\n', [
|
||||||
'%%javamethodmodifiers %s::%s "/** %s' % (
|
'%%javamethodmodifiers %s::%s "/** %s' % (
|
||||||
class_name, member_name, brief)] + [
|
class_name, member_name, brief)] + [
|
||||||
' * @param %s %s' % (name, desc)
|
' * @param %s %s' % (name, desc)
|
||||||
for name, desc in parameters.items()])
|
for name, desc in parameters.items()])
|
||||||
+ ' */\npublic"')
|
+ ' */\npublic"')
|
||||||
elif kind == 'public-static-attrib':
|
elif kind == 'public-static-attrib':
|
||||||
constants.append((member_name, brief))
|
constants.append((member_name, brief))
|
||||||
if language == 'java' and constants:
|
if language == 'java' and constants:
|
||||||
print('%%typemap(javacode) %s %%{' % class_name)
|
print('%%typemap(javacode) %s %%{' % class_name)
|
||||||
for member_name, brief in constants:
|
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' % (
|
print(' /** %s */\n public static final %s %s = new %s(classesJNI.%s_%s_get(), false);\n' % (
|
||||||
brief, trimmed_name, member_name, trimmed_name,
|
brief, trimmed_name, member_name, trimmed_name,
|
||||||
trimmed_name, member_name))
|
trimmed_name, member_name))
|
||||||
print('%}')
|
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