summaryrefslogtreecommitdiffstats
path: root/src/groupdef.cpp
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2021-04-11 19:22:59 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2021-04-22 17:34:13 (GMT)
commit592aaa4f17d73ec8c475df0f44efaea8cc4d575c (patch)
tree3cfd68cec756661045ee25c906a8d8f4bddf7a6a /src/groupdef.cpp
parent98c67549bc3cd855873e0ef5eeab7c6410699d78 (diff)
downloadDoxygen-592aaa4f17d73ec8c475df0f44efaea8cc4d575c.zip
Doxygen-592aaa4f17d73ec8c475df0f44efaea8cc4d575c.tar.gz
Doxygen-592aaa4f17d73ec8c475df0f44efaea8cc4d575c.tar.bz2
Refactoring: remove implicit conversion from QCString to const char *
This commit changes the following in relation to string use - The implicit convert from 'QCString' to 'const char *' is removed - Strings parameters use 'const QCString &' as much as possible in favor over 'const char *' - 'if (s)' where s is a QCString has been replaced by 'if(!s.isEmpty())' - data() now always returns a valid C-string and not a 0-pointer. - when passing a string 's' to printf and related functions 'qPrint(s)' is used instead of 's.data()' - for empty string arguments 'QCString()' is used instead of '0' - The copy() operation has been removed - Where possible 'qstrcmp(a,b)==0' has been replaces by 'a==b' and 'qstrcmp(a,b)<0' has been replaced by 'a<b' - Parameters of string type that were default initialized with '= 0' are no initialized with '= QCString()'
Diffstat (limited to 'src/groupdef.cpp')
-rw-r--r--src/groupdef.cpp122
1 files changed, 61 insertions, 61 deletions
diff --git a/src/groupdef.cpp b/src/groupdef.cpp
index 82a550d..a1ed4d5 100644
--- a/src/groupdef.cpp
+++ b/src/groupdef.cpp
@@ -52,15 +52,15 @@
class GroupDefImpl : public DefinitionMixin<GroupDef>
{
public:
- GroupDefImpl(const char *fileName,int line,const char *name,const char *title,const char *refFileName=0);
+ GroupDefImpl(const QCString &fileName,int line,const QCString &name,const QCString &title,const QCString &refFileName=QCString());
virtual ~GroupDefImpl();
virtual DefType definitionType() const { return TypeGroup; }
virtual QCString getOutputFileBase() const;
virtual QCString anchor() const { return QCString(); }
virtual QCString displayName(bool=TRUE) const { return hasGroupTitle() ? m_title : DefinitionMixin::name(); }
- virtual const char *groupTitle() const { return m_title; }
- virtual void setGroupTitle( const char *newtitle );
+ virtual QCString groupTitle() const { return m_title; }
+ virtual void setGroupTitle( const QCString &newtitle );
virtual bool hasGroupTitle( ) const { return m_titleSet; }
virtual void addFile(const FileDef *def);
virtual bool addClass(const ClassDef *def);
@@ -158,8 +158,8 @@ class GroupDefImpl : public DefinitionMixin<GroupDef>
};
-GroupDef *createGroupDef(const char *fileName,int line,const char *name,
- const char *title,const char *refFileName)
+GroupDef *createGroupDef(const QCString &fileName,int line,const QCString &name,
+ const QCString &title,const QCString &refFileName)
{
return new GroupDefImpl(fileName,line,name,title,refFileName);
}
@@ -167,11 +167,11 @@ GroupDef *createGroupDef(const char *fileName,int line,const char *name,
//---------------------------------------------------------------------------
-GroupDefImpl::GroupDefImpl(const char *df,int dl,const char *na,const char *t,
- const char *refFileName) : DefinitionMixin(df,dl,1,na),
+GroupDefImpl::GroupDefImpl(const QCString &df,int dl,const QCString &na,const QCString &t,
+ const QCString &refFileName) : DefinitionMixin(df,dl,1,na),
m_allMemberList(MemberListType_allMembersList)
{
- if (refFileName)
+ if (!refFileName.isEmpty())
{
m_fileName=stripExtension(refFileName);
}
@@ -190,9 +190,9 @@ GroupDefImpl::~GroupDefImpl()
{
}
-void GroupDefImpl::setGroupTitle( const char *t )
+void GroupDefImpl::setGroupTitle( const QCString &t )
{
- if ( t && *t )
+ if ( !t.isEmpty())
{
m_title = t;
m_titleSet = TRUE;
@@ -294,7 +294,7 @@ void GroupDefImpl::addDir(DirDef *def)
void GroupDefImpl::addPage(const PageDef *def)
{
if (def->isHidden()) return;
- //printf("Making page %s part of a group\n",def->name.data());
+ //printf("Making page %s part of a group\n",qPrint(def->name));
m_pages.add(def->name(),def);
const_cast<PageDef*>(def)->makePartOfGroup(this);
}
@@ -328,7 +328,7 @@ bool GroupDefImpl::insertMember(const MemberDef *md,bool docOnly)
{
if (md->isHidden()) return FALSE;
updateLanguage(md);
- //printf("GroupDef(%s)::insertMember(%s)\n", title.data(), md->name().data());
+ //printf("GroupDef(%s)::insertMember(%s)\n", qPrint(title), qPrint(md->name()));
MemberNameInfo *mni = m_allMemberNameInfoLinkedMap.add(md->name());
for (auto &srcMi : *mni)
{
@@ -470,16 +470,16 @@ bool GroupDefImpl::insertMember(const MemberDef *md,bool docOnly)
default:
err("GroupDefImpl::insertMembers(): "
"member '%s' (typeid=%d) with scope '%s' inserted in group scope '%s'!\n",
- md->name().data(),md->memberType(),
- md->getClassDef() ? md->getClassDef()->name().data() : "",
- name().data());
+ qPrint(md->name()),md->memberType(),
+ md->getClassDef() ? qPrint(md->getClassDef()->name()) : "",
+ qPrint(name()));
}
return TRUE;
}
void GroupDefImpl::removeMember(MemberDef *md)
{
- // fprintf(stderr, "GroupDef(%s)::removeMember( %s )\n", title.data(), md->name().data());
+ // fprintf(stderr, "GroupDef(%s)::removeMember( %s )\n", qPrint(title), qPrint(md->name()));
MemberNameInfo *mni = m_allMemberNameInfoLinkedMap.find(md->name());
if (mni)
{
@@ -569,7 +569,7 @@ bool GroupDefImpl::findGroup(const GroupDef *def) const
void GroupDefImpl::addGroup(const GroupDef *def)
{
- //printf("adding group '%s' to group '%s'\n",def->name().data(),name().data());
+ //printf("adding group '%s' to group '%s'\n",qPrint(def->name()),qPrint(name()));
//if (Config_getBool(SORT_MEMBER_DOCS))
// groupList->inSort(def);
//else
@@ -745,7 +745,7 @@ void GroupDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title
ol.popGeneratorState();
ol.pushGeneratorState();
ol.disableAllBut(OutputGenerator::Html);
- ol.writeAnchor(0,"details");
+ ol.writeAnchor(QCString(),"details");
ol.popGeneratorState();
}
else
@@ -761,7 +761,7 @@ void GroupDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title
if (!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF))
{
ol.generateDoc(briefFile(),briefLine(),this,0,briefDescription(),FALSE,FALSE,
- 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
+ QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
}
// write separator between brief and details
if (!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF) &&
@@ -782,14 +782,14 @@ void GroupDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title
if (!documentation().isEmpty())
{
ol.generateDoc(docFile(),docLine(),this,0,documentation()+"\n",TRUE,FALSE,
- 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
+ QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
}
// write inbody documentation
if (!inbodyDocumentation().isEmpty())
{
ol.generateDoc(inbodyFile(),inbodyLine(),this,0,inbodyDocumentation()+"\n",TRUE,FALSE,
- 0,FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
+ QCString(),FALSE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
}
}
}
@@ -800,7 +800,7 @@ void GroupDefImpl::writeBriefDescription(OutputList &ol)
{
DocRoot *rootNode = validatingParseDoc(briefFile(),briefLine(),this,0,
briefDescription(),TRUE,FALSE,
- 0,TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
+ QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
if (rootNode && !rootNode->isEmpty())
{
ol.startParagraph();
@@ -817,7 +817,7 @@ void GroupDefImpl::writeBriefDescription(OutputList &ol)
if (hasDetailedDescription())
{
ol.disableAllBut(OutputGenerator::Html);
- ol.startTextLink(0,"details");
+ ol.startTextLink(QCString(),"details");
ol.parseText(theTranslator->trMore());
ol.endTextLink();
}
@@ -836,7 +836,7 @@ void GroupDefImpl::writeGroupGraph(OutputList &ol)
DotGroupCollaboration graph(this);
if (!graph.isTrivial())
{
- msg("Generating dependency graph for group %s\n",qualifiedName().data());
+ msg("Generating dependency graph for group %s\n",qPrint(qualifiedName()));
ol.pushGeneratorState();
ol.disable(OutputGenerator::Man);
//ol.startParagraph();
@@ -865,16 +865,16 @@ void GroupDefImpl::writeFiles(OutputList &ol,const QCString &title)
ol.startMemberItem(fd->getOutputFileBase(),0);
ol.docify(theTranslator->trFile(FALSE,TRUE)+" ");
ol.insertMemberAlign();
- ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),0,fd->name());
+ ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),QCString(),fd->name());
ol.endMemberItem();
if (!fd->briefDescription().isEmpty() && Config_getBool(BRIEF_MEMBER_DESC))
{
ol.startMemberDescription(fd->getOutputFileBase());
ol.generateDoc(briefFile(),briefLine(),fd,0,fd->briefDescription(),FALSE,FALSE,
- 0,TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
+ QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
ol.endMemberDescription();
}
- ol.endMemberDeclaration(0,0);
+ ol.endMemberDeclaration(QCString(),QCString());
}
ol.endMemberList();
}
@@ -910,16 +910,16 @@ void GroupDefImpl::writeNestedGroups(OutputList &ol,const QCString &title)
//ol.docify(theTranslator->trGroup(FALSE,TRUE));
//ol.docify(" ");
ol.insertMemberAlign();
- ol.writeObjectLink(gd->getReference(),gd->getOutputFileBase(),0,gd->groupTitle());
+ ol.writeObjectLink(gd->getReference(),gd->getOutputFileBase(),QCString(),gd->groupTitle());
ol.endMemberItem();
if (!gd->briefDescription().isEmpty() && Config_getBool(BRIEF_MEMBER_DESC))
{
ol.startMemberDescription(gd->getOutputFileBase());
ol.generateDoc(briefFile(),briefLine(),gd,0,gd->briefDescription(),FALSE,FALSE,
- 0,TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
+ QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
ol.endMemberDescription();
}
- ol.endMemberDeclaration(0,0);
+ ol.endMemberDeclaration(QCString(),QCString());
}
}
ol.endMemberList();
@@ -942,16 +942,16 @@ void GroupDefImpl::writeDirs(OutputList &ol,const QCString &title)
ol.startMemberItem(dd->getOutputFileBase(),0);
ol.parseText(theTranslator->trDir(FALSE,TRUE));
ol.insertMemberAlign();
- ol.writeObjectLink(dd->getReference(),dd->getOutputFileBase(),0,dd->shortName());
+ ol.writeObjectLink(dd->getReference(),dd->getOutputFileBase(),QCString(),dd->shortName());
ol.endMemberItem();
if (!dd->briefDescription().isEmpty() && Config_getBool(BRIEF_MEMBER_DESC))
{
ol.startMemberDescription(dd->getOutputFileBase());
ol.generateDoc(briefFile(),briefLine(),dd,0,dd->briefDescription(),FALSE,FALSE,
- 0,TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
+ QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
ol.endMemberDescription();
}
- ol.endMemberDeclaration(0,0);
+ ol.endMemberDeclaration(QCString(),QCString());
}
ol.endMemberList();
@@ -990,8 +990,8 @@ void GroupDefImpl::writePageDocumentation(OutputList &ol)
ol.endSection(si->label(),SectionType::Subsection);
}
ol.startTextBlock();
- ol.generateDoc(pd->docFile(),pd->docLine(),pd,0,pd->documentation()+pd->inbodyDocumentation(),TRUE,FALSE,
- 0,TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
+ ol.generateDoc(pd->docFile(),pd->docLine(),pd,0,(pd->documentation()+pd->inbodyDocumentation()),TRUE,FALSE,
+ QCString(),TRUE,FALSE,Config_getBool(MARKDOWN_SUPPORT));
ol.endTextBlock();
}
}
@@ -1072,7 +1072,7 @@ void GroupDefImpl::writeSummaryLinks(OutputList &ol) const
lde->kind()==LayoutDocEntry::GroupFiles ? "files" :
lde->kind()==LayoutDocEntry::GroupNestedGroups ? "groups" :
"dirs";
- ol.writeSummaryLink(0,label,ls->title(lang),first);
+ ol.writeSummaryLink(QCString(),label,ls->title(lang),first);
first=FALSE;
}
else if (lde->kind()==LayoutDocEntry::MemberDecl)
@@ -1081,7 +1081,7 @@ void GroupDefImpl::writeSummaryLinks(OutputList &ol) const
MemberList * ml = getMemberList(lmd->type);
if (ml && ml->declVisible())
{
- ol.writeSummaryLink(0,MemberList::listTypeAsString(ml->listType()),lmd->title(lang),first);
+ ol.writeSummaryLink(QCString(),MemberList::listTypeAsString(ml->listType()),lmd->title(lang),first);
first=FALSE;
}
}
@@ -1138,7 +1138,7 @@ void GroupDefImpl::writeDocumentation(OutputList &ol)
}
}
- Doxygen::indexList->addIndexItem(this,0,0,m_title);
+ Doxygen::indexList->addIndexItem(this,0,QCString(),m_title);
//---------------------------------------- start flexible part -------------------------------
@@ -1352,7 +1352,7 @@ void addClassToGroups(const Entry *root,ClassDef *cd)
{
cdm->makePartOfGroup(gd);
}
- //printf("Compound %s: in group %s\n",cd->name().data(),gd->groupTitle());
+ //printf("Compound %s: in group %s\n",qPrint(cd->name()),gd->groupTitle());
}
}
}
@@ -1369,7 +1369,7 @@ void addConceptToGroups(const Entry *root,ConceptDef *cd)
{
cdm->makePartOfGroup(gd);
}
- //printf("Compound %s: in group %s\n",cd->name().data(),gd->groupTitle());
+ //printf("Compound %s: in group %s\n",qPrint(cd->name()),gd->groupTitle());
}
}
}
@@ -1381,7 +1381,7 @@ void addNamespaceToGroups(const Entry *root,NamespaceDef *nd)
for (const Grouping &g : root->groups)
{
GroupDef *gd = Doxygen::groupLinkedMap->find(g.groupname);
- //printf("group '%s' gd=%p\n",g.groupname.data(),(void*)gd);
+ //printf("group '%s' gd=%p\n",qPrint(g.groupname),(void*)gd);
if (gd && gd->addNamespace(nd))
{
NamespaceDefMutable *ndm = toNamespaceDefMutable(nd);
@@ -1389,7 +1389,7 @@ void addNamespaceToGroups(const Entry *root,NamespaceDef *nd)
{
ndm->makePartOfGroup(gd);
}
- //printf("Namespace %s: in group %s\n",nd->name().data(),s->data());
+ //printf("Namespace %s: in group %s\n",qPrint(nd->name()),qPrint(gd->name()));
}
}
}
@@ -1400,19 +1400,19 @@ void addDirToGroups(const Entry *root,DirDef *dd)
for (const Grouping &g : root->groups)
{
GroupDef *gd = Doxygen::groupLinkedMap->find(g.groupname);
- //printf("group '%s'\n",g->groupname.data());
+ //printf("group '%s'\n",qPrint(g->groupname));
if (gd)
{
gd->addDir(dd);
dd->makePartOfGroup(gd);
- //printf("Dir %s: in group %s\n",dd->name().data(),g->groupname.data());
+ //printf("Dir %s: in group %s\n",qPrint(dd->name()),qPrint(g->groupname));
}
}
}
void addGroupToGroups(const Entry *root,GroupDef *subGroup)
{
- //printf("addGroupToGroups for %s groups=%d\n",root->name.data(),root->groups.size());
+ //printf("addGroupToGroups for %s groups=%d\n",qPrint(root->name),root->groups.size());
for (const Grouping &g : root->groups)
{
GroupDef *gd = Doxygen::groupLinkedMap->find(g.groupname);
@@ -1421,12 +1421,12 @@ void addGroupToGroups(const Entry *root,GroupDef *subGroup)
if (gd==subGroup)
{
warn(root->fileName,root->startLine,"Refusing to add group %s to itself",
- gd->name().data());
+ qPrint(gd->name()));
}
else if (subGroup->findGroup(gd))
{
warn(root->fileName,root->startLine,"Refusing to add group %s to group %s, since the latter is already a "
- "subgroup of the former\n", subGroup->name().data(),gd->name().data());
+ "subgroup of the former\n", qPrint(subGroup->name()),qPrint(gd->name()));
}
else if (!gd->findGroup(subGroup))
{
@@ -1441,7 +1441,7 @@ void addGroupToGroups(const Entry *root,GroupDef *subGroup)
void addMemberToGroups(const Entry *root,MemberDef *md)
{
//printf("addMemberToGroups: Root %p = %s, md %p=%s groups=%zu\n",
- // root, root->name.data(), md, md->name().data(), root->groups.size() );
+ // root, qPrint(root->name), md, qPrint(md->name()), root->groups.size() );
// Search entry's group list for group with highest pri.
Grouping::GroupPri_t pri = Grouping::GROUPING_LOWEST;
@@ -1455,11 +1455,11 @@ void addMemberToGroups(const Entry *root,MemberDef *md)
{
if (fgd && gd!=fgd && g.pri==pri)
{
- warn(root->fileName.data(), root->startLine,
+ warn(root->fileName, root->startLine,
"Member %s found in multiple %s groups! "
"The member will be put in group %s, and not in group %s",
- md->name().data(), Grouping::getGroupPriName( pri ),
- gd->name().data(), fgd->name().data()
+ qPrint(md->name()), Grouping::getGroupPriName( pri ),
+ qPrint(gd->name()), qPrint(fgd->name())
);
}
@@ -1503,10 +1503,10 @@ void addMemberToGroups(const Entry *root,MemberDef *md)
warn(md->getGroupFileName(),md->getGroupStartLine(),
"Member documentation for %s found several times in %s groups!\n"
"%s:%d: The member will remain in group %s, and won't be put into group %s",
- md->name().data(), Grouping::getGroupPriName( pri ),
- root->fileName.data(), root->startLine,
- mgd->name().data(),
- fgd->name().data()
+ qPrint(md->name()), Grouping::getGroupPriName( pri ),
+ qPrint(root->fileName), root->startLine,
+ qPrint(mgd->name()),
+ qPrint(fgd->name())
);
}
}
@@ -1523,8 +1523,8 @@ void addMemberToGroups(const Entry *root,MemberDef *md)
if (insertit)
{
//printf("insertMember found at %s line %d: %s: related %s\n",
- // md->getDefFileName().data(),md->getDefLine(),
- // md->name().data(),root->relates.data());
+ // qPrint(md->getDefFileName()),md->getDefLine(),
+ // qPrint(md->name()),qPrint(root->relates));
bool success = fgd->insertMember(md);
if (success)
{
@@ -1554,7 +1554,7 @@ void addExampleToGroups(const Entry *root,PageDef *eg)
{
gd->addExample(eg);
eg->makePartOfGroup(gd);
- //printf("Example %s: in group %s\n",eg->name().data(),s->data());
+ //printf("Example %s: in group %s\n",qPrint(eg->name()),s->data());
}
}
}
@@ -1572,7 +1572,7 @@ void GroupDefImpl::addListReferences()
getOutputFileBase(),
theTranslator->trGroup(TRUE,TRUE),
getOutputFileBase(),name(),
- 0,
+ QCString(),
0
);
}
@@ -1717,7 +1717,7 @@ void GroupDefImpl::writeMemberDeclarations(OutputList &ol,MemberListType lt,cons
}
if (ml)
{
- ml->writeDeclarations(ol,0,0,0,this,title,0);
+ ml->writeDeclarations(ol,0,0,0,this,title,QCString());
}
}
@@ -1738,7 +1738,7 @@ void GroupDefImpl::sortSubGroups()
std::sort(m_groups.begin(),
m_groups.end(),
[](const auto &g1,const auto &g2)
- { return qstrcmp(g1->groupTitle(),g2->groupTitle())<0; });
+ { return g1->groupTitle() < g2->groupTitle(); });
}
bool GroupDefImpl::isLinkableInProject() const