Skip to content

Commit

Permalink
Bug 740218 - Full scope needed when making link inside cross-referenc…
Browse files Browse the repository at this point in the history
…ed section
  • Loading branch information
Dimitri van Heesch committed Nov 17, 2014
1 parent 9f477b8 commit c6e4122
Show file tree
Hide file tree
Showing 16 changed files with 54 additions and 11 deletions.
3 changes: 2 additions & 1 deletion src/classdef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3879,7 +3879,8 @@ void ClassDef::addListReferences()
: theTranslator->trClass(TRUE,TRUE),
getOutputFileBase(),
displayName(),
0
0,
this
);
}
if (m_impl->memberGroupSDict)
Expand Down
1 change: 1 addition & 0 deletions src/cmdmapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ CommandMap cmdMap[] =
{ "diafile", CMD_DIAFILE },
{ "--", CMD_NDASH },
{ "---", CMD_MDASH },
{ "_setscope", CMD_SETSCOPE },
{ 0, 0 },
};

Expand Down
3 changes: 2 additions & 1 deletion src/cmdmapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ enum CommandType
CMD_NDASH = 99,
CMD_MDASH = 100,
CMD_STARTUML = 101,
CMD_ENDUML = 102
CMD_ENDUML = 102,
CMD_SETSCOPE = 103
};

enum HtmlTagType
Expand Down
11 changes: 11 additions & 0 deletions src/docparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1410,6 +1410,17 @@ static bool defaultHandleToken(DocNode *parent,int tok, QList<DocNode> &children
doctokenizerYYsetStatePara();
}
break;
case CMD_SETSCOPE:
{
QCString scope;
doctokenizerYYsetStateSetScope();
doctokenizerYYlex();
scope = g_token->name;
g_context = scope;
//printf("Found scope='%s'\n",scope.data());
doctokenizerYYsetStatePara();
}
break;
default:
return FALSE;
}
Expand Down
1 change: 1 addition & 0 deletions src/doctokenizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,5 +161,6 @@ void doctokenizerYYsetStateSnippet();
void doctokenizerYYstartAutoList();
void doctokenizerYYendAutoList();
void doctokenizerYYsetStatePlantUML();
void doctokenizerYYsetStateSetScope();

#endif
13 changes: 13 additions & 0 deletions src/doctokenizer.l
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ REFWORD {LABELID}|{REFWORD2}|{REFWORD3}|{REFWORD4}
%x St_SkipTitle
%x St_Anchor
%x St_Snippet
%x St_SetScope

%x St_Sections
%s St_SecLabel1
Expand Down Expand Up @@ -1012,6 +1013,13 @@ REFWORD {LABELID}|{REFWORD2}|{REFWORD3}|{REFWORD4}
<St_IntRef>{BLANK}+"\"" {
BEGIN(St_Ref2);
}
<St_SetScope>{SCOPEMASK}{BLANK} {
g_token->name = yytext;
g_token->name = g_token->name.stripWhiteSpace();
return TK_WORD;
}
<St_SetScope>{BLANK} {
}
<St_Ref2>"&"{ID}";" { /* symbol */
g_token->name = yytext;
return TK_SYMBOL;
Expand Down Expand Up @@ -1411,6 +1419,11 @@ void doctokenizerYYsetStateSnippet()
BEGIN(St_Snippet);
}

void doctokenizerYYsetStateSetScope()
{
BEGIN(St_SetScope);
}

void doctokenizerYYcleanup()
{
yy_delete_buffer( YY_CURRENT_BUFFER );
Expand Down
6 changes: 3 additions & 3 deletions src/doxygen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5221,7 +5221,7 @@ static void addListReferences()
addRefItem(xrefItems,
name,
theTranslator->trPage(TRUE,TRUE),
name,pd->title(),0);
name,pd->title(),0,0);
}
}

Expand All @@ -5238,7 +5238,7 @@ static void addListReferences()
addRefItem(xrefItems,
name,
theTranslator->trDir(TRUE,TRUE),
name,dd->displayName(),0);
name,dd->displayName(),0,0);
}
}

Expand Down Expand Up @@ -8629,7 +8629,7 @@ static void buildPageList(EntryNav *rootNav)
"page",
name,
title,
0
0,0
);

rootNav->releaseEntry();
Expand Down
1 change: 1 addition & 0 deletions src/filedef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1409,6 +1409,7 @@ void FileDef::addListReferences()
getOutputFileBase(),
theTranslator->trFile(TRUE,TRUE),
getOutputFileBase(),name(),
0,
0
);
}
Expand Down
1 change: 1 addition & 0 deletions src/groupdef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1534,6 +1534,7 @@ void GroupDef::addListReferences()
getOutputFileBase(),
theTranslator->trGroup(TRUE,TRUE),
getOutputFileBase(),name(),
0,
0
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/memberdef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3507,7 +3507,7 @@ void MemberDef::addListReference(Definition *)
addRefItem(xrefItems,
qualifiedName()+argsString(), // argsString is needed for overloaded functions (see bug 609624)
memLabel,
getOutputFileBase()+"#"+anchor(),memName,memArgs);
getOutputFileBase()+"#"+anchor(),memName,memArgs,pd);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/membergroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ void MemberGroup::addListReferences(Definition *def)
name,
theTranslator->trGroup(TRUE,TRUE),
name,
grpHeader,0);
grpHeader,0,def);
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/namespacedef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,8 @@ void NamespaceDef::addListReferences()
theTranslator->trModule(TRUE,TRUE) :
theTranslator->trNamespace(TRUE,TRUE),
getOutputFileBase(),displayName(),
0
0,
this
);
}
MemberGroupSDict::Iterator mgli(*memberGroupSDict);
Expand Down
8 changes: 8 additions & 0 deletions src/reflist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "reflist.h"
#include "util.h"
#include "ftextstream.h"
#include "definition.h"

/*! Create a list of items that are cross referenced with documentation blocks
* @param listName String representing the name of the list.
Expand Down Expand Up @@ -144,6 +145,12 @@ void RefList::generatePage()
doc += "\\anchor ";
doc += item->listAnchor;
doc += "\n";
if (item->scope)
{
doc += "\\_setscope ";
doc += item->scope->name();
doc += " ";
}
doc += item->prefix;
doc += " \\_internalref ";
doc += item->name;
Expand All @@ -166,6 +173,7 @@ void RefList::generatePage()
doc += "</dd>";
}
doc += "</dl>\n";
//printf("generatePage('%s')\n",doc.data());
addRelatedPage(m_listName,m_pageTitle,doc,0,m_listName,1,0,0,0);
}

5 changes: 4 additions & 1 deletion src/reflist.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@
#include <qlist.h>
#include "sortdict.h"

class Definition;

/** This struct represents an item in the list of references. */
struct RefItem
{
RefItem() /*: written(FALSE)*/ {}
RefItem() : scope(0) {}
QCString text; //!< text of the item.
QCString listAnchor; //!< anchor in the list

QCString prefix; //!< type prefix for the name
Definition *scope; //!< scope to use for references.
QCString name; //!< name of the entity containing the reference
QCString title; //!< display name of the entity
QCString args; //!< optional arguments for the entity (if function)
Expand Down
3 changes: 2 additions & 1 deletion src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6364,7 +6364,7 @@ PageDef *addRelatedPage(const char *name,const QCString &ptitle,

void addRefItem(const QList<ListItemInfo> *sli,
const char *key,
const char *prefix, const char *name,const char *title,const char *args)
const char *prefix, const char *name,const char *title,const char *args,Definition *scope)
{
//printf("addRefItem(sli=%p,key=%s,prefix=%s,name=%s,title=%s,args=%s)\n",sli,key,prefix,name,title,args);
if (sli && key && key[0]!='@') // check for @ to skip anonymous stuff (see bug427012)
Expand All @@ -6389,6 +6389,7 @@ void addRefItem(const QList<ListItemInfo> *sli,
ASSERT(item!=0);

item->prefix = prefix;
item->scope = scope;
item->name = name;
item->title = title;
item->args = args;
Expand Down
2 changes: 1 addition & 1 deletion src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ int filterCRLF(char *buf,int len);

void addRefItem(const QList<ListItemInfo> *sli,const char *prefix,
const char *key,
const char *name,const char *title,const char *args);
const char *name,const char *title,const char *args,Definition *scope);

PageDef *addRelatedPage(const char *name,const QCString &ptitle,
const QCString &doc,QList<SectionInfo> *anchors,
Expand Down

0 comments on commit c6e4122

Please sign in to comment.