From 17bceb8f4580535de52d19e8cadf0d088f972bef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 29 Nov 2017 18:38:13 +0100 Subject: Expose underlying enum type in the XML output. The 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 tag as well, but empty to indicate that the underlying type is unspecified. Added a new test case for this. --- src/xmlgen.cpp | 7 +++++++ testing/018/018__def_8c.xml | 1 + testing/068/068__typed__enum_8cpp.xml | 25 +++++++++++++++++++++++++ testing/068_typed_enum.cpp | 7 +++++++ 4 files changed, 40 insertions(+) create mode 100644 testing/068/068__typed__enum_8cpp.xml create mode 100644 testing/068_typed_enum.cpp diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp index 1b03c3b..3b81408 100644 --- a/src/xmlgen.cpp +++ b/src/xmlgen.cpp @@ -802,6 +802,13 @@ static void generateXMLForMember(MemberDef *md,FTextStream &ti,FTextStream &t,De t << " " << convertToXML(md->argsString()) << "" << endl; } + if (md->memberType() == MemberType_Enumeration) + { + t << " "; + linkifyText(TextGeneratorXMLImpl(t),def,md->getBodyDef(),md,md->enumBaseType()); + t << "" << endl; + } + t << " " << convertToXML(md->name()) << "" << endl; if (md->memberType() == MemberType_Property) diff --git a/testing/018/018__def_8c.xml b/testing/018/018__def_8c.xml index 8518666..8bc5c09 100644 --- a/testing/018/018__def_8c.xml +++ b/testing/018/018__def_8c.xml @@ -18,6 +18,7 @@ + E E1 diff --git a/testing/068/068__typed__enum_8cpp.xml b/testing/068/068__typed__enum_8cpp.xml new file mode 100644 index 0000000..d6f1058 --- /dev/null +++ b/testing/068/068__typed__enum_8cpp.xml @@ -0,0 +1,25 @@ + + + + 068_typed_enum.cpp + + + unsigned short + E + + A strongly-typed enum. + + + + + + + + + + + + + + + diff --git a/testing/068_typed_enum.cpp b/testing/068_typed_enum.cpp new file mode 100644 index 0000000..44c4123 --- /dev/null +++ b/testing/068_typed_enum.cpp @@ -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 {}; -- cgit v0.12 From 169cad806ea795e5c425fd397aa0de54cbc0a81e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 29 Nov 2017 18:51:39 +0100 Subject: Provide information about enum type "strongness" in the XML output. There's a new boolean `strong` attribute on the `` element that defines whether the enum is a classic or a strong one. Tests were updated to verify both cases. --- src/xmlgen.cpp | 7 +++++++ templates/xml/compound.xsd | 1 + testing/018/018__def_8c.xml | 2 +- testing/068/068__typed__enum_8cpp.xml | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp index 3b81408..5196eef 100644 --- a/src/xmlgen.cpp +++ b/src/xmlgen.cpp @@ -668,6 +668,13 @@ static void generateXMLForMember(MemberDef *md,FTextStream &ti,FTextStream &t,De t << "\""; } + if (md->memberType() == MemberType_Enumeration) + { + t << " strong=\""; + if (md->isStrong()) t << "yes"; else t << "no"; + t << "\""; + } + if (md->memberType() == MemberType_Variable) { //ArgumentList *al = md->argumentList(); diff --git a/templates/xml/compound.xsd b/templates/xml/compound.xsd index 8affc20..0720823 100644 --- a/templates/xml/compound.xsd +++ b/templates/xml/compound.xsd @@ -146,6 +146,7 @@ + diff --git a/testing/018/018__def_8c.xml b/testing/018/018__def_8c.xml index 8bc5c09..5f42767 100644 --- a/testing/018/018__def_8c.xml +++ b/testing/018/018__def_8c.xml @@ -17,7 +17,7 @@ - + E diff --git a/testing/068/068__typed__enum_8cpp.xml b/testing/068/068__typed__enum_8cpp.xml index d6f1058..880bf14 100644 --- a/testing/068/068__typed__enum_8cpp.xml +++ b/testing/068/068__typed__enum_8cpp.xml @@ -3,7 +3,7 @@ 068_typed_enum.cpp - + unsigned short E -- cgit v0.12