From 3901935a5366fa292aa1d3880593b6fb13008b14 Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Tue, 14 Apr 2020 20:58:12 +0200 Subject: issue #7702: test list is always created --- src/docparser.cpp | 10 +--------- src/reflist.cpp | 12 ++++++++++++ src/reflist.h | 16 +++++++++------- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/docparser.cpp b/src/docparser.cpp index 029dc3f..00f287c 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -2179,15 +2179,7 @@ DocXRefItem::DocXRefItem(DocNode *parent,int id,const char *key) : bool DocXRefItem::parse() { RefList *refList = RefListManager::instance().find(m_key); - if (refList && - ( - // either not a built-in list or the list is enabled - (m_key!="todo" || Config_getBool(GENERATE_TODOLIST)) && - (m_key!="test" || Config_getBool(GENERATE_TESTLIST)) && - (m_key!="bug" || Config_getBool(GENERATE_BUGLIST)) && - (m_key!="deprecated" || Config_getBool(GENERATE_DEPRECATEDLIST)) - ) - ) + if (refList && refList->isEnabled()) { RefItem *item = refList->find(m_id); ASSERT(item!=0); diff --git a/src/reflist.cpp b/src/reflist.cpp index 55e9708..26d20ae 100644 --- a/src/reflist.cpp +++ b/src/reflist.cpp @@ -20,9 +20,21 @@ #include "ftextstream.h" #include "definition.h" #include "sortdict.h" +#include "config.h" + +bool RefList::isEnabled() const +{ + if (m_listName=="todo" && !Config_getBool(GENERATE_TODOLIST)) return false; + else if (m_listName=="test" && !Config_getBool(GENERATE_TESTLIST)) return false; + else if (m_listName=="bug" && !Config_getBool(GENERATE_BUGLIST)) return false; + else if (m_listName=="deprecated" && !Config_getBool(GENERATE_DEPRECATEDLIST)) return false; + return true; +} void RefList::generatePage() { + if (!isEnabled()) return; + std::sort(m_entries.begin(),m_entries.end(), [](std::unique_ptr &left,std::unique_ptr &right) { return qstricmp(left->title(),left->title()); }); diff --git a/src/reflist.h b/src/reflist.h index 49c3036..19636f1 100644 --- a/src/reflist.h +++ b/src/reflist.h @@ -3,8 +3,8 @@ * Copyright (C) 1997-2020 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * @@ -67,11 +67,11 @@ class RefItem const Definition *m_scope = 0; //!< scope to use for references. }; -/** List of cross-referenced items - * +/** List of cross-referenced items + * * This class represents a list of items that are put - * at a certain point in the documentation by some special command - * and are collected in a list. The items cross-reference the + * at a certain point in the documentation by some special command + * and are collected in a list. The items cross-reference the * documentation and the list. * * Examples are the todo list, the test list and the bug list, @@ -89,6 +89,8 @@ class RefList m_listName(listName), m_fileName(convertNameToFile(listName,FALSE,TRUE)), m_pageTitle(pageTitle), m_secTitle(secTitle) {} + bool isEnabled() const; + /*! Adds a new item to the list. * @returns A unique id for this item. */ @@ -111,7 +113,7 @@ class RefList auto it = m_lookup.find(itemId); return it!=m_lookup.end() ? it->second : nullptr; } - + QCString listName() const { return m_listName; } QCString fileName() const { return m_fileName; } QCString pageTitle() const { return m_pageTitle; } -- cgit v0.12