1 /******************************************************************************
6 * Copyright (C) 1997-2015 by Dimitri van Heesch.
8 * Permission to use, copy, modify, and distribute this software and its
9 * documentation under the terms of the GNU General Public License is hereby
10 * granted. No representations are made about the suitability of this software
11 * for any purpose. It is provided "as is" without express or implied warranty.
12 * See the GNU General Public License for more details.
14 * Documents produced by Doxygen are derivative works derived from the
15 * input used in their production; they are not affected by this license.
22 #include "ftextstream.h"
23 #include "definition.h"
25 /*! Create a list of items that are cross referenced with documentation blocks
26 * @param listName String representing the name of the list.
27 * @param pageTitle String representing the title of the list page.
28 * @param secTitle String representing the title of the section.
30 RefList::RefList(const char *listName,
31 const char *pageTitle,
39 m_listName = listName;
40 m_fileName = convertNameToFile(listName,FALSE,TRUE);
41 m_pageTitle = pageTitle;
42 m_secTitle = secTitle;
45 /*! Destroy the todo list. Currently not called! */
48 delete m_dictIterator;
53 /*! Adds a new item to the list.
54 * \returns A unique id for this item.
56 int RefList::addRefItem()
60 m_dict = new QIntDict<RefItem>(1009);
61 m_dict->setAutoDelete(TRUE);
62 m_dictIterator = new QIntDictIterator<RefItem>(*m_dict);
64 RefItem *item = new RefItem;
66 m_dict->insert(m_id,item);
70 /*! Returns an item given it's id that is obtained with addRefItem()
71 * \param itemId item's identifier.
72 * \returns A pointer to the todo item's structure.
74 RefItem *RefList::getRefItem(int itemId)
76 return m_dict ? m_dict->find(itemId) : 0;
79 /*! Returns the first item in the dictionary or 0 if
81 * Items are not sorted.
83 RefItem *RefList::getFirstRefItem()
85 return m_dictIterator ? m_dictIterator->toFirst() : 0;
88 /*! Returns the next item in the dictionary or 0 if
89 * we are at the end of the list.
90 * Items are not sorted.
92 RefItem *RefList::getNextRefItem()
94 return m_dictIterator ? m_dictIterator->operator++() : 0;
97 /*! Returns the name of the list as set in the constructor. */
98 QCString RefList::listName() const
103 QCString RefList::fileName() const
108 QCString RefList::pageTitle() const
113 QCString RefList::sectionTitle() const
118 void RefList::insertIntoList(const char *key,RefItem *item)
122 m_itemList = new SortedRefItems(1009);
124 RefItem *ri = m_itemList->find(key);
127 m_itemList->append(key,item);
129 else // item already added to the list (i.e. multiple item for the same
134 ri->extraItems.append(item);
140 void RefList::generatePage()
142 if (m_itemList==0) return;
144 SDict<RefItem>::Iterator it(*m_itemList);
147 doc += "<dl class=\"reflist\">";
148 for (it.toFirst();(item=it.current());++it)
152 doc += item->listAnchor;
156 if (item->scope->name() != "<globalScope>")
158 doc += "\\_setscope ";
159 doc += item->scope->name();
164 doc += " \\_internalref ";
169 // write declaration in case a function with arguments
170 if (!item->args.isEmpty())
176 QListIterator<RefItem> li(item->extraItems);
178 for (li.toFirst();(extraItem=li.current());++li)
180 doc += "<p>" + extraItem->text;
185 //printf("generatePage('%s')\n",doc.data());
186 addRelatedPage(m_listName,m_pageTitle,doc,0,m_fileName,1,0,0,0);