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

#include <docparser.h>

Inheritance diagram for DocRef:
CompAccept< DocRef > DocNode

Public Member Functions

 DocRef (DocNode *parent, const QCString &target, const QCString &context)
 
void parse ()
 
Kind kind () const
 
QCString file () const
 
QCString relPath () const
 
QCString ref () const
 
QCString anchor () const
 
QCString targetTitle () const
 
bool hasLinkText () const
 
bool refToAnchor () const
 
bool refToSection () const
 
bool refToTable () const
 
bool isSubPage () const
 
void accept (DocVisitor *v)
 
- Public Member Functions inherited from CompAccept< DocRef >
 CompAccept ()
 
virtual ~CompAccept ()
 
void accept (DocRef *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 Types

enum  RefType { Unknown, Anchor, Section, Table }
 

Private Attributes

RefType m_refType
 
bool m_isSubPage
 
QCString m_file
 
QCString m_relPath
 
QCString m_ref
 
QCString m_anchor
 
QCString m_text
 

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< DocRef >
QList< DocNodem_children
 
- Protected Attributes inherited from DocNode
DocNodem_parent
 

Detailed Description

Node representing a reference to some item

Definition at line 821 of file docparser.h.

Member Enumeration Documentation

enum DocRef::RefType
private
Enumerator
Unknown 
Anchor 
Section 
Table 

Definition at line 840 of file docparser.h.

Constructor & Destructor Documentation

DocRef::DocRef ( DocNode parent,
const QCString &  target,
const QCString &  context 
)

Definition at line 2447 of file docparser.cpp.

References SectionInfo::Anchor, anchor(), Anchor, DefinitionIntf::definitionType(), doctokenizerYYlineno, SectionInfo::fileName, SDict< T >::find(), g_fileName, g_inSeeBlock, g_relPath, MemberDef::getClassDef(), Definition::getLanguage(), getLanguageFromFileName(), PageDef::hasParentPage(), Definition::isLinkable(), SectionInfo::label, linkToText(), m_anchor, m_file, m_isSubPage, DocNode::m_parent, m_ref, m_refType, m_relPath, m_text, markdownFileNameToId(), MemberDef::objCMethodName(), SectionInfo::Page, Doxygen::pageSDict, DocNode::parent(), SectionInfo::ref, resolveLink(), Section, Doxygen::sectionDict, SrcLangExt_Markdown, SrcLangExt_Unknown, stripKnownExtensions(), SectionInfo::Table, Table, SectionInfo::title, SectionInfo::type, DefinitionIntf::TypeFile, DefinitionIntf::TypeGroup, DefinitionIntf::TypeMember, DefinitionIntf::TypePage, and warn_doc_error().

:
{
Definition *compound = 0;
QCString anchor;
//printf("DocRef::DocRef(target=%s,context=%s)\n",target.data(),context.data());
ASSERT(!target.isEmpty());
if (sec==0 && lang==SrcLangExt_Markdown) // lookup as markdown file
{
}
if (sec) // ref to section or anchor
{
PageDef *pd = 0;
{
pd = Doxygen::pageSDict->find(target);
}
m_text = sec->title;
if (m_text.isEmpty()) m_text = sec->label;
m_ref = sec->ref;
{
}
else if (sec->type==SectionInfo::Table)
{
}
else
{
}
m_isSubPage = pd && pd->hasParentPage();
//printf("m_text=%s,m_ref=%s,m_file=%s,m_refToAnchor=%d type=%d\n",
// m_text.data(),m_ref.data(),m_file.data(),m_refToAnchor,sec->type);
return;
}
else if (resolveLink(context,target,TRUE,&compound,anchor))
{
bool isFile = compound ?
compound->definitionType()==Definition::TypePage ? TRUE : FALSE) :
FALSE;
m_text = linkToText(compound?compound->getLanguage():SrcLangExt_Unknown,target,isFile);
if (compound && compound->isLinkable()) // ref to compound
{
if (anchor.isEmpty() && /* compound link */
compound->definitionType()==Definition::TypeGroup && /* is group */
((GroupDef *)compound)->groupTitle() /* with title */
)
{
m_text=((GroupDef *)compound)->groupTitle(); // use group's title as link
}
else if (compound->definitionType()==Definition::TypeMember &&
((MemberDef*)compound)->isObjCMethod())
{
// Objective C Method
MemberDef *member = (MemberDef*)compound;
bool localLink = g_memberDef ? member->getClassDef()==g_memberDef->getClassDef() : FALSE;
m_text = member->objCMethodName(localLink,g_inSeeBlock);
}
m_file = compound->getOutputFileBase();
m_ref = compound->getReference();
//printf("isFile=%d compound=%s (%d)\n",isFile,compound->name().data(),
// compound->definitionType());
return;
}
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;
}
}
m_text = target;
warn_doc_error(g_fileName,doctokenizerYYlineno,"unable to resolve reference to `%s' for \\ref command",
qPrint(target));
}

Member Function Documentation

void DocRef::accept ( DocVisitor v)
inlinevirtual

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

Parameters
vAbstract visitor.

Implements DocNode.

Definition at line 837 of file docparser.h.

References CompAccept< T >::accept().

QCString DocRef::anchor ( ) const
inline
QCString DocRef::file ( ) const
inline
bool DocRef::hasLinkText ( ) const
inline
bool DocRef::isSubPage ( ) const
inline
Kind DocRef::kind ( ) const
inlinevirtual

Returns the kind of node. Provides runtime type information

Implements DocNode.

Definition at line 826 of file docparser.h.

References DocNode::Kind_Ref.

{ return Kind_Ref; }
void DocRef::parse ( )

Definition at line 2567 of file docparser.cpp.

References DBG, defaultHandleToken(), docParserPopContext(), docParserPushContext(), doctokenizerYYlex(), doctokenizerYYlineno, flattenParagraphs(), g_fileName, g_insideHtmlLink, g_nodeStack, g_token, handlePendingStyleCommands(), internalValidatingParseDoc(), CompAccept< DocRef >::m_children, m_text, TokenInfo::name, TK_COMMAND, TK_HTMLTAG, TK_SYMBOL, tokToString(), and warn_doc_error().

Referenced by DocPara::handleRef(), and DocHtmlDescTitle::parse().

{
g_nodeStack.push(this);
DBG(("DocRef::parse() start\n"));
int tok;
while ((tok=doctokenizerYYlex()))
{
{
switch (tok)
{
case TK_COMMAND:
warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal command %s as part of a \\ref",
qPrint(g_token->name));
break;
case TK_SYMBOL:
warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported symbol %s found",
qPrint(g_token->name));
break;
case TK_HTMLTAG:
break;
default:
warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected token %s",
tokToString(tok));
break;
}
}
}
if (m_children.isEmpty() && !m_text.isEmpty())
{
}
DocNode *n=g_nodeStack.pop();
ASSERT(n==this);
}
QCString DocRef::ref ( ) const
inline
bool DocRef::refToAnchor ( ) const
inline

Definition at line 833 of file docparser.h.

References Anchor, and m_refType.

Referenced by PrintDocVisitor::visitPre().

{ return m_refType==Anchor; }
bool DocRef::refToSection ( ) const
inline

Definition at line 834 of file docparser.h.

References m_refType, and Section.

Referenced by PrintDocVisitor::visitPre().

{ return m_refType==Section; }
bool DocRef::refToTable ( ) const
inline

Definition at line 835 of file docparser.h.

References m_refType, and Table.

Referenced by LatexDocVisitor::visitPre(), and PrintDocVisitor::visitPre().

{ return m_refType==Table; }
QCString DocRef::relPath ( ) const
inline

Definition at line 828 of file docparser.h.

References m_relPath.

Referenced by HtmlDocVisitor::visitPre().

{ return m_relPath; }
QCString DocRef::targetTitle ( ) const
inline

Member Data Documentation

QCString DocRef::m_anchor
private

Definition at line 846 of file docparser.h.

Referenced by anchor(), and DocRef().

QCString DocRef::m_file
private

Definition at line 843 of file docparser.h.

Referenced by DocRef(), and file().

bool DocRef::m_isSubPage
private

Definition at line 842 of file docparser.h.

Referenced by DocRef(), and isSubPage().

QCString DocRef::m_ref
private

Definition at line 845 of file docparser.h.

Referenced by DocRef(), and ref().

RefType DocRef::m_refType
private

Definition at line 841 of file docparser.h.

Referenced by DocRef(), refToAnchor(), refToSection(), and refToTable().

QCString DocRef::m_relPath
private

Definition at line 844 of file docparser.h.

Referenced by DocRef(), and relPath().

QCString DocRef::m_text
private

Definition at line 847 of file docparser.h.

Referenced by DocRef(), parse(), and targetTitle().


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