Skip to content

Commit

Permalink
Change rendering of friend classes
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobandersen committed Apr 22, 2020
1 parent e61386e commit 6de2223
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions breathe/renderer/sphinxrenderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1512,6 +1512,25 @@ def visit_variable(self, node):
else:
return self.render_declaration(node, declaration)

def visit_friendclass(self, node):
dom = self.get_domain()
assert not dom or dom == 'cpp'

assert ''.join(n.astext() for n in self.render(node.get_type())) == "friend class"
desc = self.node_factory.desc()
desc['objtype'] = 'friendclass'
signode = self.node_factory.desc_signature()
desc += signode

signode += self.node_factory.desc_annotation('friend class')
signode += self.node_factory.Text(' ')
# expr = cpp.CPPExprRole(asCode=False)
# expr.text = node.name
# TODO: set most of the things that SphinxRole.__call__ sets
# signode.extend(expr.run())
signode += self.node_factory.Text(node.name)
return [desc]

def visit_param(self, node):

nodelist = []
Expand Down Expand Up @@ -1641,6 +1660,9 @@ def dispatch_memberdef(self, node):
return self.visit_variable(node)
if node.kind == "define":
return self.visit_define(node)
if node.kind == "friend":
# note, friend functions should be dispatched further up
return self.visit_friendclass(node)
return self.render_declaration(node, update_signature=self.update_signature)

# A mapping from node types to corresponding dispatch and visit methods.
Expand Down

0 comments on commit 6de2223

Please sign in to comment.