namespacedef.h 4.63 KB
Newer Older
Dimitri van Heesch's avatar
Dimitri van Heesch committed
1 2
/******************************************************************************
 *
3
 * 
Dimitri van Heesch's avatar
Dimitri van Heesch committed
4
 *
5
 * Copyright (C) 1997-2007 by Dimitri van Heesch.
Dimitri van Heesch's avatar
Dimitri van Heesch committed
6 7 8 9 10 11 12
 *
 * 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 
 * for any purpose. It is provided "as is" without express or implied warranty.
 * See the GNU General Public License for more details.
 *
Dimitri van Heesch's avatar
Dimitri van Heesch committed
13 14
 * Documents produced by Doxygen are derivative works derived from the
 * input used in their production; they are not affected by this license.
Dimitri van Heesch's avatar
Dimitri van Heesch committed
15 16 17 18 19 20
 *
 */

#ifndef NAMESPACEDEF_H
#define NAMESPACEDEF_H

21
#include "qtbc.h"
Dimitri van Heesch's avatar
Dimitri van Heesch committed
22 23
#include <qstrlist.h>
#include <qdict.h>
Dimitri van Heesch's avatar
Dimitri van Heesch committed
24
#include "sortdict.h"
Dimitri van Heesch's avatar
Dimitri van Heesch committed
25
#include "definition.h"
Dimitri van Heesch's avatar
Dimitri van Heesch committed
26
#include "memberlist.h"
Dimitri van Heesch's avatar
Dimitri van Heesch committed
27 28 29

class ClassDef;
class ClassList;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
30 31
class OutputList;
class ClassSDict;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
32
class MemberDef;
33
class NamespaceList;
34
class MemberGroupSDict;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
35
class NamespaceSDict;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
36 37 38 39

class NamespaceDef : public Definition
{
  public:
40
    NamespaceDef(const char *defFileName,int defLine,
Dimitri van Heesch's avatar
Dimitri van Heesch committed
41 42
                 const char *name,const char *ref=0,
                 const char *refFile=0);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
43
   ~NamespaceDef();
44
    DefType definitionType() const { return TypeNamespace; }
45
    QCString getOutputFileBase() const;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
46
    void insertUsedFile(const char *fname);
47 48
    
    void writeDetailedDocumentation(OutputList &ol);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
49
    void writeDocumentation(OutputList &ol);
50 51 52
    void writeMemberDocumentation(OutputList &ol);
    void writeMemberPages(OutputList &ol);
    void writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
53

Dimitri van Heesch's avatar
Dimitri van Heesch committed
54
    void insertClass(ClassDef *cd);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
55
    void insertNamespace(NamespaceDef *nd);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
56
    void insertMember(MemberDef *md);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
57

Dimitri van Heesch's avatar
Dimitri van Heesch committed
58
    void computeAnchors();
59
    int countMembers();
60
    void addUsingDirective(NamespaceDef *nd);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
61
    NamespaceSDict *getUsedNamespaces() const;
62 63
    void addUsingDeclaration(Definition *def);
    SDict<Definition> *getUsedClasses() const { return usingDeclList; }
64
    void combineUsingRelations();
65
    QCString displayName() const;
66
    
67 68
    bool isLinkableInProject() const;
    bool isLinkable() const;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
69
    void addMembersToMemberGroup();
70
    void distributeMemberGroupDocumentation();
71
    void findSectionsInDocumentation();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
72 73 74

    virtual Definition *findInnerCompound(const char *name);
    void addInnerCompound(Definition *d);
75
    void addListReferences();
Dimitri van Heesch's avatar
Dimitri van Heesch committed
76
    
77 78
    MemberList *getMemberList(MemberList::ListType lt) const;
    const QList<MemberList> &getMemberLists() const { return m_memberLists; }
Dimitri van Heesch's avatar
Dimitri van Heesch committed
79

80 81
    /*! Returns the user defined member groups */
    MemberGroupSDict *getMemberGroupSDict() const { return memberGroupSDict; }
82

83 84
    /*! Returns the classes contained in this namespace */
    ClassSDict *getClassSDict() const { return classSDict; }
85

86 87
    /*! Returns the namespaces contained in this namespace */
    NamespaceSDict *getNamespaceSDict() const { return namespaceSDict; }
88

89
    bool visited;
90

91 92 93 94 95 96 97 98 99 100 101 102 103
  private:
    MemberList *createMemberList(MemberList::ListType lt);
    void addMemberToList(MemberList::ListType lt,MemberDef *md);
    void writeMemberDeclarations(OutputList &ol,MemberList::ListType lt,const QCString &title);
    void writeMemberDocumentation(OutputList &ol,MemberList::ListType lt,const QCString &title);

    QCString              fileName;
    QStrList              files;

    NamespaceSDict       *usingDirList;
    SDict<Definition>    *usingDeclList;
    SDict<Definition>    *m_innerCompounds;

104
    //MemberList           *allMemberList;
105 106 107 108
    QList<MemberList>     m_memberLists;
    MemberGroupSDict     *memberGroupSDict;
    ClassSDict           *classSDict;
    NamespaceSDict       *namespaceSDict;
109
    bool                  m_subGrouping;
Dimitri van Heesch's avatar
Dimitri van Heesch committed
110 111 112 113 114
};

class NamespaceList : public QList<NamespaceDef>
{ 
  public:
115
   ~NamespaceList() {}
Dimitri van Heesch's avatar
Dimitri van Heesch committed
116 117
    int compareItems(GCI item1,GCI item2)
    {
Dimitri van Heesch's avatar
Dimitri van Heesch committed
118
      return stricmp(((NamespaceDef *)item1)->name(),
Dimitri van Heesch's avatar
Dimitri van Heesch committed
119 120 121 122 123 124 125 126 127 128 129 130
                    ((NamespaceDef *)item2)->name()
                   );
    }
};

class NamespaceListIterator : public QListIterator<NamespaceDef>
{
  public:
    NamespaceListIterator(const NamespaceList &l) : 
      QListIterator<NamespaceDef>(l) {}
};

131 132 133 134
class NamespaceDict : public QDict<NamespaceDef>
{
  public:
    NamespaceDict(int size) : QDict<NamespaceDef>(size) {}
135
   ~NamespaceDict() {}
136
};
Dimitri van Heesch's avatar
Dimitri van Heesch committed
137

Dimitri van Heesch's avatar
Dimitri van Heesch committed
138 139 140
class NamespaceSDict : public SDict<NamespaceDef>
{
  public:
141
    NamespaceSDict(int size=17) : SDict<NamespaceDef>(size) {}
Dimitri van Heesch's avatar
Dimitri van Heesch committed
142 143 144 145 146 147 148
   ~NamespaceSDict() {}
    int compareItems(GCI item1,GCI item2)
    {
      return stricmp(((NamespaceDef *)item1)->name(),
                    ((NamespaceDef *)item2)->name()
                   );
    }
149
    void writeDeclaration(OutputList &ol,bool localName=FALSE);
Dimitri van Heesch's avatar
Dimitri van Heesch committed
150 151 152 153
};



Dimitri van Heesch's avatar
Dimitri van Heesch committed
154
#endif