My Project
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
DocLink Class Reference

#include <docparser.h>

Inheritance diagram for DocLink:
CompAccept< DocLink > DocNode

Public Member Functions

 DocLink (DocNode *parent, const QCString &target)
 
QCString parse (bool, bool isXmlLink=FALSE)
 
Kind kind () const
 
QCString file () const
 
QCString relPath () const
 
QCString ref () const
 
QCString anchor () const
 
void accept (DocVisitor *v)
 
- Public Member Functions inherited from CompAccept< DocLink >
 CompAccept ()
 
virtual ~CompAccept ()
 
void accept (DocLink *obj, DocVisitor *v)
 
const QList< DocNode > & children () const
 
QList< DocNode > & children ()
 
- Public Member Functions inherited from DocNode
 DocNode ()
 
virtual ~DocNode ()
 
DocNodeparent () const
 
void setParent (DocNode *parent)
 
bool isPreformatted () const
 

Private Attributes

QCString m_file
 
QCString m_relPath
 
QCString m_ref
 
QCString m_anchor
 
QCString m_refText
 

Additional Inherited Members

- Public Types inherited from DocNode
enum  Kind {
  Kind_Root = 0, Kind_Word = 1, Kind_WhiteSpace = 2, Kind_Para = 3,
  Kind_AutoList = 4, Kind_AutoListItem = 5, Kind_Symbol = 6, Kind_URL = 7,
  Kind_StyleChange = 8, Kind_SimpleSect = 9, Kind_Title = 10, Kind_SimpleList = 11,
  Kind_SimpleListItem = 12, Kind_Section = 13, Kind_Verbatim = 14, Kind_XRefItem = 15,
  Kind_HtmlList = 16, Kind_HtmlListItem = 17, Kind_HtmlDescList = 18, Kind_HtmlDescData = 19,
  Kind_HtmlDescTitle = 20, Kind_HtmlTable = 21, Kind_HtmlRow = 22, Kind_HtmlCell = 23,
  Kind_HtmlCaption = 24, Kind_LineBreak = 25, Kind_HorRuler = 26, Kind_Anchor = 27,
  Kind_IndexEntry = 28, Kind_Internal = 29, Kind_HRef = 30, Kind_Include = 31,
  Kind_IncOperator = 32, Kind_HtmlHeader = 33, Kind_Image = 34, Kind_DotFile = 35,
  Kind_Link = 36, Kind_Ref = 37, Kind_Formula = 38, Kind_SecRefItem = 39,
  Kind_SecRefList = 40, Kind_SimpleSectSep = 41, Kind_LinkedWord = 42, Kind_ParamSect = 43,
  Kind_ParamList = 44, Kind_InternalRef = 45, Kind_Copy = 46, Kind_Text = 47,
  Kind_MscFile = 48, Kind_HtmlBlockQuote = 49, Kind_VhdlFlow = 50, Kind_ParBlock = 51,
  Kind_DiaFile = 52
}
 
- Protected Member Functions inherited from DocNode
void setInsidePreformatted (bool p)
 
- Protected Attributes inherited from CompAccept< DocLink >
QList< DocNodem_children
 
- Protected Attributes inherited from DocNode
DocNodem_parent
 

Detailed Description

Node representing a link to some item

Definition at line 800 of file docparser.h.

Constructor & Destructor Documentation

DocLink::DocLink ( DocNode parent,
const QCString &  target 
)

Definition at line 2653 of file docparser.cpp.

References anchor(), DefinitionIntf::definitionType(), doctokenizerYYlineno, g_context, g_fileName, g_inSeeBlock, g_relPath, Definition::getOutputFileBase(), Definition::getReference(), Definition::isLinkable(), m_anchor, m_file, DocNode::m_parent, m_ref, m_refText, m_relPath, DocNode::parent(), resolveLink(), stripKnownExtensions(), DefinitionIntf::TypeFile, and warn_doc_error().

{
Definition *compound = 0;
QCString anchor;
m_refText = target;
if (!m_refText.isEmpty() && m_refText.at(0)=='#')
{
m_refText = m_refText.right(m_refText.length()-1);
}
&compound,anchor))
{
if (compound && compound->isLinkable())
{
m_file = compound->getOutputFileBase();
m_ref = compound->getReference();
}
else if (compound && compound->definitionType()==Definition::TypeFile &&
((FileDef*)compound)->generateSourceFile()
) // undocumented file that has source code we can link to
{
m_file = compound->getSourceFileBase();
m_ref = compound->getReference();
}
return;
}
// bogus link target
warn_doc_error(g_fileName,doctokenizerYYlineno,"unable to resolve link to `%s' for \\link command",
qPrint(target));
}

Member Function Documentation

void DocLink::accept ( DocVisitor v)
inlinevirtual

Acceptor function for node visitors. Part of the visitor pattern.

Parameters
vAbstract visitor.

Implements DocNode.

Definition at line 810 of file docparser.h.

References CompAccept< T >::accept().

QCString DocLink::anchor ( ) const
inline
QCString DocLink::file ( ) const
inline
Kind DocLink::kind ( ) const
inlinevirtual

Returns the kind of node. Provides runtime type information

Implements DocNode.

Definition at line 805 of file docparser.h.

References DocNode::Kind_Link.

{ return Kind_Link; }
QCString DocLink::parse ( bool  isJavaLink,
bool  isXmlLink = FALSE 
)

Definition at line 2689 of file docparser.cpp.

References CMD_ENDLINK, Mappers::cmdMapper, DBG, defaultHandleToken(), doctokenizerYYlex(), doctokenizerYYlineno, g_fileName, g_nodeStack, g_token, handlePendingStyleCommands(), CompAccept< DocLink >::m_children, m_refText, TokenInfo::name, TK_COMMAND, TK_HTMLTAG, TK_LNKWORD, TK_SYMBOL, TK_WORD, tokToString(), and warn_doc_error().

Referenced by DocPara::handleHtmlStartTag(), DocPara::handleLink(), and DocHtmlDescTitle::parse().

{
QCString result;
g_nodeStack.push(this);
DBG(("DocLink::parse() start\n"));
int tok;
while ((tok=doctokenizerYYlex()))
{
if (!defaultHandleToken(this,tok,m_children,FALSE))
{
switch (tok)
{
case TK_COMMAND:
{
if (isJavaLink)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"{@link.. ended with @endlink command");
}
goto endlink;
default:
warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal command %s as part of a \\link",
qPrint(g_token->name));
break;
}
break;
case TK_SYMBOL:
warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported symbol %s found",
qPrint(g_token->name));
break;
case TK_HTMLTAG:
if (g_token->name!="see" || !isXmlLink)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected xml/html command %s found",
qPrint(g_token->name));
}
goto endlink;
case TK_LNKWORD:
case TK_WORD:
if (isJavaLink) // special case to detect closing }
{
QCString w = g_token->name;
int p;
if (w=="}")
{
goto endlink;
}
else if ((p=w.find('}'))!=-1)
{
uint l=w.length();
m_children.append(new DocWord(this,w.left(p)));
if ((uint)p<l-1) // something left after the } (for instance a .)
{
result=w.right(l-p-1);
}
goto endlink;
}
}
m_children.append(new DocWord(this,g_token->name));
break;
default:
warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected token %s",
tokToString(tok));
break;
}
}
}
if (tok==0)
{
warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected end of comment while inside"
" link command\n");
}
endlink:
if (m_children.isEmpty()) // no link text
{
m_children.append(new DocWord(this,m_refText));
}
DBG(("DocLink::parse() end\n"));
DocNode *n=g_nodeStack.pop();
ASSERT(n==this);
return result;
}
QCString DocLink::ref ( ) const
inline
QCString DocLink::relPath ( ) const
inline

Definition at line 807 of file docparser.h.

References m_relPath.

Referenced by HtmlDocVisitor::visitPre().

{ return m_relPath; }

Member Data Documentation

QCString DocLink::m_anchor
private

Definition at line 816 of file docparser.h.

Referenced by anchor(), and DocLink().

QCString DocLink::m_file
private

Definition at line 813 of file docparser.h.

Referenced by DocLink(), and file().

QCString DocLink::m_ref
private

Definition at line 815 of file docparser.h.

Referenced by DocLink(), and ref().

QCString DocLink::m_refText
private

Definition at line 817 of file docparser.h.

Referenced by DocLink(), and parse().

QCString DocLink::m_relPath
private

Definition at line 814 of file docparser.h.

Referenced by DocLink(), and relPath().


The documentation for this class was generated from the following files: