diff options
-rw-r--r-- | .editorconfig | 5 | ||||
-rw-r--r-- | src/context.cpp | 2 | ||||
-rw-r--r-- | src/definition.cpp | 6 | ||||
-rw-r--r-- | src/docbookgen.cpp | 2 | ||||
-rw-r--r-- | src/docparser.cpp | 2 | ||||
-rw-r--r-- | src/ftvhelp.cpp | 2 | ||||
-rw-r--r-- | src/groupdef.cpp | 2 | ||||
-rw-r--r-- | src/pagedef.cpp | 8 | ||||
-rw-r--r-- | src/pagedef.h | 4 | ||||
-rw-r--r-- | src/rtfgen.cpp | 2 | ||||
-rw-r--r-- | src/searchindex.cpp | 2 | ||||
-rw-r--r-- | src/sqlite3gen.cpp | 2 | ||||
-rw-r--r-- | src/util.cpp | 7 | ||||
-rw-r--r-- | src/xmlgen.cpp | 8 | ||||
-rw-r--r-- | testing/074/namespacens.xml | 81 | ||||
-rw-r--r-- | testing/074/struct_foo.xml | 22 | ||||
-rw-r--r-- | testing/074_ref.cpp | 25 | ||||
-rw-r--r-- | testing/079/empty.xml | 12 | ||||
-rw-r--r-- | testing/079/levels.xml | 41 | ||||
-rw-r--r-- | testing/079_tableofcontents.dox | 26 | ||||
-rwxr-xr-x[-rw-r--r--] | testing/runtests.py | 0 |
21 files changed, 228 insertions, 33 deletions
diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..ddc5adf --- /dev/null +++ b/.editorconfig @@ -0,0 +1,5 @@ +# See https://editorconfig.org/ for more information. + +[*] +indent_style = space +indent_size = 2 diff --git a/src/context.cpp b/src/context.cpp index 6b5d2ac..8a3a784 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -7807,7 +7807,7 @@ class NavPathElemContext::Private { text = ((const GroupDef*)m_def)->groupTitle(); } - else if (type==Definition::TypePage && !(((const PageDef*)m_def)->title().isEmpty())) + else if (type==Definition::TypePage && (((const PageDef*)m_def)->hasTitle())) { text = ((const PageDef*)m_def)->title(); } diff --git a/src/definition.cpp b/src/definition.cpp index fbf5be8..62a4e69 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -1694,7 +1694,7 @@ QCString Definition::pathFragment() const { result+=((const GroupDef*)this)->groupTitle(); } - else if (definitionType()==Definition::TypePage && !((const PageDef*)this)->title().isEmpty()) + else if (definitionType()==Definition::TypePage && ((const PageDef*)this)->hasTitle()) { result+=((const PageDef*)this)->title(); } @@ -1737,10 +1737,10 @@ QCString Definition::navigationPathAsString() const result+="<a class=\"el\" href=\"$relpath^"+getOutputFileBase()+Doxygen::htmlFileExtension+"\">"+ convertToHtml(((const GroupDef*)this)->groupTitle())+"</a>"; } - else if (definitionType()==Definition::TypePage && !((const PageDef*)this)->title().isEmpty()) + else if (definitionType()==Definition::TypePage && ((const PageDef*)this)->hasTitle()) { result+="<a class=\"el\" href=\"$relpath^"+getOutputFileBase()+Doxygen::htmlFileExtension+"\">"+ - convertToHtml(((const PageDef*)this)->title())+"</a>"; + convertToHtml(((const PageDef*)this)->title())+"</a>"; } else if (definitionType()==Definition::TypeClass) { diff --git a/src/docbookgen.cpp b/src/docbookgen.cpp index 97c602d..011ef12 100644 --- a/src/docbookgen.cpp +++ b/src/docbookgen.cpp @@ -635,7 +635,7 @@ DB_GEN_C if (!pd->getGroupDef() && !pd->isReference() && pd->name() == stripPath(name)) { t << "<chapter>\n"; - if (!pd->title().isEmpty()) + if (pd->hasTitle()) { t << " <title>" << convertToDocBook(pd->title()) << "</title>" << endl; } diff --git a/src/docparser.cpp b/src/docparser.cpp index a5c0cc7..082ba75 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -7586,7 +7586,7 @@ DocRoot *validatingParseDoc(const char *fileName,int startLine, case Definition::TypePage: { PageDef *pd = (PageDef *)ctx; - if (!pd->title().isEmpty()) + if (pd->hasTitle()) { name = theTranslator->trPage(TRUE,TRUE)+" "+pd->title(); } diff --git a/src/ftvhelp.cpp b/src/ftvhelp.cpp index ea57eb7..97bcdcc 100644 --- a/src/ftvhelp.cpp +++ b/src/ftvhelp.cpp @@ -657,7 +657,7 @@ static void generateJSNavTree(const QList<FTVNode> &nodeList) QCString &projName = Config_getString(PROJECT_NAME); if (projName.isEmpty()) { - if (Doxygen::mainPage && !Doxygen::mainPage->title().isEmpty()) // Use title of main page as root + if (mainPageHasTitle()) // Use title of main page as root { t << "\"" << convertToJSString(Doxygen::mainPage->title()) << "\", "; } diff --git a/src/groupdef.cpp b/src/groupdef.cpp index e543d16..397b254 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -963,7 +963,7 @@ void GroupDef::writePageDocumentation(OutputList &ol) if (!pd->isReference()) { SectionInfo *si=0; - if (!pd->title().isEmpty() && !pd->name().isEmpty() && + if (pd->hasTitle() && !pd->name().isEmpty() && (si=Doxygen::sectionDict->find(pd->name()))!=0) { ol.startSection(si->label,si->title,SectionInfo::Subsection); diff --git a/src/pagedef.cpp b/src/pagedef.cpp index 79a78d3..93d5817 100644 --- a/src/pagedef.cpp +++ b/src/pagedef.cpp @@ -190,7 +190,7 @@ void PageDef::writeDocumentation(OutputList &ol) ol.disable(OutputGenerator::Docbook); ol.disable(OutputGenerator::RTF); ol.disable(OutputGenerator::Man); - if (!title().isEmpty() && !name().isEmpty() && si!=0) + if (hasTitle() && !name().isEmpty() && si!=0) { ol.startPageDoc(si->title); //ol.startSection(si->label,si->title,si->type); @@ -342,3 +342,9 @@ bool PageDef::showLineNo() const { return m_showLineNo; } + +bool PageDef::hasTitle() const +{ + return !m_title.isEmpty() && m_title.lower()!="notitle"; +} + diff --git a/src/pagedef.h b/src/pagedef.h index a0c3acb..e958617 100644 --- a/src/pagedef.h +++ b/src/pagedef.h @@ -60,10 +60,12 @@ class PageDef : public Definition bool documentedPage() const; bool hasSubPages() const; bool hasParentPage() const; + bool hasTitle() const; LocalToc localToc() const { return m_localToc; } void setPageScope(Definition *d){ m_pageScope = d; } Definition *getPageScope() const { return m_pageScope; } - QCString displayName(bool=TRUE) const { return !m_title.isEmpty() ? m_title : Definition::name(); } + QCString displayName(bool=TRUE) const + { return hasTitle() ? m_title : Definition::name(); } bool showLineNo() const; void writeDocumentation(OutputList &ol); diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp index 2e67c26..b42780f 100644 --- a/src/rtfgen.cpp +++ b/src/rtfgen.cpp @@ -665,7 +665,7 @@ void RTFGenerator::endIndexSection(IndexSections is) break; case isMainPage: t << "\\par " << rtf_Style_Reset << endl; - if (!Doxygen::mainPage || Doxygen::mainPage->title().isEmpty()) + if (!mainPageHasTitle()) { t << "{\\tc \\v " << theTranslator->trMainPage() << "}"<< endl; } diff --git a/src/searchindex.cpp b/src/searchindex.cpp index 5859d67..52378cd 100644 --- a/src/searchindex.cpp +++ b/src/searchindex.cpp @@ -117,7 +117,7 @@ void SearchIndex::setCurrentDoc(Definition *ctx,const char *anchor,bool isSource case Definition::TypePage: { PageDef *pd = (PageDef *)ctx; - if (!pd->title().isEmpty()) + if (pd->hasTitle()) { name = theTranslator->trPage(TRUE,TRUE)+" "+pd->title(); } diff --git a/src/sqlite3gen.cpp b/src/sqlite3gen.cpp index a7b8dbb..eceea06 100644 --- a/src/sqlite3gen.cpp +++ b/src/sqlite3gen.cpp @@ -2478,7 +2478,7 @@ static void generateSqlite3ForPage(const PageDef *pd,bool isExample) QCString title; if (pd==Doxygen::mainPage) // main page is special { - if (!pd->title().isEmpty() && pd->title().lower()!="notitle") + if (mainPageHasTitle()) { title = filterTitle(convertCharEntitiesToUTF8(Doxygen::mainPage->title())); } diff --git a/src/util.cpp b/src/util.cpp index 08c13fb..24e8898 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -6674,7 +6674,7 @@ PageDef *addRelatedPage(const char *name,const QCString &ptitle, if (gd) gd->addPage(pd); - if (!pd->title().isEmpty()) + if (pd->hasTitle()) { //outputList->writeTitle(pi->name,pi->title); @@ -8919,10 +8919,7 @@ void convertProtectionLevel( bool mainPageHasTitle() { - if (Doxygen::mainPage==0) return FALSE; - if (Doxygen::mainPage->title().isEmpty()) return FALSE; - if (Doxygen::mainPage->title().lower()=="notitle") return FALSE; - return TRUE; + return Doxygen::mainPage!=0 && Doxygen::mainPage->hasTitle(); } QCString getDotImageExtension(void) diff --git a/src/xmlgen.cpp b/src/xmlgen.cpp index bacf4d4..8b8e648 100644 --- a/src/xmlgen.cpp +++ b/src/xmlgen.cpp @@ -1797,11 +1797,11 @@ static void generateXMLForPage(PageDef *pd,FTextStream &ti,bool isExample) if (pd==Doxygen::mainPage) // main page is special { QCString title; - if (!pd->title().isEmpty() && pd->title().lower()!="notitle") + if (mainPageHasTitle()) { title = filterTitle(convertCharEntitiesToUTF8(Doxygen::mainPage->title())); } - else + else { title = Config_getString(PROJECT_NAME); } @@ -1818,10 +1818,10 @@ static void generateXMLForPage(PageDef *pd,FTextStream &ti,bool isExample) } } writeInnerPages(pd->getSubPages(),t); - if (pd->localToc().isXmlEnabled()) + SectionDict *sectionDict = pd->getSectionDict(); + if (pd->localToc().isXmlEnabled() && sectionDict) { t << " <tableofcontents>" << endl; - SectionDict *sectionDict = pd->getSectionDict(); SDict<SectionInfo>::Iterator li(*sectionDict); SectionInfo *si; int level=1,l; diff --git a/testing/074/namespacens.xml b/testing/074/namespacens.xml new file mode 100644 index 0000000..495e550 --- /dev/null +++ b/testing/074/namespacens.xml @@ -0,0 +1,81 @@ +<?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="namespacens" kind="namespace" language="C++"> + <compoundname>ns</compoundname> + <sectiondef kind="func"> + <memberdef kind="function" id="namespacens_1afd2e8a8437eff630f52a452ea6dc6e82" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> + <type>int</type> + <definition>int ns::operator""_op</definition> + <argsstring>(unsigned long long)</argsstring> + <name>operator""_op</name> + <param> + <type>unsigned long long</type> + </param> + <briefdescription> + <para>An operator. </para> + </briefdescription> + <detaileddescription> + </detaileddescription> + <inbodydescription> + </inbodydescription> + <location file="074_ref.cpp" line="66" column="1"/> + </memberdef> + <memberdef kind="function" id="namespacens_1a47f70e51e66b81b8383a4e2da66f1e09" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> + <type>int</type> + <definition>int ns::operator""_oq</definition> + <argsstring>(unsigned long long)</argsstring> + <name>operator""_oq</name> + <param> + <type>unsigned long long</type> + </param> + <briefdescription> + <para>Another operator. </para> + </briefdescription> + <detaileddescription> + </detaileddescription> + <inbodydescription> + </inbodydescription> + <location file="074_ref.cpp" line="69" column="1"/> + </memberdef> + <memberdef kind="function" id="namespacens_1aaa9eb8a7b40d4ed0edbe5e163b4e6e8d" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> + <type>void</type> + <definition>void ns::foo</definition> + <argsstring>(std::initializer_list< int * >)</argsstring> + <name>foo</name> + <param> + <type>std::initializer_list< int * ></type> + </param> + <briefdescription> + <para>Function. </para> + </briefdescription> + <detaileddescription> + </detaileddescription> + <inbodydescription> + </inbodydescription> + <location file="074_ref.cpp" line="72" column="1"/> + </memberdef> + </sectiondef> + <briefdescription> +<para>A namespace. </para> + </briefdescription> + <detaileddescription> + <para> + <itemizedlist> + <listitem> + <para>Link to an UDL w/o spaces: <ref refid="namespacens_1afd2e8a8437eff630f52a452ea6dc6e82" kindref="member">operator""_op</ref></para> + </listitem> + <listitem> + <para>Link to an UDL with spaces: <ref refid="namespacens_1a47f70e51e66b81b8383a4e2da66f1e09" kindref="member">operator""_oq</ref></para> + </listitem> + <listitem> + <para>Link to a function with spaces: <ref refid="namespacens_1aaa9eb8a7b40d4ed0edbe5e163b4e6e8d" kindref="member">foo(std::initializer_list< int* >)</ref></para> + </listitem> + <listitem> + <para>Link to a function w/o spaces: <ref refid="namespacens_1aaa9eb8a7b40d4ed0edbe5e163b4e6e8d" kindref="member">foo(std::initializer_list<int*>)</ref> </para> + </listitem> + </itemizedlist> + </para> + </detaileddescription> + <location file="074_ref.cpp" line="63" column="1"/> + </compounddef> +</doxygen> diff --git a/testing/074/struct_foo.xml b/testing/074/struct_foo.xml index 56a497a..c49fbaa 100644 --- a/testing/074/struct_foo.xml +++ b/testing/074/struct_foo.xml @@ -15,7 +15,7 @@ </detaileddescription> <inbodydescription> </inbodydescription> - <location file="074_ref.cpp" line="16" column="1"/> + <location file="074_ref.cpp" line="20" column="1"/> </memberdef> <memberdef kind="function" id="struct_foo_1a279debd94d894223fa8468933e2d6188" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type><ref refid="struct_foo" kindref="compound">Foo</ref> &</type> @@ -33,7 +33,7 @@ </detaileddescription> <inbodydescription> </inbodydescription> - <location file="074_ref.cpp" line="27" column="1"/> + <location file="074_ref.cpp" line="31" column="1"/> </memberdef> <memberdef kind="function" id="struct_foo_1a48bcc3de9b2f1ad09a3518a0c9f0da61" prot="public" static="no" const="yes" explicit="no" inline="no" virt="non-virtual"> <type>const <ref refid="struct_foo" kindref="compound">Foo</ref> &</type> @@ -51,7 +51,7 @@ </detaileddescription> <inbodydescription> </inbodydescription> - <location file="074_ref.cpp" line="30" column="1"/> + <location file="074_ref.cpp" line="34" column="1"/> </memberdef> <memberdef kind="function" id="struct_foo_1a3a41dcf8c53f777d50676ea28400a640" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type>int</type> @@ -69,7 +69,7 @@ </detaileddescription> <inbodydescription> </inbodydescription> - <location file="074_ref.cpp" line="33" column="1"/> + <location file="074_ref.cpp" line="37" column="1"/> </memberdef> <memberdef kind="function" id="struct_foo_1ae3c9c1f33cdb8b932c6eb104660a262b" prot="public" static="no" const="yes" explicit="no" inline="no" virt="non-virtual"> <type>int</type> @@ -87,7 +87,7 @@ </detaileddescription> <inbodydescription> </inbodydescription> - <location file="074_ref.cpp" line="36" column="1"/> + <location file="074_ref.cpp" line="40" column="1"/> </memberdef> <memberdef kind="function" id="struct_foo_1aa20bd44b1bb87a652ac65170ddfa1a5a" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type><ref refid="struct_foo" kindref="compound">Foo</ref> &</type> @@ -105,7 +105,7 @@ </detaileddescription> <inbodydescription> </inbodydescription> - <location file="074_ref.cpp" line="39" column="1"/> + <location file="074_ref.cpp" line="43" column="1"/> </memberdef> <memberdef kind="function" id="struct_foo_1aa20bd44b1bb87a652ac65170ddfa1a5a" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type><ref refid="struct_foo" kindref="compound">Foo</ref> &</type> @@ -123,7 +123,7 @@ </detaileddescription> <inbodydescription> </inbodydescription> - <location file="074_ref.cpp" line="42" column="1"/> + <location file="074_ref.cpp" line="46" column="1"/> </memberdef> <memberdef kind="function" id="struct_foo_1a0514e1f5b30cbf77e1c39d7aba308656" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual"> <type>int *</type> @@ -141,7 +141,7 @@ </detaileddescription> <inbodydescription> </inbodydescription> - <location file="074_ref.cpp" line="45" column="1"/> + <location file="074_ref.cpp" line="49" column="1"/> </memberdef> <memberdef kind="function" id="struct_foo_1a978acd73e910ce56cc169ebec8736669" prot="public" static="no" const="yes" explicit="no" inline="no" virt="non-virtual"> <type> @@ -157,7 +157,7 @@ </detaileddescription> <inbodydescription> </inbodydescription> - <location file="074_ref.cpp" line="48" column="1"/> + <location file="074_ref.cpp" line="52" column="1"/> </memberdef> </sectiondef> <sectiondef kind="public-static-func"> @@ -206,7 +206,7 @@ </detaileddescription> <inbodydescription> </inbodydescription> - <location file="074_ref.cpp" line="24" column="1"/> + <location file="074_ref.cpp" line="28" column="1"/> </memberdef> </sectiondef> <briefdescription> @@ -240,7 +240,7 @@ </simplesect> </para> </detaileddescription> - <location file="074_ref.cpp" line="14" column="1" bodyfile="074_ref.cpp" bodystart="14" bodyend="49"/> + <location file="074_ref.cpp" line="18" column="1" bodyfile="074_ref.cpp" bodystart="18" bodyend="53"/> <listofallmembers> <member refid="struct_foo_1a5c036d1b3561a0e1beffe8c6799a4276" prot="public" virt="non-virtual"> <scope>Foo</scope> diff --git a/testing/074_ref.cpp b/testing/074_ref.cpp index 141e2b4..d283907 100644 --- a/testing/074_ref.cpp +++ b/testing/074_ref.cpp @@ -1,5 +1,9 @@ // objective: test \ref command in combination with const // check: struct_foo.xml +// check: namespacens.xml + +#include <initializer_list> + /** @brief Foo class. * * @see @ref Foo::Foo() constructor for details. @@ -47,3 +51,24 @@ struct Foo { /** @brief Fun with itself */ Foo fun() const; }; + +/** +@brief A namespace + +- Link to an UDL w/o spaces: @link operator""_op @endlink +- Link to an UDL with spaces: @link operator""_oq @endlink +- Link to a function with spaces: @ref foo(std::initializer_list< int* >) +- Link to a function w/o spaces: @ref foo(std::initializer_list<int*>) +*/ +namespace ns { + +/** @brief An operator */ +int operator""_op(unsigned long long); + +/** @brief Another operator */ +int operator "" _oq(unsigned long long); + +/** @brief Function */ +void foo(std::initializer_list<int*>); + +} diff --git a/testing/079/empty.xml b/testing/079/empty.xml new file mode 100644 index 0000000..3e1d691 --- /dev/null +++ b/testing/079/empty.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="empty" kind="page"> + <compoundname>empty</compoundname> + <title>An empty page</title> + <briefdescription> + </briefdescription> + <detaileddescription> +<para>With an empty TOC. </para> + </detaileddescription> + </compounddef> +</doxygen> diff --git a/testing/079/levels.xml b/testing/079/levels.xml new file mode 100644 index 0000000..bbb4232 --- /dev/null +++ b/testing/079/levels.xml @@ -0,0 +1,41 @@ +<?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="levels" kind="page"> + <compoundname>levels</compoundname> + <title>A page with two-level TOC</title> + <tableofcontents> + <tocsect> + <name>A section that's in TOC</name> + <reference>levels_1first</reference> + <tableofcontents> + <tocsect> + <name>A subsection that's in TOC</name> + <reference>levels_1first2</reference> + </tocsect> + </tableofcontents> + </tocsect> + <tocsect> + <name>A section that's in TOC again</name> + <reference>levels_1second</reference> + </tocsect> + </tableofcontents> + <briefdescription> + </briefdescription> + <detaileddescription> + <sect1 id="levels_1first"> + <title>A section that's in TOC</title> + <sect2 id="levels_1first2"> + <title>A subsection that's in TOC</title> + <sect3 id="levels_1first3"> + <title>A subsubsection that's not in TOC</title> + <para>Nay!</para> + </sect3> + </sect2> + </sect1> + <sect1 id="levels_1second"> + <title>A section that's in TOC again</title> + <para>Yay! </para> + </sect1> + </detaileddescription> + </compounddef> +</doxygen> diff --git a/testing/079_tableofcontents.dox b/testing/079_tableofcontents.dox new file mode 100644 index 0000000..7512463 --- /dev/null +++ b/testing/079_tableofcontents.dox @@ -0,0 +1,26 @@ +// objective: test TOC generation for an empty page +// check: empty.xml +// check: levels.xml +/** +@page empty An empty page + +@tableofcontents + +With an empty TOC. +*/ + +/** +@page levels A page with two-level TOC + +@tableofcontents{xml:2} + +@section first A section that's in TOC +@subsection first2 A subsection that's in TOC +@subsubsection first3 A subsubsection that's not in TOC + +Nay! + +@section second A section that's in TOC again + +Yay! +*/ diff --git a/testing/runtests.py b/testing/runtests.py index 452c36e..452c36e 100644..100755 --- a/testing/runtests.py +++ b/testing/runtests.py |