1 /******************************************************************************
3 * $Id: reflist.cpp,v 1.2 2001/03/19 19:27:41 root Exp $
6 * Copyright (C) 1997-2012 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"
24 /*! Create a list of items that are cross referenced with documentation blocks
25 * @param listName String representing the name of the list.
26 * @param pageTitle String representing the title of the list page.
27 * @param secTitle String representing the title of the section.
29 RefList::RefList(const char *listName,
30 const char *pageTitle,
38 m_listName = listName;
39 m_pageTitle = pageTitle;
40 m_secTitle = secTitle;
43 /*! Destroy the todo list. Currently not called! */
46 delete m_dictIterator;
51 /*! Adds a new item to the list.
52 * \returns A unique id for this item.
54 int RefList::addRefItem()
58 m_dict = new QIntDict<RefItem>(1009);
59 m_dict->setAutoDelete(TRUE);
60 m_dictIterator = new QIntDictIterator<RefItem>(*m_dict);
62 RefItem *item = new RefItem;
64 m_dict->insert(m_id,item);
68 /*! Returns an item given it's id that is obtained with addRefItem()
69 * \param itemId item's identifier.
70 * \returns A pointer to the todo item's structure.
72 RefItem *RefList::getRefItem(int itemId)
74 return m_dict ? m_dict->find(itemId) : 0;
77 /*! Returns the first item in the dictionary or 0 if
79 * Items are not sorted.
81 RefItem *RefList::getFirstRefItem()
83 return m_dictIterator ? m_dictIterator->toFirst() : 0;
86 /*! Returns the next item in the dictionary or 0 if
87 * we are at the end of the list.
88 * Items are not sorted.
90 RefItem *RefList::getNextRefItem()
92 return m_dictIterator ? m_dictIterator->operator++() : 0;
95 /*! Returns the name of the list as set in the constructor. */
96 QCString RefList::listName() const
101 QCString RefList::pageTitle() const
106 QCString RefList::sectionTitle() const
111 void RefList::insertIntoList(const char *key,RefItem *item)
115 m_itemList = new SortedRefItems(1009);
117 RefItem *ri = m_itemList->find(key);
120 m_itemList->append(key,item);
122 else // item already added to the list (i.e. multiple item for the same
127 ri->extraItems.append(item);
133 void RefList::generatePage()
135 if (m_itemList==0) return;
137 SDict<RefItem>::Iterator it(*m_itemList);
140 doc += "<dl class=\"reflist\">";
141 for (it.toFirst();(item=it.current());++it)
145 doc += item->listAnchor;
148 doc += " \\_internalref ";
153 // write declaration in case a function with arguments
154 if (!item->args.isEmpty())
160 QListIterator<RefItem> li(item->extraItems);
162 for (li.toFirst();(extraItem=li.current());++li)
164 doc += "<p>" + extraItem->text;
169 addRelatedPage(m_listName,m_pageTitle,doc,0,m_listName,1,0,0,0);