308 if (m_impl->inherits==0) |
308 if (m_impl->inherits==0) |
309 { |
309 { |
310 m_impl->inherits = new BaseClassList; |
310 m_impl->inherits = new BaseClassList; |
311 m_impl->inherits->setAutoDelete(TRUE); |
311 m_impl->inherits->setAutoDelete(TRUE); |
312 } |
312 } |
313 m_impl->inherits->append(new BaseClassDef(cd,n,p,s,t)); |
313 if (Config_getBool("PREPROCESS_INCLUDES")) { |
|
314 // If we are preprocessing the #included files we might have seen |
|
315 // this class declaration, and inheritance more than once so we |
|
316 // only add a relationship where one did not exist before |
|
317 bool hasAlready = false; |
|
318 BaseClassListIterator bcli(*baseClasses()); |
|
319 BaseClassDef *bcd; |
|
320 for (bcli.toFirst();(bcd=bcli.current());++bcli) { |
|
321 if (bcd->usedName == n) { |
|
322 hasAlready = true; |
|
323 //printf("*** Seen it...\n"); |
|
324 break; |
|
325 } |
|
326 } |
|
327 if (!hasAlready) { |
|
328 m_impl->inherits->append(new BaseClassDef(cd,n,p,s,t)); |
|
329 } |
|
330 } else { |
|
331 m_impl->inherits->append(new BaseClassDef(cd,n,p,s,t)); |
|
332 } |
314 } |
333 } |
315 |
334 |
316 // inserts a sub class in the inherited list |
335 // inserts a sub class in the inherited list |
317 void ClassDef::insertSubClass(ClassDef *cd,Protection p, |
336 void ClassDef::insertSubClass(ClassDef *cd,Protection p, |
318 Specifier s,const char *t) |
337 Specifier s,const char *t) |
358 void ClassDef::internalInsertMember(MemberDef *md, |
377 void ClassDef::internalInsertMember(MemberDef *md, |
359 Protection prot, |
378 Protection prot, |
360 bool addToAllList |
379 bool addToAllList |
361 ) |
380 ) |
362 { |
381 { |
363 //printf("insertInternalMember(%s) isHidden()=%d\n",md->name().data(),md->isHidden()); |
382 //printf("%p:insertInternalMember(%s) isHidden()=%d\n", this, md->name().data(),md->isHidden()); |
364 if (md->isHidden()) return; |
383 if (md->isHidden()) return; |
365 |
384 |
366 if (!isReference()) |
385 if (!isReference()) |
367 { |
386 { |
368 static bool extractPrivate = Config_getBool("EXTRACT_PRIVATE"); |
387 static bool extractPrivate = Config_getBool("EXTRACT_PRIVATE"); |
3184 ml = m_impl->memberLists.next(); |
3203 ml = m_impl->memberLists.next(); |
3185 } |
3204 } |
3186 return 0; |
3205 return 0; |
3187 } |
3206 } |
3188 |
3207 |
|
3208 /** Need this to check the function, If we wait until we are trying |
|
3209 to insert a MemberDef thatn we will (a) have a memory leak and |
|
3210 (b) call makeresident on that MemberDef prematurely. |
|
3211 */ |
|
3212 bool ClassDef::hasFunction(const QCString &theDef, Protection prot) |
|
3213 { |
|
3214 bool retVal = false; |
|
3215 switch (prot) { |
|
3216 case Protected: |
|
3217 retVal = hasFunction(MemberList::proMethods, theDef); |
|
3218 break; |
|
3219 case Package: |
|
3220 retVal = hasFunction(MemberList::pacMethods, theDef); |
|
3221 break; |
|
3222 case Public: |
|
3223 retVal = hasFunction(MemberList::pubMethods, theDef); |
|
3224 break; |
|
3225 case Private: |
|
3226 retVal = hasFunction(MemberList::priMethods, theDef); |
|
3227 break; |
|
3228 } |
|
3229 return retVal; |
|
3230 } |
|
3231 |
|
3232 bool ClassDef::hasFunction(MemberList::ListType lt, const QCString &theDef) |
|
3233 { |
|
3234 MemberList *ml = createMemberList(lt); |
|
3235 MemberListIterator mli(*ml); |
|
3236 MemberDef *cmd; |
|
3237 for (mli.toFirst(); (cmd = mli.current()); ++mli) { |
|
3238 if (theDef == cmd->declaration()) { |
|
3239 //printf("ClassDef::addMemberToList() rejecting duplicate %d \"%s::%s\"\n", md->memberType(), name().data(), md->declaration() ? md->declaration() : ""); |
|
3240 return true; |
|
3241 } |
|
3242 } |
|
3243 return false; |
|
3244 } |
|
3245 |
3189 void ClassDef::addMemberToList(MemberList::ListType lt,MemberDef *md,bool isBrief) |
3246 void ClassDef::addMemberToList(MemberList::ListType lt,MemberDef *md,bool isBrief) |
3190 { |
3247 { |
3191 static bool sortBriefDocs = Config_getBool("SORT_BRIEF_DOCS"); |
3248 static bool sortBriefDocs = Config_getBool("SORT_BRIEF_DOCS"); |
3192 static bool sortMemberDocs = Config_getBool("SORT_MEMBER_DOCS"); |
3249 static bool sortMemberDocs = Config_getBool("SORT_MEMBER_DOCS"); |
3193 MemberList *ml = createMemberList(lt); |
3250 MemberList *ml = createMemberList(lt); |
|
3251 /* |
|
3252 if (Config_getBool("PREPROCESS_INCLUDES")) { |
|
3253 // If we are preprocessing the #included files we might have seen |
|
3254 // this member more than once so we |
|
3255 // only add a member where one did not exist before |
|
3256 MemberListIterator mli(*ml); |
|
3257 MemberDef *cmd; |
|
3258 for (mli.toFirst(); (cmd = mli.current()); ++mli) { |
|
3259 if (strcmp(md->declaration(), cmd->declaration()) == 0) { |
|
3260 //if (md->anchor() == cmd->anchor()) { |
|
3261 printf("ClassDef::addMemberToList() rejecting duplicate %d \"%s::%s\"\n", md->memberType(), name().data(), md->declaration() ? md->declaration() : ""); |
|
3262 // TODO: Delete md to avoid memory leak??? |
|
3263 // But some callers still use md after it has been inserted... |
|
3264 return; |
|
3265 } |
|
3266 } |
|
3267 } |
|
3268 printf("ClassDef::addMemberToList() adding %d, \"%s::%s\"\n", md->memberType(), name().data(), md->declaration() ? md->declaration() : ""); |
|
3269 */ |
3194 if (( isBrief && sortBriefDocs ) || |
3270 if (( isBrief && sortBriefDocs ) || |
3195 (!isBrief && sortMemberDocs) |
3271 (!isBrief && sortMemberDocs) |
3196 ) |
3272 ) |
3197 ml->inSort(md); |
3273 ml->inSort(md); |
3198 else |
3274 else |