summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2018-12-26 12:13:57 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2018-12-26 12:13:57 (GMT)
commit6102ff5e5d93db9f23ebff8255302bcdb238ce49 (patch)
treeb3b49af66d21903b9c99fe2ed137234ddce50aca
parent1f4a3ab39a467b2e5e0159f95ed10cb9830d5011 (diff)
parent63931be561ab140b558418cffdd9b63b522c0e0d (diff)
downloadDoxygen-6102ff5e5d93db9f23ebff8255302bcdb238ce49.zip
Doxygen-6102ff5e5d93db9f23ebff8255302bcdb238ce49.tar.gz
Doxygen-6102ff5e5d93db9f23ebff8255302bcdb238ce49.tar.bz2
Merge branch 'mosra-xml-namespace-members-in-file-scope'
-rw-r--r--src/config.xml9
-rw-r--r--src/xmlgen.cpp17
-rw-r--r--testing/077/077__no__xml__namespace__members__in__file__scope_8h.xml12
-rw-r--r--testing/077_no_xml_namespace_members_in_file_scope.h16
-rw-r--r--testing/078/078__xml__namespace__members__in__file__scope_8h.xml43
-rw-r--r--testing/078_xml_namespace_members_in_file_scope.h17
6 files changed, 108 insertions, 6 deletions
diff --git a/src/config.xml b/src/config.xml
index db0f557..00a972d 100644
--- a/src/config.xml
+++ b/src/config.xml
@@ -2945,6 +2945,15 @@ or
]]>
</docs>
</option>
+ <option type='bool' id='XML_NS_MEMB_FILE_SCOPE' defval='0' depends='GENERATE_XML'>
+ <docs>
+<![CDATA[
+ If the \c XML_NS_MEMB_FILE_SCOPE tag is set to \c YES, doxygen
+ will include namespace members in file scope as well, matching the HTML
+ output.
+]]>
+ </docs>
+ </option>
</group>
<group name='Docbook' docs='Configuration options related to the DOCBOOK output'>
<option type='bool' id='GENERATE_DOCBOOK' defval='0'>
diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp
index 4b12757..bacf4d4 100644
--- a/src/xmlgen.cpp
+++ b/src/xmlgen.cpp
@@ -1015,6 +1015,15 @@ static void generateXMLForMember(MemberDef *md,FTextStream &ti,FTextStream &t,De
t << " </memberdef>" << endl;
}
+// namespace members are also inserted in the file scope, but
+// to prevent this duplication in the XML output, we optionally filter those here.
+static bool memberVisible(Definition *d,MemberDef *md)
+{
+ return Config_getBool(XML_NS_MEMB_FILE_SCOPE) ||
+ d->definitionType()!=Definition::TypeFile ||
+ md->getNamespaceDef()==0;
+}
+
static void generateXMLSection(Definition *d,FTextStream &ti,FTextStream &t,
MemberList *ml,const char *kind,const char *header=0,
const char *documentation=0)
@@ -1025,9 +1034,7 @@ static void generateXMLSection(Definition *d,FTextStream &ti,FTextStream &t,
int count=0;
for (mli.toFirst();(md=mli.current());++mli)
{
- // namespace members are also inserted in the file scope, but
- // to prevent this duplication in the XML output, we filter those here.
- if (d->definitionType()!=Definition::TypeFile || md->getNamespaceDef()==0)
+ if (memberVisible(d,md))
{
count++;
}
@@ -1047,9 +1054,7 @@ static void generateXMLSection(Definition *d,FTextStream &ti,FTextStream &t,
}
for (mli.toFirst();(md=mli.current());++mli)
{
- // namespace members are also inserted in the file scope, but
- // to prevent this duplication in the XML output, we filter those here.
- if (d->definitionType()!=Definition::TypeFile || md->getNamespaceDef()==0)
+ if (memberVisible(d,md))
{
generateXMLForMember(md,ti,t,d);
}
diff --git a/testing/077/077__no__xml__namespace__members__in__file__scope_8h.xml b/testing/077/077__no__xml__namespace__members__in__file__scope_8h.xml
new file mode 100644
index 0000000..9825cc1
--- /dev/null
+++ b/testing/077/077__no__xml__namespace__members__in__file__scope_8h.xml
@@ -0,0 +1,12 @@
+<?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="077__no__xml__namespace__members__in__file__scope_8h" kind="file" language="C++">
+ <compoundname>077_no_xml_namespace_members_in_file_scope.h</compoundname>
+ <innernamespace refid="namespace_namespace">Namespace</innernamespace>
+ <briefdescription>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <location file="077_no_xml_namespace_members_in_file_scope.h"/>
+ </compounddef>
+</doxygen>
diff --git a/testing/077_no_xml_namespace_members_in_file_scope.h b/testing/077_no_xml_namespace_members_in_file_scope.h
new file mode 100644
index 0000000..bf3dc64
--- /dev/null
+++ b/testing/077_no_xml_namespace_members_in_file_scope.h
@@ -0,0 +1,16 @@
+// objective: test that namespace members are not put to file docs by default
+// check: 077__no__xml__namespace__members__in__file__scope_8h.xml
+
+namespace Namespace {
+
+/**
+@brief A function
+
+Detailed documentation.
+*/
+void foo();
+
+/** @brief An enum */
+enum class Enum {};
+
+}
diff --git a/testing/078/078__xml__namespace__members__in__file__scope_8h.xml b/testing/078/078__xml__namespace__members__in__file__scope_8h.xml
new file mode 100644
index 0000000..e0a0343
--- /dev/null
+++ b/testing/078/078__xml__namespace__members__in__file__scope_8h.xml
@@ -0,0 +1,43 @@
+<?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="078__xml__namespace__members__in__file__scope_8h" kind="file" language="C++">
+ <compoundname>078_xml_namespace_members_in_file_scope.h</compoundname>
+ <innernamespace refid="namespace_namespace">Namespace</innernamespace>
+ <sectiondef kind="enum">
+ <memberdef kind="enum" id="078__xml__namespace__members__in__file__scope_8h_1add172b93283b1ab7612c3ca6cc5dcfea" prot="public" static="no" strong="yes">
+ <type/>
+ <name>Enum</name>
+ <briefdescription>
+ <para>An enum. </para>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <inbodydescription>
+ </inbodydescription>
+ <location file="078_xml_namespace_members_in_file_scope.h" line="15" column="1" bodyfile="078_xml_namespace_members_in_file_scope.h" bodystart="15" bodyend="15"/>
+ </memberdef>
+ </sectiondef>
+ <sectiondef kind="func">
+ <memberdef kind="function" id="078__xml__namespace__members__in__file__scope_8h_1a0f1fe1a972c7c4196988a1bdde63ec77" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
+ <type>void</type>
+ <definition>void Namespace::foo</definition>
+ <argsstring>()</argsstring>
+ <name>foo</name>
+ <briefdescription>
+ <para>A function. </para>
+ </briefdescription>
+ <detaileddescription>
+ <para>Detailed documentation. </para>
+ </detaileddescription>
+ <inbodydescription>
+ </inbodydescription>
+ <location file="078_xml_namespace_members_in_file_scope.h" line="12" column="1"/>
+ </memberdef>
+ </sectiondef>
+ <briefdescription>
+ </briefdescription>
+ <detaileddescription>
+ </detaileddescription>
+ <location file="078_xml_namespace_members_in_file_scope.h"/>
+ </compounddef>
+</doxygen>
diff --git a/testing/078_xml_namespace_members_in_file_scope.h b/testing/078_xml_namespace_members_in_file_scope.h
new file mode 100644
index 0000000..f456464
--- /dev/null
+++ b/testing/078_xml_namespace_members_in_file_scope.h
@@ -0,0 +1,17 @@
+// objective: test that namespace members are put to file docs when enabled
+// check: 078__xml__namespace__members__in__file__scope_8h.xml
+// config: XML_NS_MEMB_FILE_SCOPE = YES
+
+namespace Namespace {
+
+/**
+@brief A function
+
+Detailed documentation.
+*/
+void foo();
+
+/** @brief An enum */
+enum class Enum {};
+
+}