Skip to content

Commit

Permalink
Expose underlying enum type in the XML output.
Browse files Browse the repository at this point in the history
The <type> element (used for function return type and variable type) is
now reused also for underlying enum type.

C++03-style enum types that don't have the underlying type specified
have the <type> tag as well, but empty to indicate that the underlying
type is unspecified.

Added a new test case for this.
  • Loading branch information
mosra committed Nov 29, 2017
1 parent 4f45bd2 commit 17bceb8
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/xmlgen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,13 @@ static void generateXMLForMember(MemberDef *md,FTextStream &ti,FTextStream &t,De
t << " <argsstring>" << convertToXML(md->argsString()) << "</argsstring>" << endl;
}

if (md->memberType() == MemberType_Enumeration)
{
t << " <type>";
linkifyText(TextGeneratorXMLImpl(t),def,md->getBodyDef(),md,md->enumBaseType());
t << "</type>" << endl;
}

t << " <name>" << convertToXML(md->name()) << "</name>" << endl;

if (md->memberType() == MemberType_Property)
Expand Down
1 change: 1 addition & 0 deletions testing/018/018__def_8c.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
</sectiondef>
<sectiondef kind="enum">
<memberdef kind="enum" id="018__def_8c_1aa57b8491d1d8fc1014dd54bcf83b130a" prot="public" static="no">
<type/>
<name>E</name>
<enumvalue id="018__def_8c_1aa57b8491d1d8fc1014dd54bcf83b130aab1710e6a49014ba389d57c8753c530f4" prot="public">
<name>E1</name>
Expand Down
25 changes: 25 additions & 0 deletions testing/068/068__typed__enum_8cpp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="">
<compounddef id="068__typed__enum_8cpp" kind="file" language="C++">
<compoundname>068_typed_enum.cpp</compoundname>
<sectiondef kind="enum">
<memberdef kind="enum" id="068__typed__enum_8cpp_1aa72902e6181db009a6a84502f81612c2" prot="public" static="no">
<type>unsigned short</type>
<name>E</name>
<briefdescription>
<para>A strongly-typed enum. </para>
</briefdescription>
<detaileddescription>
</detaileddescription>
<inbodydescription>
</inbodydescription>
<location file="068_typed_enum.cpp" line="7" column="1" bodyfile="068_typed_enum.cpp" bodystart="7" bodyend="7"/>
</memberdef>
</sectiondef>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<location file="068_typed_enum.cpp"/>
</compounddef>
</doxygen>
7 changes: 7 additions & 0 deletions testing/068_typed_enum.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// objective: test underlying type and strongness for an enum
// check: 068__typed__enum_8cpp.xml

/** \file */

/** @brief A strongly-typed enum */
enum class E: unsigned short {};

0 comments on commit 17bceb8

Please sign in to comment.