@@ -1056,7 +1056,7 @@ void linkifyText(const TextGeneratorIntf &out, const Definition *scope,
10561056 {
10571057 GetDefInput input (scopeName,matchWord,QCString ());
10581058 GetDefResult result = getDefs (input);
1059- if (result.found &&
1059+ if (result.found && result. md &&
10601060 (external ? result.md ->isLinkable () : result.md ->isLinkableInProject ())
10611061 )
10621062 {
@@ -2240,6 +2240,26 @@ GetDefResult getDefsNew(const GetDefInput &input)
22402240 result.gd = result.md ->getGroupDef ();
22412241 result.found = true ;
22422242 }
2243+ else if (symbol && symbol->definitionType ()==Definition::TypeClass)
2244+ {
2245+ result.cd = toClassDef (symbol);
2246+ result.found = true ;
2247+ }
2248+ else if (symbol && symbol->definitionType ()==Definition::TypeNamespace)
2249+ {
2250+ result.nd = toNamespaceDef (symbol);
2251+ result.found = true ;
2252+ }
2253+ else if (symbol && symbol->definitionType ()==Definition::TypeConcept)
2254+ {
2255+ result.cnd = toConceptDef (symbol);
2256+ result.found = true ;
2257+ }
2258+ else if (symbol && symbol->definitionType ()==Definition::TypeModule)
2259+ {
2260+ result.modd = toModuleDef (symbol);
2261+ result.found = true ;
2262+ }
22432263 return result;
22442264}
22452265
@@ -2808,9 +2828,12 @@ GetDefResult getDefs(const GetDefInput &input)
28082828 * - if `nd` is non zero, the scope was a namespace pointed to by nd.
28092829 */
28102830static bool getScopeDefs (const QCString &docScope,const QCString &scope,
2811- ClassDef *&cd, ConceptDef *&cnd, NamespaceDef *&nd)
2831+ ClassDef *&cd, ConceptDef *&cnd, NamespaceDef *&nd,ModuleDef *&modd )
28122832{
2813- cd=nullptr ;nd=nullptr ;
2833+ cd=nullptr ;
2834+ cnd=nullptr ;
2835+ nd=nullptr ;
2836+ modd=nullptr ;
28142837
28152838 QCString scopeName=scope;
28162839 // printf("getScopeDefs: docScope='%s' scope='%s'\n",qPrint(docScope),qPrint(scope));
@@ -2849,6 +2872,10 @@ static bool getScopeDefs(const QCString &docScope,const QCString &scope,
28492872 {
28502873 return TRUE ; // concept link written => quit
28512874 }
2875+ else if ((modd=ModuleManager::instance ().modules ().find (fullName)) && modd->isLinkable ())
2876+ {
2877+ return TRUE ; // module link written => quit
2878+ }
28522879 if (scopeOffset==0 )
28532880 {
28542881 scopeOffset=-1 ;
@@ -2937,11 +2964,12 @@ bool resolveRef(/* in */ const QCString &scName,
29372964 ClassDef *cd=nullptr ;
29382965 NamespaceDef *nd=nullptr ;
29392966 ConceptDef *cnd=nullptr ;
2967+ ModuleDef *modd=nullptr ;
29402968
29412969 // printf("scName=%s fullName=%s\n",qPrint(scName),qPrint(fullName));
29422970
29432971 // check if this is a class or namespace reference
2944- if (scName!=fullName && getScopeDefs (scName,fullName,cd,cnd,nd))
2972+ if (scName!=fullName && getScopeDefs (scName,fullName,cd,cnd,nd,modd ))
29452973 {
29462974 // printf("found scopeDef\n");
29472975 if (cd) // scope matches that of a class
@@ -2952,6 +2980,10 @@ bool resolveRef(/* in */ const QCString &scName,
29522980 {
29532981 *resContext = cnd;
29542982 }
2983+ else if (modd)
2984+ {
2985+ *resContext = modd;
2986+ }
29552987 else // scope matches that of a namespace
29562988 {
29572989 ASSERT (nd!=nullptr );
@@ -3014,6 +3046,7 @@ bool resolveRef(/* in */ const QCString &scName,
30143046
30153047 const GroupDef *gd = nullptr ;
30163048 const ConceptDef *cnd = nullptr ;
3049+ const ModuleDef *modd = nullptr ;
30173050
30183051 // check if nameStr is a member or global.
30193052 // printf("getDefs(scope=%s,name=%s,args=%s checkScope=%d)\n",
@@ -3040,7 +3073,8 @@ bool resolveRef(/* in */ const QCString &scName,
30403073 return FALSE ;
30413074 }
30423075 // printf("after getDefs md=%p cd=%p fd=%p nd=%p gd=%p\n",md,cd,fd,nd,gd);
3043- if (result.md ) {
3076+ if (result.md )
3077+ {
30443078 if (!allowTypeOnly || result.md ->isTypedef () || result.md ->isEnumerate ())
30453079 {
30463080 *resMember=result.md ;
@@ -3054,11 +3088,18 @@ bool resolveRef(/* in */ const QCString &scName,
30543088 return FALSE ;
30553089 }
30563090 }
3057- else if (result.cd ) *resContext=result.cd ;
3058- else if (result.nd ) *resContext=result.nd ;
3059- else if (result.fd ) *resContext=result.fd ;
3060- else if (result.gd ) *resContext=result.gd ;
3061- else { *resContext=nullptr ; *resMember=nullptr ; return FALSE ; }
3091+ else if (result.cd ) *resContext=result.cd ;
3092+ else if (result.nd ) *resContext=result.nd ;
3093+ else if (result.fd ) *resContext=result.fd ;
3094+ else if (result.gd ) *resContext=result.gd ;
3095+ else if (result.cnd ) *resContext=result.cnd ;
3096+ else if (result.modd ) *resContext=result.modd ;
3097+ else
3098+ {
3099+ *resContext=nullptr ; *resMember=nullptr ;
3100+ AUTO_TRACE_ADD (" false" );
3101+ return FALSE ;
3102+ }
30623103 // printf("member=%s (md=%p) anchor=%s linkable()=%d context=%s\n",
30633104 // qPrint(md->name()), md, qPrint(md->anchor()), md->isLinkable(), qPrint((*resContext)->name()));
30643105 AUTO_TRACE_ADD (" true" );
@@ -3076,6 +3117,12 @@ bool resolveRef(/* in */ const QCString &scName,
30763117 AUTO_TRACE_ADD (" true" );
30773118 return TRUE ;
30783119 }
3120+ else if ((modd=ModuleManager::instance ().modules ().find (nameStr)))
3121+ {
3122+ *resContext=modd;
3123+ AUTO_TRACE_ADD (" true" );
3124+ return TRUE ;
3125+ }
30793126 else if (tsName.find (' .' )!=-1 ) // maybe a link to a file
30803127 {
30813128 bool ambig = false ;
@@ -3159,6 +3206,7 @@ bool resolveLink(/* in */ const QCString &scName,
31593206 const ClassDef *cd = nullptr ;
31603207 const DirDef *dir = nullptr ;
31613208 const ConceptDef *cnd = nullptr ;
3209+ const ModuleDef *modd = nullptr ;
31623210 const NamespaceDef *nd = nullptr ;
31633211 const SectionInfo *si = nullptr ;
31643212 bool ambig = false ;
@@ -3238,6 +3286,13 @@ bool resolveLink(/* in */ const QCString &scName,
32383286 AUTO_TRACE_EXIT (" concept" );
32393287 return TRUE ;
32403288 }
3289+ else if ((modd=ModuleManager::instance ().modules ().find (linkRef)))
3290+ {
3291+ *resContext=modd;
3292+ resAnchor=modd->anchor ();
3293+ AUTO_TRACE_EXIT (" module" );
3294+ return TRUE ;
3295+ }
32413296 else if ((nd=Doxygen::namespaceLinkedMap->find (linkRef)))
32423297 {
32433298 *resContext=nd;
0 commit comments