@@ -229,6 +229,7 @@ class MemberDefImpl : public DefinitionMixin<MemberDefMutable>
229229 virtual QCString getDeclType () const ;
230230 virtual StringVector getLabels (const Definition *container) const ;
231231 virtual const ArgumentList &typeConstraints () const ;
232+ virtual QCString requiresClause () const ;
232233 virtual QCString documentation () const ;
233234 virtual QCString briefDescription (bool abbr=FALSE ) const ;
234235 virtual QCString fieldType () const ;
@@ -304,6 +305,7 @@ class MemberDefImpl : public DefinitionMixin<MemberDefMutable>
304305 virtual void setBriefDescription (const char *b,const char *briefFile,int briefLine);
305306 virtual void setInbodyDocumentation (const char *d,const char *inbodyFile,int inbodyLine);
306307 virtual void setHidden (bool b);
308+ virtual void setRequiresClause (const char *req);
307309 virtual void incrementFlowKeyWordCount ();
308310 virtual void writeDeclaration (OutputList &ol,
309311 const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd,
@@ -344,6 +346,8 @@ class MemberDefImpl : public DefinitionMixin<MemberDefMutable>
344346 const QCString &cname) const ;
345347 void _writeCategoryRelation (OutputList &ol) const ;
346348 void _writeTagData (const DefType) const ;
349+ void _writeTemplatePrefix (OutputList &ol, const Definition *def,
350+ const ArgumentList &al, bool writeReqClause=true ) const ;
347351
348352 static int s_indentLevel;
349353
@@ -735,6 +739,8 @@ class MemberDefAliasImpl : public DefinitionAliasMixin<MemberDef>
735739 { return getMdAlias ()->getDeclLine (); }
736740 virtual int getDeclColumn () const
737741 { return getMdAlias ()->getDeclColumn (); }
742+ virtual QCString requiresClause () const
743+ { return getMdAlias ()->requiresClause (); }
738744
739745 virtual void warnIfUndocumented () const {}
740746 virtual void warnIfUndocumentedParams () const {}
@@ -1119,26 +1125,6 @@ static void writeExceptionList(OutputList &ol, const ClassDef *cd, const MemberD
11191125 }
11201126}
11211127
1122- static void writeTemplatePrefix (OutputList &ol,const ArgumentList &al)
1123- {
1124- ol.docify (" template<" );
1125- for (auto it = al.begin (); it!=al.end ();)
1126- {
1127- Argument a = *it;
1128- ol.docify (a.type );
1129- ol.docify (" " );
1130- ol.docify (a.name );
1131- if (a.defval .length ()!=0 )
1132- {
1133- ol.docify (" = " );
1134- ol.docify (a.defval );
1135- }
1136- ++it;
1137- if (it!=al.end ()) ol.docify (" , " );
1138- }
1139- ol.docify (" > " );
1140- }
1141-
11421128// -----------------------------------------------------------------------------
11431129// -----------------------------------------------------------------------------
11441130// -----------------------------------------------------------------------------
@@ -1189,6 +1175,7 @@ class MemberDefImpl::IMPL
11891175 QCString initializer; // initializer
11901176 QCString extraTypeChars; // extra type info found after the argument list
11911177 QCString enumBaseType; // base type of the enum (C++11)
1178+ QCString requiresClause; // requires clause (C++20)
11921179 int initLines = 0 ; // number of lines in the initializer
11931180
11941181 uint64 memSpec = 0 ; // The specifiers present for this member
@@ -2008,6 +1995,46 @@ QCString MemberDefImpl::getDeclType() const
20081995 return ltype;
20091996}
20101997
1998+ void MemberDefImpl::_writeTemplatePrefix (OutputList &ol, const Definition *def,
1999+ const ArgumentList &al, bool writeReqClause) const
2000+ {
2001+ ol.docify (" template<" );
2002+ for (auto it = al.begin (); it!=al.end ();)
2003+ {
2004+ Argument a = *it;
2005+ linkifyText (TextGeneratorOLImpl (ol), // out
2006+ def, // scope
2007+ getFileDef (), // fileScope
2008+ this , // self
2009+ a.type , // text
2010+ FALSE // autoBreak
2011+ );
2012+ ol.docify (" " );
2013+ ol.docify (a.name );
2014+ if (a.defval .length ()!=0 )
2015+ {
2016+ ol.docify (" = " );
2017+ ol.docify (a.defval );
2018+ }
2019+ ++it;
2020+ if (it!=al.end ()) ol.docify (" , " );
2021+ }
2022+ ol.docify (" > " );
2023+ if (writeReqClause && !m_impl->requiresClause .isEmpty ())
2024+ {
2025+ ol.lineBreak ();
2026+ ol.docify (" requires " );
2027+ linkifyText (TextGeneratorOLImpl (ol), // out
2028+ def, // scope
2029+ getFileDef (), // fileScope
2030+ this , // self
2031+ m_impl->requiresClause , // text
2032+ FALSE // autoBreak
2033+ );
2034+ }
2035+ }
2036+
2037+
20112038void MemberDefImpl::writeDeclaration (OutputList &ol,
20122039 const ClassDef *cd,const NamespaceDef *nd,const FileDef *fd,const GroupDef *gd,
20132040 bool inGroup, const ClassDef *inheritedFrom,const char *inheritId) const
@@ -2086,10 +2113,11 @@ void MemberDefImpl::writeDeclaration(OutputList &ol,
20862113 if (m_impl->tArgList .hasParameters () && getLanguage ()==SrcLangExt_Cpp)
20872114 {
20882115 if (!isAnonType) ol.startMemberTemplateParams ();
2089- writeTemplatePrefix (ol,m_impl->tArgList );
2116+ _writeTemplatePrefix (ol,d ,m_impl->tArgList );
20902117 if (!isAnonType) ol.endMemberTemplateParams (anchor (),inheritId);
20912118 }
20922119
2120+
20932121 // *** write type
20942122 QCString ltype (m_impl->type );
20952123 if (isTypedef () && getLanguage () != SrcLangExt_Slice)
@@ -3280,7 +3308,7 @@ void MemberDefImpl::writeDocumentation(const MemberList *ml,
32803308 {
32813309 if (!first) ol.docify (" " );
32823310 ol.startMemberDocPrefixItem ();
3283- writeTemplatePrefix (ol,tal);
3311+ _writeTemplatePrefix (ol,scopedContainer ,tal);
32843312 ol.endMemberDocPrefixItem ();
32853313 }
32863314 }
@@ -3296,15 +3324,15 @@ void MemberDefImpl::writeDocumentation(const MemberList *ml,
32963324 {
32973325 if (!first) ol.docify (" " );
32983326 ol.startMemberDocPrefixItem ();
3299- writeTemplatePrefix (ol,tal);
3327+ _writeTemplatePrefix (ol,scopedContainer, tal, false );
33003328 ol.endMemberDocPrefixItem ();
33013329 }
33023330 }
33033331 }
33043332 if (m_impl->tArgList .hasParameters () && lang==SrcLangExt_Cpp) // function template prefix
33053333 {
33063334 ol.startMemberDocPrefixItem ();
3307- writeTemplatePrefix (ol,m_impl->tArgList );
3335+ _writeTemplatePrefix (ol,scopedContainer ,m_impl->tArgList );
33083336 ol.endMemberDocPrefixItem ();
33093337 }
33103338 }
@@ -5604,6 +5632,15 @@ QCString MemberDefImpl::enumBaseType() const
56045632 return m_impl->enumBaseType ;
56055633}
56065634
5635+ void MemberDefImpl::setRequiresClause (const char *req)
5636+ {
5637+ m_impl->requiresClause = req;
5638+ }
5639+
5640+ QCString MemberDefImpl::requiresClause () const
5641+ {
5642+ return m_impl->requiresClause ;
5643+ }
56075644
56085645void MemberDefImpl::cacheTypedefVal (const ClassDef*val, const QCString & templSpec, const QCString &resolvedType)
56095646{
0 commit comments