Orb/Doxygen/src/reflist.h
changeset 3 d8fccb2cd802
parent 0 42188c7ea2d9
child 4 468f4c8d3d5b
equal deleted inserted replaced
2:932c358ece3e 3:d8fccb2cd802
       
     1 /******************************************************************************
       
     2  *
       
     3  * 
       
     4  *
       
     5  *
       
     6  * Copyright (C) 1997-2008 by Dimitri van Heesch.
       
     7  *
       
     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.
       
    13  *
       
    14  * Documents produced by Doxygen are derivative works derived from the
       
    15  * input used in their production; they are not affected by this license.
       
    16  *
       
    17  */
       
    18 
       
    19 #ifndef _REFLIST_H
       
    20 #define _REFLIST_H
       
    21 
       
    22 #include "qtbc.h"
       
    23 #include <qintdict.h>
       
    24 #include <qlist.h>
       
    25 #include "sortdict.h"
       
    26 
       
    27 /*! This struct represents an item in the list of references. */
       
    28 struct RefItem
       
    29 {
       
    30   RefItem() /*: written(FALSE)*/ {}
       
    31   QCString text;           //!< text of the item.
       
    32   QCString listAnchor;     //!< anchor in the list
       
    33 
       
    34   QCString prefix;         //!< type prefix for the name
       
    35   QCString name;           //!< name of the entity containing the reference
       
    36   QCString title;          //!< display name of the entity
       
    37   QCString args;           //!< optional arguments for the entity (if function)
       
    38   //bool written;
       
    39   QList<RefItem> extraItems; //!< more items belonging to the same entity
       
    40 };
       
    41 
       
    42 /*! List of items sorted by title */
       
    43 class SortedRefItems : public SDict<RefItem>
       
    44 {
       
    45   public:
       
    46     SortedRefItems(int size=17) : SDict<RefItem>(size) {}
       
    47     virtual ~SortedRefItems() {}
       
    48     int compareItems(GCI item1,GCI item2)
       
    49     {
       
    50       RefItem *r1 = (RefItem*)item1;
       
    51       RefItem *r2 = (RefItem*)item2;
       
    52       return stricmp(r1->title,r2->title);
       
    53     }
       
    54 };
       
    55 
       
    56 /*! @brief List of cross-referenced items 
       
    57  * 
       
    58  *  This class represents a list of items that are put
       
    59  *  at a certain point in the documentation by some special command 
       
    60  *  and are collected in a list. The items cross-reference the 
       
    61  *  documentation and the list.
       
    62  *
       
    63  *  Examples are the todo list, the test list and the bug list,
       
    64  *  introduced by the \\todo, \\test, and \\bug commands respectively.
       
    65  */
       
    66 class RefList
       
    67 {
       
    68   public:
       
    69     int      addRefItem();
       
    70     RefItem *getRefItem(int todoItemId);
       
    71     RefItem *getFirstRefItem();
       
    72     RefItem *getNextRefItem();
       
    73     QCString listName() const;
       
    74     QCString pageTitle() const;
       
    75     QCString sectionTitle() const;
       
    76 
       
    77     RefList(const char *listName,
       
    78             const char *pageTitle,const char *secTitle
       
    79            );
       
    80    ~RefList();
       
    81     void insertIntoList(const char *key,RefItem *item);
       
    82     void generatePage();
       
    83 
       
    84   private:
       
    85     int m_id;
       
    86     QCString m_listName;
       
    87     QCString m_pageTitle;
       
    88     QCString m_secTitle;
       
    89     SortedRefItems *m_itemList;
       
    90     QIntDict<RefItem> *m_dict;
       
    91     QIntDictIterator<RefItem> *m_dictIterator;
       
    92 };
       
    93 
       
    94 #endif