Skip to content

Commit e03e2a2

Browse files
committed
issue #2732: Adding support for C++ concepts (Origin: bugzilla #499352)
1 parent a9e4a9e commit e03e2a2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+2466
-157
lines changed

doc/commands.doc

+10
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ documentation:
6060
\refitem cmdcite \\cite
6161
\refitem cmdclass \\class
6262
\refitem cmdcode \\code
63+
\refitem cmdconcept \\concept
6364
\refitem cmdcond \\cond
6465
\refitem cmdcopybrief \\copybrief
6566
\refitem cmdcopydetails \\copydetails
@@ -456,6 +457,15 @@ Structural indicators
456457
for the corresponding \mbox{\LaTeX} documentation that is generated by doxygen.
457458
\endlatexonly
458459

460+
<hr>
461+
\section cmdconcept \\concept <name>
462+
463+
\addindex \\concept
464+
Indicates that a comment block contains documentation for a
465+
C++20 concept with name \<name\>.
466+
See also the \ref cmdheaderfile "\\headerfile" command to specify the
467+
header a user should be included to use the concept.
468+
459469
<hr>
460470
\section cmddef \\def <name>
461471

src/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ add_library(doxymain STATIC
224224
classdef.cpp
225225
classlist.cpp
226226
cmdmapper.cpp
227+
conceptdef.cpp
227228
condparser.cpp
228229
context.cpp
229230
cppvalue.cpp

src/classdef.cpp

+43-22
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ class ClassDefImpl : public DefinitionMixin<ClassDefMutable>
188188
virtual bool isVisibleInHierarchy() const;
189189
virtual bool visibleInParentsDeclList() const;
190190
virtual const ArgumentList &templateArguments() const;
191-
virtual NamespaceDef *getNamespaceDef() const;
191+
//virtual NamespaceDef *getNamespaceDef() const;
192192
virtual FileDef *getFileDef() const;
193193
virtual const MemberDef *getMemberByName(const QCString &) const;
194194
virtual bool isBaseClass(const ClassDef *bcd,bool followInstances,int level=0) const;
@@ -250,7 +250,7 @@ class ClassDefImpl : public DefinitionMixin<ClassDefMutable>
250250
virtual void insertUsedFile(const FileDef *);
251251
virtual bool addExample(const char *anchor,const char *name, const char *file);
252252
virtual void mergeCategory(ClassDef *category);
253-
virtual void setNamespace(NamespaceDef *nd);
253+
//virtual void setNamespace(NamespaceDef *nd);
254254
virtual void setFileDef(FileDef *fd);
255255
virtual void setSubGrouping(bool enabled);
256256
virtual void setProtection(Protection p);
@@ -355,6 +355,8 @@ class ClassDefImpl : public DefinitionMixin<ClassDefMutable>
355355
QCString &title,QCString &subtitle) const;
356356
QCString includeStatement() const;
357357
void addTypeConstraint(const QCString &typeConstraint,const QCString &type);
358+
void writeTemplateSpec(OutputList &ol,const Definition *d,
359+
const QCString &type,SrcLangExt lang) const;
358360

359361
// PIMPL idiom
360362
class IMPL;
@@ -428,8 +430,8 @@ class ClassDefAliasImpl : public DefinitionAliasMixin<ClassDef>
428430
{ return getCdAlias()->visibleInParentsDeclList(); }
429431
virtual const ArgumentList &templateArguments() const
430432
{ return getCdAlias()->templateArguments(); }
431-
virtual NamespaceDef *getNamespaceDef() const
432-
{ return getCdAlias()->getNamespaceDef(); }
433+
//virtual NamespaceDef *getNamespaceDef() const
434+
//{ return getCdAlias()->getNamespaceDef(); }
433435
virtual FileDef *getFileDef() const
434436
{ return getCdAlias()->getFileDef(); }
435437
virtual const MemberDef *getMemberByName(const QCString &s) const
@@ -551,8 +553,6 @@ class ClassDefAliasImpl : public DefinitionAliasMixin<ClassDef>
551553
virtual void updateSubClasses(const BaseClassList &) {}
552554
};
553555

554-
555-
556556
ClassDef *createClassDefAlias(const Definition *newScope,const ClassDef *cd)
557557
{
558558
ClassDef *acd = new ClassDefAliasImpl(newScope,cd);
@@ -605,7 +605,7 @@ class ClassDefImpl::IMPL
605605
/*! Namespace this class is part of
606606
* (this is the inner most namespace in case of nested namespaces)
607607
*/
608-
NamespaceDef *nspace = 0;
608+
//NamespaceDef *nspace = 0;
609609

610610
/*! File this class is defined in */
611611
FileDef *fileDef = 0;
@@ -725,7 +725,7 @@ void ClassDefImpl::IMPL::init(const char *defFileName, const char *name,
725725
fileName=ctStr+name;
726726
}
727727
prot=Public;
728-
nspace=0;
728+
//nspace=0;
729729
fileDef=0;
730730
subGrouping=Config_getBool(SUBGROUPING);
731731
templateMaster =0;
@@ -1296,23 +1296,29 @@ static void searchTemplateSpecs(/*in*/ const Definition *d,
12961296
}
12971297
}
12981298

1299-
static void writeTemplateSpec(OutputList &ol,const Definition *d,
1300-
const QCString &type,SrcLangExt lang)
1299+
void ClassDefImpl::writeTemplateSpec(OutputList &ol,const Definition *d,
1300+
const QCString &type,SrcLangExt lang) const
13011301
{
13021302
ArgumentLists specs;
13031303
QCString name;
13041304
searchTemplateSpecs(d,specs,name,lang);
13051305
if (!specs.empty()) // class has template scope specifiers
13061306
{
1307-
ol.startSubsubsection();
1307+
ol.startCompoundTemplateParams();
13081308
for (const ArgumentList &al : specs)
13091309
{
13101310
ol.docify("template<");
13111311
auto it = al.begin();
13121312
while (it!=al.end())
13131313
{
13141314
Argument a = *it;
1315-
ol.docify(a.type);
1315+
linkifyText(TextGeneratorOLImpl(ol), // out
1316+
d, // scope
1317+
getFileDef(), // fileScope
1318+
this, // self
1319+
a.type, // text
1320+
FALSE // autoBreak
1321+
);
13161322
if (!a.name.isEmpty())
13171323
{
13181324
ol.docify(" ");
@@ -1329,9 +1335,20 @@ static void writeTemplateSpec(OutputList &ol,const Definition *d,
13291335
ol.docify(">");
13301336
ol.lineBreak();
13311337
}
1338+
if (!m_impl->requiresClause.isEmpty())
1339+
{
1340+
ol.docify("requires ");
1341+
linkifyText(TextGeneratorOLImpl(ol), // out
1342+
d, // scope
1343+
getFileDef(), // fileScope
1344+
this, // self
1345+
m_impl->requiresClause, // text
1346+
FALSE // autoBreak
1347+
);
1348+
ol.lineBreak();
1349+
}
13321350
ol.docify(type.lower()+" "+name);
1333-
ol.endSubsubsection();
1334-
ol.writeString("\n");
1351+
ol.endCompoundTemplateParams();
13351352
}
13361353
}
13371354

@@ -2557,11 +2574,14 @@ void ClassDefImpl::writeDocumentationContents(OutputList &ol,const QCString & /*
25572574
case LayoutDocEntry::NamespaceNestedNamespaces:
25582575
case LayoutDocEntry::NamespaceNestedConstantGroups:
25592576
case LayoutDocEntry::NamespaceClasses:
2577+
case LayoutDocEntry::NamespaceConcepts:
25602578
case LayoutDocEntry::NamespaceInterfaces:
25612579
case LayoutDocEntry::NamespaceStructs:
25622580
case LayoutDocEntry::NamespaceExceptions:
25632581
case LayoutDocEntry::NamespaceInlineClasses:
2582+
case LayoutDocEntry::ConceptDefinition:
25642583
case LayoutDocEntry::FileClasses:
2584+
case LayoutDocEntry::FileConcepts:
25652585
case LayoutDocEntry::FileInterfaces:
25662586
case LayoutDocEntry::FileStructs:
25672587
case LayoutDocEntry::FileExceptions:
@@ -2573,6 +2593,7 @@ void ClassDefImpl::writeDocumentationContents(OutputList &ol,const QCString & /*
25732593
case LayoutDocEntry::FileSourceLink:
25742594
case LayoutDocEntry::FileInlineClasses:
25752595
case LayoutDocEntry::GroupClasses:
2596+
case LayoutDocEntry::GroupConcepts:
25762597
case LayoutDocEntry::GroupInlineClasses:
25772598
case LayoutDocEntry::GroupNamespaces:
25782599
case LayoutDocEntry::GroupDirs:
@@ -4557,10 +4578,10 @@ const ArgumentList &ClassDefImpl::templateArguments() const
45574578
return m_impl->tempArgs;
45584579
}
45594580

4560-
NamespaceDef *ClassDefImpl::getNamespaceDef() const
4561-
{
4562-
return m_impl->nspace;
4563-
}
4581+
//NamespaceDef *ClassDefImpl::getNamespaceDef() const
4582+
//{
4583+
// return m_impl->nspace;
4584+
//}
45644585

45654586
FileDef *ClassDefImpl::getFileDef() const
45664587
{
@@ -4667,10 +4688,10 @@ const MemberGroupList &ClassDefImpl::getMemberGroups() const
46674688
return m_impl->memberGroups;
46684689
}
46694690

4670-
void ClassDefImpl::setNamespace(NamespaceDef *nd)
4671-
{
4672-
m_impl->nspace = nd;
4673-
}
4691+
//void ClassDefImpl::setNamespace(NamespaceDef *nd)
4692+
//{
4693+
// m_impl->nspace = nd;
4694+
//}
46744695

46754696
void ClassDefImpl::setFileDef(FileDef *fd)
46764697
{

src/classdef.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ class ClassDef : public Definition
211211
/** Returns the namespace this compound is in, or 0 if it has a global
212212
* scope.
213213
*/
214-
virtual NamespaceDef *getNamespaceDef() const = 0;
214+
//virtual NamespaceDef *getNamespaceDef() const = 0;
215215

216216
/** Returns the file in which this compound's definition can be found.
217217
* Should not return 0 (but it might be a good idea to check anyway).
@@ -389,7 +389,7 @@ class ClassDefMutable : public DefinitionMutable, public ClassDef
389389
//-----------------------------------------------------------------------------------
390390

391391
virtual void setIncludeFile(FileDef *fd,const char *incName,bool local,bool force) = 0;
392-
virtual void setNamespace(NamespaceDef *nd) = 0;
392+
//virtual void setNamespace(NamespaceDef *nd) = 0;
393393
virtual void setFileDef(FileDef *fd) = 0;
394394
virtual void setSubGrouping(bool enabled) = 0;
395395
virtual void setProtection(Protection p) = 0;

0 commit comments

Comments
 (0)