Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle scoped C++ enums #753

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions breathe/parser/compound.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,18 +154,18 @@ class memberdefTypeSub(supermod.memberdefType):

def __init__(self, initonly=None, kind=None, volatile=None, const=None, raise_=None, virt=None,
readable=None, prot=None, explicit=None, new=None, final=None, writable=None,
add=None, static=None, remove=None, sealed=None, mutable=None, gettable=None,
inline=None, settable=None, id=None, templateparamlist=None, type_=None,
definition='', argsstring='', name='', read='', write='', bitfield='',
add=None, static=None, strong=None, remove=None, sealed=None, mutable=None,
gettable=None, inline=None, settable=None, id=None, templateparamlist=None,
type_=None, definition='', argsstring='', name='', read='', write='', bitfield='',
reimplements=None, reimplementedby=None, param=None, enumvalue=None,
initializer=None, exceptions=None, briefdescription=None, detaileddescription=None,
inbodydescription=None, location=None, references=None, referencedby=None,
refqual=None):

supermod.memberdefType.__init__(self, initonly, kind, volatile, const, raise_, virt,
readable, prot, explicit, new, final, writable, add, static,
remove, sealed, mutable, gettable, inline, settable, id,
templateparamlist, type_, definition, argsstring, name,
strong, remove, sealed, mutable, gettable, inline, settable,
id, templateparamlist, type_, definition, argsstring, name,
read, write, bitfield, reimplements, reimplementedby, param,
enumvalue, initializer, exceptions, briefdescription,
detaileddescription, inbodydescription, location,
Expand Down
7 changes: 6 additions & 1 deletion breathe/parser/compoundsuper.py
Original file line number Diff line number Diff line change
Expand Up @@ -1039,7 +1039,7 @@ def buildChildren(self, child_, nodeName_):
class memberdefType(GeneratedsSuper):
subclass = None
superclass = None
def __init__(self, initonly=None, kind=None, volatile=None, const=None, raisexx=None, virt=None, readable=None, prot=None, explicit=None, new=None, final=None, writable=None, add=None, static=None, remove=None, sealed=None, mutable=None, gettable=None, inline=None, settable=None, id=None, templateparamlist=None, type_=None, definition=None, argsstring=None, name=None, read=None, write=None, bitfield=None, reimplements=None, reimplementedby=None, param=None, enumvalue=None, initializer=None, exceptions=None, briefdescription=None, detaileddescription=None, inbodydescription=None, location=None, references=None, referencedby=None, refqual=None):
def __init__(self, initonly=None, kind=None, volatile=None, const=None, raisexx=None, virt=None, readable=None, prot=None, explicit=None, new=None, final=None, writable=None, add=None, static=None, strong=None, remove=None, sealed=None, mutable=None, gettable=None, inline=None, settable=None, id=None, templateparamlist=None, type_=None, definition=None, argsstring=None, name=None, read=None, write=None, bitfield=None, reimplements=None, reimplementedby=None, param=None, enumvalue=None, initializer=None, exceptions=None, briefdescription=None, detaileddescription=None, inbodydescription=None, location=None, references=None, referencedby=None, refqual=None):
self.initonly = initonly
self.kind = kind
self.volatile = volatile
Expand All @@ -1054,6 +1054,7 @@ def __init__(self, initonly=None, kind=None, volatile=None, const=None, raisexx=
self.writable = writable
self.add = add
self.static = static
self.strong = strong
self.remove = remove
self.sealed = sealed
self.mutable = mutable
Expand Down Expand Up @@ -1186,6 +1187,8 @@ def get_add(self): return self.add
def set_add(self, add): self.add = add
def get_static(self): return self.static
def set_static(self, static): self.static = static
def get_strong(self): return self.strong
def set_strong(self, strong): self.strong = strong
def get_remove(self): return self.remove
def set_remove(self, remove): self.remove = remove
def get_sealed(self): return self.sealed
Expand Down Expand Up @@ -1263,6 +1266,8 @@ def buildAttributes(self, attrs):
self.add = attrs.get('add').value
if attrs.get('static'):
self.static = attrs.get('static').value
if attrs.get('strong'):
self.strong = attrs.get('strong').value
if attrs.get('remove'):
self.remove = attrs.get('remove').value
if attrs.get('sealed'):
Expand Down
7 changes: 5 additions & 2 deletions breathe/renderer/sphinxrenderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ class DomainDirectiveFactory:
"signal": (CPPFunctionObject, "function"),
"slot": (CPPFunctionObject, "function"),
"enum": (CPPEnumObject, "enum"),
"enum-class": (CPPEnumObject, "enum-class"),
"typedef": (CPPTypeObject, "type"),
"using": (CPPTypeObject, "type"),
"union": (CPPUnionObject, "union"),
Expand Down Expand Up @@ -2002,12 +2003,14 @@ def content(contentnode):
enums = self.render_iterable(node.enumvalue)
contentnode.extend(enums)

# TODO: scopedness, Doxygen doesn't seem to generate the xml for that
# TODO: underlying type, Doxygen doesn't seem to generate the xml for that
names = self.get_qualification()
names.append(node.name)
declaration = self.join_nested_name(names)
return self.handle_declaration(node, declaration, content_callback=content)
obj_type = "enum-class" if node.strong == "yes" else "enum"
return self.handle_declaration(
node, declaration, obj_type=obj_type, content_callback=content
)

def visit_enumvalue(self, node) -> List[Node]:
if self.app.config.breathe_show_enumvalue_initializer: # type: ignore
Expand Down
6 changes: 6 additions & 0 deletions examples/doxygen/enum.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ class Test4
V1, /*!< value 1 */
V2 /*!< value 2 */
};

enum class AnotherScopedEnum
{
V1, /*!< value 1 */
V2 /*!< value 2 */
};
};

/*! \class Test4
Expand Down