ClassDef *GenericsSDict::find(const QCString &key) { int i=key.find('<'); if (i==-1) { GenericsCollection *collection = m_dict.find(key); if (collection && collection->count()==1) { QIntDictIterator<ClassDef> it(*collection); return it.current(); } } else { GenericsCollection *collection = m_dict.find(key.left(i)); if (collection) { ArgumentList argList; stringToArgumentList(key.mid(i),&argList); int c = argList.count(); return collection->find(c); } } return 0; }
QSharedPointer<ClassDef> GenericsSDict::find(const QString &key) { int i = key.indexOf('<'); if (i == -1) { QSharedPointer<QHash<long, QSharedPointer<ClassDef>>> collection = m_dict.find(key); if (collection && collection->count() == 1) { return collection->begin().value(); } } else { QSharedPointer<QHash<long, QSharedPointer<ClassDef>>> collection = m_dict.find(key.left(i)); if (collection) { ArgumentList argList; stringToArgumentList(key.mid(i), &argList); int c = argList.count(); return collection->value(c); } } return QSharedPointer<ClassDef>(); }
void GenericsSDict::insert(const QString &key, QSharedPointer<ClassDef> cd) { int i = key.indexOf('<'); if (i == -1) { return; } ArgumentList argList; stringToArgumentList(key.mid(i), &argList); int c = argList.count(); if (c == 0) { return; } QSharedPointer<QHash<long, QSharedPointer<ClassDef>>> collection = m_dict.find(key.left(i)); if (collection == 0) { // new hash collection = QMakeShared<QHash<long, QSharedPointer<ClassDef>>>(); // add new hash to m_dict m_dict.insert(key.left(i), collection); } if (! collection->contains(c)) { // add the collection collection->insert(c, cd); } }
void GenericsSDict::insert(const QCString &key,ClassDef *cd) { int i=key.find('<'); if (i==-1) return; ArgumentList argList; stringToArgumentList(key.mid(i),&argList); int c = argList.count(); if (c==0) return; GenericsCollection *collection = m_dict.find(key.left(i)); if (collection==0) // new name { collection = new GenericsCollection; m_dict.append(key.left(i),collection); } if (collection->find(c)==0) // should always be 0! { collection->insert(c,cd); } }
void generateDEFForMember(MemberDef *md, FTextStream &t, Definition *def, const char* Prefix) { QCString memPrefix; // + declaration // - reimplements // - reimplementedBy // - exceptions // - const/volatile specifiers // - examples // + source definition // - source references // - source referenced by // - include code if (md->memberType()==MemberDef::EnumValue) return; QCString scopeName; if (md->getClassDef()) scopeName=md->getClassDef()->name(); else if (md->getNamespaceDef()) scopeName=md->getNamespaceDef()->name(); t << " " << Prefix << "-member = {" << endl; memPrefix = " "; memPrefix.append( Prefix ); memPrefix.append( "-mem-" ); QCString memType; bool isFunc=FALSE; switch (md->memberType()) { case MemberDef::Define: memType="define"; break; case MemberDef::EnumValue: ASSERT(0); break; case MemberDef::Property: memType="property"; break; case MemberDef::Event: memType="event"; break; case MemberDef::Variable: memType="variable"; break; case MemberDef::Typedef: memType="typedef"; break; case MemberDef::Enumeration: memType="enum"; break; case MemberDef::Function: memType="function"; isFunc=TRUE; break; case MemberDef::Signal: memType="signal"; isFunc=TRUE; break; case MemberDef::Friend: memType="friend"; isFunc=TRUE; break; case MemberDef::DCOP: memType="dcop"; isFunc=TRUE; break; case MemberDef::Slot: memType="slot"; isFunc=TRUE; break; } t << memPrefix << "kind = '" << memType << "';" << endl; t << memPrefix << "id = '" << md->getOutputFileBase() << "_1" << md->anchor() << "';" << endl; t << memPrefix << "virt = "; switch (md->virtualness()) { case Normal: t << "normal;" << endl; break; case Virtual: t << "virtual;" << endl; break; case Pure: t << "pure-virtual;" << endl; break; default: ASSERT(0); } t << memPrefix << "prot = "; switch(md->protection()) { case Public: t << "public;" << endl; break; case Protected: t << "protected;" << endl; break; case Private: t << "private;" << endl; break; case Package: t << "package;" << endl; break; } if (md->memberType()!=MemberDef::Define && md->memberType()!=MemberDef::Enumeration ) { QCString typeStr = replaceAnonymousScopes(md->typeString()); t << memPrefix << "type = <<_EnD_oF_dEf_TeXt_" << endl << typeStr << endl << "_EnD_oF_dEf_TeXt_;" << endl; } t << memPrefix << "name = '" << md->name() << "';" << endl; if (isFunc) //function { ArgumentList *declAl = new ArgumentList; LockingPtr<ArgumentList> defAl = md->argumentList(); stringToArgumentList(md->argsString(),declAl); QCString fcnPrefix = " " + memPrefix + "param-"; if (declAl->count()>0) { ArgumentListIterator declAli(*declAl); ArgumentListIterator defAli(*defAl); Argument *a; for (declAli.toFirst();(a=declAli.current());++declAli) { Argument *defArg = defAli.current(); t << memPrefix << "param = {" << endl; if (!a->attrib.isEmpty()) { t << fcnPrefix << "attributes = "; writeDEFString(t,a->attrib); t << ';' << endl; } if (!a->type.isEmpty()) { t << fcnPrefix << "type = <<_EnD_oF_dEf_TeXt_" << endl << a->type << endl << "_EnD_oF_dEf_TeXt_;" << endl; } if (!a->name.isEmpty()) { t << fcnPrefix << "declname = "; writeDEFString(t,a->name); t << ';' << endl; } if (defArg && !defArg->name.isEmpty() && defArg->name!=a->name) { t << fcnPrefix << "defname = "; writeDEFString(t,defArg->name); t << ';' << endl; } if (!a->array.isEmpty()) { t << fcnPrefix << "array = "; writeDEFString(t,a->array); t << ';' << endl; } if (!a->defval.isEmpty()) { t << fcnPrefix << "defval = <<_EnD_oF_dEf_TeXt_" << endl << a->defval << endl << "_EnD_oF_dEf_TeXt_;" << endl; } if (defArg) ++defAli; t << " }; /*" << fcnPrefix << "-param */" << endl; } } delete declAl; } else if ( md->memberType()==MemberDef::Define && md->argsString()!=0) { ArgumentListIterator ali(*md->argumentList()); Argument *a; QCString defPrefix = " " + memPrefix + "def-"; for (ali.toFirst();(a=ali.current());++ali) { t << memPrefix << "param = {" << endl; t << defPrefix << "name = '" << a->type << "';" << endl; t << " }; /*" << defPrefix << "-param */" << endl; } } if (!md->initializer().isEmpty()) { t << memPrefix << "initializer = <<_EnD_oF_dEf_TeXt_" << endl << md->initializer() << endl << "_EnD_oF_dEf_TeXt_;" << endl; } // TODO: exceptions, const volatile if (md->memberType()==MemberDef::Enumeration) // enum { LockingPtr<MemberList> enumList = md->enumFieldList(); if (enumList!=0) { MemberListIterator emli(*enumList); MemberDef *emd; for (emli.toFirst();(emd=emli.current());++emli) { t << memPrefix << "enum = { enum-name = " << emd->name() << ';'; if (!emd->initializer().isEmpty()) { t << " enum-value = "; writeDEFString(t,emd->initializer()); t << ';'; } t << " };" << endl; } } } t << memPrefix << "desc-file = '" << md->getDefFileName() << "';" << endl; t << memPrefix << "desc-line = '" << md->getDefLine() << "';" << endl; t << memPrefix << "briefdesc = <<_EnD_oF_dEf_TeXt_" << endl << md->briefDescription() << endl << "_EnD_oF_dEf_TeXt_;" << endl; t << memPrefix << "documentation = <<_EnD_oF_dEf_TeXt_" << endl << md->documentation() << endl << "_EnD_oF_dEf_TeXt_;" << endl; //printf("md->getReferencesMembers()=%p\n",md->getReferencesMembers()); LockingPtr<MemberSDict> mdict = md->getReferencesMembers(); if (!mdict.isNull()) { MemberSDict::Iterator mdi(*mdict); MemberDef *rmd; QCString refPrefix = " " + memPrefix + "ref-"; for (mdi.toFirst();(rmd=mdi.current());++mdi) { if (rmd->getStartBodyLine()!=-1 && rmd->getBodyDef()) { t << memPrefix << "referenceto = {" << endl; t << refPrefix << "id = '" << rmd->getBodyDef()->getOutputFileBase() << "_1" // encoded `:' character (see util.cpp:convertNameToFile) << rmd->anchor() << "';" << endl; t << refPrefix << "line = '" << rmd->getStartBodyLine() << "';" << endl; QCString scope = rmd->getScopeString(); QCString name = rmd->name(); if (!scope.isEmpty() && scope!=def->name()) { name.prepend(scope+"::"); } t << refPrefix << "name = "; writeDEFString(t,name); t << ';' << endl << " };" << endl; } } /* for (mdi.toFirst...) */ } mdict = md->getReferencedByMembers(); if (!mdict.isNull()) { MemberSDict::Iterator mdi(*mdict); MemberDef *rmd; QCString refPrefix = " " + memPrefix + "ref-"; for (mdi.toFirst();(rmd=mdi.current());++mdi) { if (rmd->getStartBodyLine()!=-1 && rmd->getBodyDef()) { t << memPrefix << "referenceby = {" << endl; t << refPrefix << "id = '" << rmd->getBodyDef()->getOutputFileBase() << "_1" // encoded `:' character (see util.cpp:convertNameToFile) << rmd->anchor() << "';" << endl; t << refPrefix << "line = '" << rmd->getStartBodyLine() << "';" << endl; QCString scope = rmd->getScopeString(); QCString name = rmd->name(); if (!scope.isEmpty() && scope!=def->name()) { name.prepend(scope+"::"); } t << refPrefix << "name = "; writeDEFString(t,name); t << ';' << endl << " };" << endl; } } /* for (mdi.toFirst...) */ } t << " }; /* " << Prefix << "-member */" << endl; }
void TagFileParser::buildMemberList(Entry *ce,QList<TagMemberInfo> &members) { QListIterator<TagMemberInfo> mii(members); TagMemberInfo *tmi; for (;(tmi=mii.current());++mii) { Entry *me = new Entry; me->type = tmi->type; me->name = tmi->name; me->args = tmi->arglist; if (!me->args.isEmpty()) { delete me->argList; me->argList = new ArgumentList; stringToArgumentList(me->args,me->argList); } me->protection = tmi->prot; me->virt = tmi->virt; me->stat = tmi->isStatic; me->fileName = ce->fileName; if (ce->section == Entry::GROUPDOC_SEC) { me->groups->append(new Grouping(ce->name,Grouping::GROUPING_INGROUP)); } addDocAnchors(me,tmi->docAnchors); TagInfo *ti = new TagInfo; ti->tagName = m_tagName; ti->anchor = tmi->anchor; ti->fileName = tmi->anchorFile; me->tagInfo = ti; if (tmi->kind=="define") { me->type="#define"; me->section = Entry::DEFINE_SEC; } else if (tmi->kind=="enumvalue") { me->section = Entry::VARIABLE_SEC; me->mtype = Method; } else if (tmi->kind=="property") { me->section = Entry::VARIABLE_SEC; me->mtype = Property; } else if (tmi->kind=="event") { me->section = Entry::VARIABLE_SEC; me->mtype = Event; } else if (tmi->kind=="variable") { me->section = Entry::VARIABLE_SEC; me->mtype = Method; } else if (tmi->kind=="typedef") { me->section = Entry::VARIABLE_SEC; //Entry::TYPEDEF_SEC; me->type.prepend("typedef "); me->mtype = Method; } else if (tmi->kind=="enumeration") { me->section = Entry::ENUM_SEC; me->mtype = Method; } else if (tmi->kind=="function") { me->section = Entry::FUNCTION_SEC; me->mtype = Method; } else if (tmi->kind=="signal") { me->section = Entry::FUNCTION_SEC; me->mtype = Signal; } else if (tmi->kind=="prototype") { me->section = Entry::FUNCTION_SEC; me->mtype = Method; } else if (tmi->kind=="friend") { me->section = Entry::FUNCTION_SEC; me->type.prepend("friend "); me->mtype = Method; } else if (tmi->kind=="dcop") { me->section = Entry::FUNCTION_SEC; me->mtype = DCOP; } else if (tmi->kind=="slot") { me->section = Entry::FUNCTION_SEC; me->mtype = Slot; } ce->addSubEntry(me); } }