Doxygen
Loading...
Searching...
No Matches
DocAnchor Class Reference

Node representing an anchor. More...

#include <src/docnode.h>

+ Inheritance diagram for DocAnchor:
+ Collaboration diagram for DocAnchor:

Public Member Functions

 DocAnchor (DocParser *parser, DocNodeVariant *parent, const QCString &id, bool newAnchor)
 
QCString anchor () const
 
QCString file () const
 
const HtmlAttribListattribs () const
 
- Public Member Functions inherited from DocNode
 DocNode (DocParser *parser, DocNodeVariant *parent)
 
 ~DocNode ()=default
 
DocNodeVariantparent ()
 
const DocNodeVariantparent () const
 
DocNodeVariantthisVariant ()
 
const DocNodeVariantthisVariant () const
 
void setThisVariant (DocNodeVariant *thisVariant)
 
DocParserparser ()
 
const DocParserparser () const
 
void setParent (DocNodeVariant *parent)
 
bool isPreformatted () const
 

Private Attributes

QCString m_anchor
 
QCString m_file
 
HtmlAttribList m_attribs
 

Additional Inherited Members

- Protected Types inherited from DocNode
enum  RefType { Unknown , Anchor , Section , Table }
 
- Protected Member Functions inherited from DocNode
void setInsidePreformatted (bool p)
 

Detailed Description

Node representing an anchor.

Definition at line 227 of file docnode.h.

Constructor & Destructor Documentation

◆ DocAnchor()

DocAnchor::DocAnchor ( DocParser * parser,
DocNodeVariant * parent,
const QCString & id,
bool newAnchor )

Definition at line 208 of file docnode.cpp.

209{
210 if (id.isEmpty())
211 {
212 warn_doc_error(parser->context.fileName,parser->tokenizer.getLineNr(),"Empty anchor label");
213 return;
214 }
215
216 const CitationManager &ct = CitationManager::instance();
217 QCString anchorPrefix = ct.anchorPrefix();
218 if (id.left(anchorPrefix.length()) == anchorPrefix)
219 {
220 const CiteInfo *cite = ct.find(id.mid(anchorPrefix.length()));
221 if (cite)
222 {
224 m_anchor = id;
225 }
226 else
227 {
228 warn_doc_error(parser->context.fileName,parser->tokenizer.getLineNr(),"Invalid cite anchor id '%s'",qPrint(id));
229 m_anchor = "invalid";
230 m_file = "invalid";
231 }
232 }
233 else if (newAnchor) // found <a name="label">
234 {
235 m_anchor = id;
236 }
237 else // found \anchor label
238 {
239 const SectionInfo *sec = SectionManager::instance().find(id);
240 if (sec)
241 {
242 //printf("Found anchor %s\n",qPrint(id));
243 m_file = sec->fileName();
244 m_anchor = sec->label();
245 }
246 else
247 {
248 warn_doc_error(parser->context.fileName,parser->tokenizer.getLineNr(),"Invalid anchor id '%s'",qPrint(id));
249 m_anchor = "invalid";
250 m_file = "invalid";
251 }
252 }
253}
QCString anchorPrefix() const
Definition cite.cpp:122
const CiteInfo * find(const QCString &label) const
Return the citation info for a given label.
Definition cite.cpp:96
static CitationManager & instance()
Definition cite.cpp:80
QCString fileName() const
Definition cite.cpp:117
QCString m_anchor
Definition docnode.h:237
QCString m_file
Definition docnode.h:238
DocNode(DocParser *parser, DocNodeVariant *parent)
Definition docnode.h:84
DocParser * parser()
Definition docnode.h:97
DocNodeVariant * parent()
Definition docnode.h:89
const T * find(const std::string &key) const
Find an object given the key.
Definition linkedmap.h:47
size_t length() const
Returns the length of the string, not counting the 0-terminator.
Definition qcstring.h:153
QCString label() const
Definition section.h:68
QCString fileName() const
Definition section.h:73
static SectionManager & instance()
returns a reference to the singleton
Definition section.h:175
#define warn_doc_error(file, line, fmt,...)
Definition message.h:74
const char * qPrint(const char *s)
Definition qcstring.h:661
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34
QCString convertNameToFile(const QCString &name, bool allowDots, bool allowUnderscore)
Definition util.cpp:3858

References CitationManager::anchorPrefix(), convertNameToFile(), DocNode::DocNode(), FALSE, CitationManager::fileName(), SectionInfo::fileName(), CitationManager::find(), LinkedMap< T, Hash, KeyEqual, Map >::find(), CitationManager::instance(), SectionManager::instance(), SectionInfo::label(), QCString::length(), m_anchor, m_file, DocNode::parent(), DocNode::parser(), qPrint(), TRUE, and warn_doc_error.

Member Function Documentation

◆ anchor()

◆ attribs()

const HtmlAttribList & DocAnchor::attribs ( ) const
inline

Definition at line 234 of file docnode.h.

234{ return m_attribs; }
HtmlAttribList m_attribs
Definition docnode.h:239

References m_attribs.

Referenced by HtmlDocVisitor::operator()().

◆ file()

QCString DocAnchor::file ( ) const
inline

Member Data Documentation

◆ m_anchor

QCString DocAnchor::m_anchor
private

Definition at line 237 of file docnode.h.

Referenced by anchor(), and DocAnchor().

◆ m_attribs

HtmlAttribList DocAnchor::m_attribs
private

Definition at line 239 of file docnode.h.

Referenced by attribs().

◆ m_file

QCString DocAnchor::m_file
private

Definition at line 238 of file docnode.h.

Referenced by DocAnchor(), and file().


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