Skip to content

Commit

Permalink
Merge pull request #581 from yamt/breathe_show_enumvalue_initializer
Browse files Browse the repository at this point in the history
Add breathe_show_enumvalue_initializer option
  • Loading branch information
vermeeren authored Sep 17, 2020
2 parents 75f8ab2 + 00994e6 commit 87fc859
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ Inspired by `Keepachangelog.com <http://keepachangelog.com/>`__.
- Unreleased - Breathe v4.21.1

- Fix Read the Docs build (again). #576
- New boolean `breathe_show_enumvalue_initializer` option specifying
whether value of enumvalue should be displayed. #581

- 2020-09-10 - Breathe v4.21.0

Expand Down
1 change: 1 addition & 0 deletions breathe/directives.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@ def setup(app: Sphinx) -> None:
app.add_config_value("breathe_build_directory", '', True)
app.add_config_value("breathe_default_members", (), True)
app.add_config_value("breathe_show_define_initializer", False, 'env')
app.add_config_value("breathe_show_enumvalue_initializer", False, 'env')
app.add_config_value("breathe_implementation_filename_extensions", ['.c', '.cc', '.cpp'], True)
app.add_config_value("breathe_doxygen_config_options", {}, True)
app.add_config_value("breathe_use_project_refids", False, "env")
Expand Down
5 changes: 4 additions & 1 deletion breathe/renderer/sphinxrenderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1656,7 +1656,10 @@ def content(contentnode):
return self.handle_declaration(node, declaration, content_callback=content)

def visit_enumvalue(self, node) -> List[Node]:
declaration = node.name + self.make_initializer(node)
if self.app.config.breathe_show_enumvalue_initializer: # type: ignore
declaration = node.name + self.make_initializer(node)
else:
declaration = node.name
return self.handle_declaration(node, declaration, obj_type='enumvalue')

def visit_typedef(self, node) -> List[Node]:
Expand Down
7 changes: 7 additions & 0 deletions documentation/source/directives.rst
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,13 @@ Config Values
For example a define ``MAX_LENGTH 100`` would be shown with the value 100 if this is set to ``True``,
and without if it is set to ``False``.

.. confval:: breathe_show_enumvalue_initializer

A boolean flag which can be set to ``True`` to display the initializer of an enum value in the output.

For example an enum value ``TWO = 2`` would be shown with the value 2 if this is set to ``True``,
and without if it is set to ``False``.

.. confval:: breathe_use_project_refids

True or False setting to control if the refids generated by breathe for doxygen
Expand Down

0 comments on commit 87fc859

Please sign in to comment.