📄 classdef.cpp
字号:
/****************************************************************************** * * $Id: classdef.cpp,v 1.54 2001/03/19 19:27:39 root Exp $ * * Copyright (C) 1997-2001 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. * * Documents produced by Doxygen are derivative works derived from the * input used in their production; they are not affected by this license. * */#include <stdio.h>#include <qfile.h>#include <qregexp.h>#include "classdef.h"#include "classlist.h"#include "entry.h"#include "doc.h"#include "doxygen.h"#include "membername.h"#include "message.h"#include "config.h"#include "util.h"#include "diagram.h"#include "language.h"#include "htmlhelp.h"#include "example.h"#include "outputlist.h"#include "dot.h"#include "defargs.h"#include "debug.h"static QCString stripExtension(const char *fName){ QCString result=fName; if (result.right(5)==".html") result=result.left(result.length()-5); return result;}// constructs a new class definitionClassDef::ClassDef( const char *defFileName,int defLine, const char *nm,CompoundType ct, const char *lref,const char *fName) : Definition(defFileName,defLine,removeRedundantWhiteSpace(nm)) { m_compType=ct; QCString compoundName=compoundTypeString(); if (fName) { m_fileName=stripExtension(fName); } else { m_fileName=compoundName+m_name; } if (lref) { m_exampleSDict = 0; } else { m_exampleSDict = new ExampleSDict(17); } m_memListFileName=convertNameToFile(compoundName+m_name+"-members"); m_inherits = new BaseClassList; m_inherits->setAutoDelete(TRUE); m_inheritedBy = new BaseClassList; m_inheritedBy->setAutoDelete(TRUE); m_allMemberNameInfoSDict = new MemberNameInfoSDict(257); m_allMemberNameInfoSDict->setAutoDelete(TRUE); visited=FALSE; setReference(lref); m_incInfo=0; m_tempArgs=0; m_prot=Public; m_nspace=0; m_fileDef=0; m_usesImplClassDict=0; m_usesIntfClassDict=0; m_memberGroupList = new MemberGroupList; m_memberGroupList->setAutoDelete(TRUE); m_memberGroupDict = new MemberGroupDict(17); m_innerClasses = new ClassSDict(17); //int i=name().findRev("::"); // TODO: broken if A<N::C> is the class name //if (i==-1) //{ // m_scopelessName=name(); //} //else //{ // m_scopelessName=name().right(name().length()-i-2); //} m_subGrouping=TRUE; //m_isTemplBaseClass=-1; m_templateInstances = 0; m_templateMaster =0; m_templBaseClassNames = 0; m_artificial = FALSE; m_isAbstract = FALSE; m_isStatic = FALSE;}// destroy the class definitionClassDef::~ClassDef(){ delete m_inherits; delete m_inheritedBy; delete m_allMemberNameInfoSDict; delete m_exampleSDict; delete m_usesImplClassDict; delete m_usesIntfClassDict; delete m_incInfo; delete m_memberGroupList; delete m_memberGroupDict; delete m_innerClasses; delete m_templateInstances; delete m_templBaseClassNames;}QCString ClassDef::displayName() const{ QCString n; if (Config_getBool("HIDE_SCOPE_NAMES")) { n=localName(); } else { n=qualifiedNameWithTemplateParameters(); } return n;}// inserts a base class in the inheritance listvoid ClassDef::insertBaseClass(ClassDef *cd,const char *n,Protection p, Specifier s,const char *t){ //printf("*** insert base class %s into %s\n",cd->name().data(),name().data()); //inherits->inSort(new BaseClassDef(cd,p,s,t)); m_inherits->append(new BaseClassDef(cd,n,p,s,t));}// inserts a sub class in the inherited listvoid ClassDef::insertSubClass(ClassDef *cd,Protection p, Specifier s,const char *t){ //printf("*** insert sub class %s into %s\n",cd->name().data(),name().data()); m_inheritedBy->inSort(new BaseClassDef(cd,0,p,s,t));}void ClassDef::addMembersToMemberGroup(){ ::addMembersToMemberGroup(&pubTypes,m_memberGroupDict,m_memberGroupList); ::addMembersToMemberGroup(&pubMembers,m_memberGroupDict,m_memberGroupList); ::addMembersToMemberGroup(&pubAttribs,m_memberGroupDict,m_memberGroupList); ::addMembersToMemberGroup(&pubSlots,m_memberGroupDict,m_memberGroupList); ::addMembersToMemberGroup(&signals,m_memberGroupDict,m_memberGroupList); ::addMembersToMemberGroup(&dcopMethods,m_memberGroupDict,m_memberGroupList); ::addMembersToMemberGroup(&pubStaticMembers,m_memberGroupDict,m_memberGroupList); ::addMembersToMemberGroup(&pubStaticAttribs,m_memberGroupDict,m_memberGroupList); ::addMembersToMemberGroup(&proTypes,m_memberGroupDict,m_memberGroupList); ::addMembersToMemberGroup(&proMembers,m_memberGroupDict,m_memberGroupList); ::addMembersToMemberGroup(&proAttribs,m_memberGroupDict,m_memberGroupList); ::addMembersToMemberGroup(&proSlots,m_memberGroupDict,m_memberGroupList); ::addMembersToMemberGroup(&proStaticMembers,m_memberGroupDict,m_memberGroupList); ::addMembersToMemberGroup(&proStaticAttribs,m_memberGroupDict,m_memberGroupList); ::addMembersToMemberGroup(&priTypes,m_memberGroupDict,m_memberGroupList); ::addMembersToMemberGroup(&priMembers,m_memberGroupDict,m_memberGroupList); ::addMembersToMemberGroup(&priAttribs,m_memberGroupDict,m_memberGroupList); ::addMembersToMemberGroup(&priSlots,m_memberGroupDict,m_memberGroupList); ::addMembersToMemberGroup(&priStaticMembers,m_memberGroupDict,m_memberGroupList); ::addMembersToMemberGroup(&priStaticAttribs,m_memberGroupDict,m_memberGroupList); ::addMembersToMemberGroup(&friends,m_memberGroupDict,m_memberGroupList); ::addMembersToMemberGroup(&related,m_memberGroupDict,m_memberGroupList); ::addMembersToMemberGroup(&properties,m_memberGroupDict,m_memberGroupList);}// adds new member definition to the classvoid ClassDef::insertMember(MemberDef *md){ //printf("adding %s::%s\n",name().data(),md->name().data()); if (!isReference()) { /********************************************/ /* insert member in the declaration section */ /********************************************/ if (md->isRelated() && (Config_getBool("EXTRACT_PRIVATE") || md->protection()!=Private)) { related.append(md); md->setSectionList(&related); } else if (md->isFriend()) { friends.append(md); md->setSectionList(&friends); } else { switch (md->memberType()) { case MemberDef::Signal: // Qt specific signals.append(md); md->setSectionList(&signals); break; case MemberDef::DCOP: // KDE2 specific dcopMethods.append(md); md->setSectionList(&dcopMethods); break; case MemberDef::Property: properties.append(md); md->setSectionList(&properties); break; case MemberDef::Slot: // Qt specific switch (md->protection()) { case Protected: proSlots.append(md); md->setSectionList(&proSlots); break; case Public: pubSlots.append(md); md->setSectionList(&pubSlots); break; case Private: priSlots.append(md); md->setSectionList(&priSlots); break; } break; default: // any of the other members if (md->isStatic()) { if (md->isVariable()) { switch (md->protection()) { case Protected: proStaticAttribs.append(md); md->setSectionList(&proStaticAttribs); break; case Public: pubStaticAttribs.append(md); md->setSectionList(&pubStaticAttribs); break; case Private: priStaticAttribs.append(md); md->setSectionList(&priStaticAttribs); break; } } else // function { switch (md->protection()) { case Protected: proStaticMembers.append(md); md->setSectionList(&proStaticMembers); break; case Public: pubStaticMembers.append(md); md->setSectionList(&pubStaticMembers); break; case Private: priStaticMembers.append(md); md->setSectionList(&priStaticMembers); break; } } } else // not static { if (md->isVariable()) { switch (md->protection()) { case Protected: proAttribs.append(md); md->setSectionList(&proAttribs); break; case Public: pubAttribs.append(md); md->setSectionList(&pubAttribs); break; case Private: priAttribs.append(md); md->setSectionList(&priAttribs); break; } } else if (md->isTypedef() || md->isEnumerate() || md->isEnumValue()) { switch (md->protection()) { case Protected: proTypes.append(md); md->setSectionList(&proTypes); break; case Public: pubTypes.append(md); md->setSectionList(&pubTypes); break; case Private: priTypes.append(md); md->setSectionList(&priTypes); break; } } else // member function { switch (md->protection()) { case Protected: proMembers.append(md); md->setSectionList(&proMembers); break; case Public: pubMembers.append(md); md->setSectionList(&pubMembers); break; case Private: priMembers.append(md); md->setSectionList(&priMembers); break; } } } break; } } /*******************************************************/ /* insert member in the detailed documentation section */ /*******************************************************/ if ((md->isRelated() && (Config_getBool("EXTRACT_PRIVATE") || md->protection()!=Private) ) || md->isFriend() ) { if (Config_getBool("SORT_MEMBER_DOCS")) relatedMembers.inSort(md); else relatedMembers.append(md); } else { switch (md->memberType()) { case MemberDef::Property: if (Config_getBool("SORT_MEMBER_DOCS")) propertyMembers.inSort(md); else propertyMembers.append(md); break; case MemberDef::Signal: // fall through case MemberDef::DCOP: if (Config_getBool("SORT_MEMBER_DOCS")) functionMembers.inSort(md); else functionMembers.append(md); break; case MemberDef::Slot: switch (md->protection()) { case Protected: if (Config_getBool("SORT_MEMBER_DOCS")) functionMembers.inSort(md); else functionMembers.append(md); break; case Public: if (Config_getBool("SORT_MEMBER_DOCS")) functionMembers.inSort(md); else functionMembers.append(md); break; case Private: if (Config_getBool("EXTRACT_PRIVATE")) { if (Config_getBool("SORT_MEMBER_DOCS")) functionMembers.inSort(md); else functionMembers.append(md); } break; } break; default: // any of the other members if (md->protection()!=Private || Config_getBool("EXTRACT_PRIVATE")) { switch (md->memberType()) { case MemberDef::Typedef: if (Config_getBool("SORT_MEMBER_DOCS")) typedefMembers.inSort(md); else typedefMembers.append(md); break; case MemberDef::Enumeration: if (Config_getBool("SORT_MEMBER_DOCS"))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -