summaryrefslogtreecommitdiffstats
path: root/src/memberlist.cpp
blob: e9fa8b0c205c846901d161efdda9a8e104244daf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/******************************************************************************
 *
 * $Id$
 *
 * Copyright (C) 1997-1999 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 
 * for any purpose. It is provided "as is" without express or implied warranty.
 * See the GNU General Public License for more details.
 *
 * All output generated with Doxygen is not covered by this license.
 *
 */

#include "memberlist.h"
#include "classdef.h"
#include "message.h"
#include <qregexp.h>

MemberList::MemberList() : QList<MemberDef>()
{
}

MemberList::~MemberList()
{
}

int MemberList::compareItems(GCI item1, GCI item2)
{
  MemberDef *c1=(MemberDef *)item1;
  MemberDef *c2=(MemberDef *)item2;
  return strcmp(c1->name(),c2->name());
}

void MemberList::countDecMembers()
{
  varCnt=funcCnt=enumCnt=enumValCnt=typeCnt=protoCnt=defCnt=friendCnt=0;
  MemberDef *md=first();
  while (md)
  {
    if ((!hideMemberFlag || md->hasDocumentation()) &&
        (!hideMemberFlag || !md->documentation().isEmpty() || 
         briefMemDescFlag || repeatBriefFlag
        ) || extractAllFlag || 
        (md->isEnumerate() &&
         md->hasDocumentedEnumValues()
        )
       )
    {
      switch(md->memberType())
      {
        case MemberDef::Variable:    varCnt++;     break;
        case MemberDef::Function:    // fall through
        case MemberDef::Signal:      // fall through
        case MemberDef::Slot:        funcCnt++;    break;
        case MemberDef::Enumeration: enumCnt++;    break;
        case MemberDef::EnumValue:   enumValCnt++; break;
        case MemberDef::Typedef:     typeCnt++;    break;
        case MemberDef::Prototype:   protoCnt++;   break;
        case MemberDef::Define:      if (extractAllFlag || md->argsString() || md->hasDocumentation() ) 
                                       defCnt++;     
                                     break;
        case MemberDef::Friend:      friendCnt++;  break;
        default:
          err("Error: Unknown member type found!");
      }
    }
    md=next();
  }
}

void MemberList::countDocMembers()
{
  varCnt=funcCnt=enumCnt=enumValCnt=typeCnt=protoCnt=defCnt=friendCnt;
  MemberDef *md=first();
  while (md)
  {
    //if (extractAllFlag || /*md->hasDocumentation()*/
    //    !md->documentation().isEmpty() ||
    //    (!md->briefDescription().isEmpty() && 
    //     !briefMemDescFlag && 
    //     repeatBriefFlag 
    //    )
    //   )
    if (extractAllFlag || md->detailsAreVisible())
    {
      QRegExp r("@[0-9]+");
      int dummy;
      switch(md->memberType())
      {
        case MemberDef::Variable:    
          varCnt++;     
          break;
        case MemberDef::Function:    
        case MemberDef::Signal:
        case MemberDef::Slot:
          funcCnt++;    
          break;
        case MemberDef::Enumeration:
          if (r.match(md->name(),0,&dummy)==-1)
          {
            enumCnt++;
          }
          break;
        case MemberDef::EnumValue:   
          {
            MemberDef *scope;
            scope=md->getEnumScope();
            if (scope && r.match(scope->name(),0,&dummy)!=-1) 
              enumValCnt++;
          }
          break;
        case MemberDef::Typedef:     
          typeCnt++;    
          break;
        case MemberDef::Prototype:   
          protoCnt++;   
          break;
        case MemberDef::Define:      
          defCnt++;
          break;
        case MemberDef::Friend:
          friendCnt++;
      }
    }
    md=next();
  }
}

bool MemberList::insert(uint index,const MemberDef *md)
{
  return QList<MemberDef>::insert(index,md);
}

void MemberList::inSort(const MemberDef *md)
{
  QList<MemberDef>::inSort(md);
}

void MemberList::append(const MemberDef *md)
{
  QList<MemberDef>::append(md);
}

MemberListIterator::MemberListIterator(const QList<MemberDef> &l) :
  QListIterator<MemberDef>(l) 
{
}