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

Node representing a citation of some bibliographic reference. More...

#include <src/docnode.h>

+ Inheritance diagram for DocCite:
+ Collaboration diagram for DocCite:

Public Member Functions

 DocCite (DocParser *parser, DocNodeVariant *parent, const QCString &target, const QCString &context)
 
QCString file () const
 
QCString relPath () const
 
QCString ref () const
 
QCString anchor () const
 
QCString text () 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_file
 
QCString m_relPath
 
QCString m_ref
 
QCString m_anchor
 
QCString m_text
 

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 a citation of some bibliographic reference.

Definition at line 243 of file docnode.h.

Constructor & Destructor Documentation

◆ DocCite()

DocCite::DocCite ( DocParser * parser,
DocNodeVariant * parent,
const QCString & target,
const QCString & context )

Definition at line 894 of file docnode.cpp.

895{
896 size_t numBibFiles = Config_getList(CITE_BIB_FILES).size();
897 //printf("DocCite::DocCite(target=%s)\n",qPrint(target));
898 ASSERT(!target.isEmpty());
899 m_relPath = parser->context.relPath;
900 const CitationManager &ct = CitationManager::instance();
901 const CiteInfo *cite = ct.find(target);
902 //printf("cite=%p text='%s' numBibFiles=%d\n",cite,cite?qPrint(cite->text):"<null>",numBibFiles);
903 if (numBibFiles>0 && cite && !cite->text().isEmpty()) // ref to citation
904 {
905 m_text = cite->text();
906 m_ref = "";
907 m_anchor = ct.anchorPrefix()+cite->label();
909 //printf("CITE ==> m_text=%s,m_ref=%s,m_file=%s,m_anchor=%s\n",
910 // qPrint(m_text),qPrint(m_ref),qPrint(m_file),qPrint(m_anchor));
911 return;
912 }
913 m_text = target;
914 if (numBibFiles==0)
915 {
916 warn_doc_error(parser->context.fileName,parser->tokenizer.getLineNr(),"\\cite command found but no bib files specified via CITE_BIB_FILES!");
917 }
918 else if (cite==nullptr)
919 {
920 warn_doc_error(parser->context.fileName,parser->tokenizer.getLineNr(),"unable to resolve reference to '{}' for \\cite command",
921 target);
922 }
923 else
924 {
925 warn_doc_error(parser->context.fileName,parser->tokenizer.getLineNr(),"\\cite command to '{}' does not have an associated number",
926 target);
927 }
928}
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:257
QCString m_relPath
Definition docnode.h:255
QCString m_ref
Definition docnode.h:256
QCString m_file
Definition docnode.h:254
QCString m_text
Definition docnode.h:258
DocNode(DocParser *parser, DocNodeVariant *parent)
Definition docnode.h:84
DocParser * parser()
Definition docnode.h:97
DocNodeVariant * parent()
Definition docnode.h:89
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition qcstring.h:150
#define Config_getList(name)
Definition config.h:38
#define warn_doc_error(file, line, fmt,...)
Definition message.h:112
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34
#define ASSERT(x)
Definition qcstring.h:39
virtual QCString text() const =0
virtual QCString label() const =0
QCString convertNameToFile(const QCString &name, bool allowDots, bool allowUnderscore)
Definition util.cpp:3944

References CitationManager::anchorPrefix(), ASSERT, Config_getList, convertNameToFile(), DocNode::DocNode(), FALSE, CitationManager::fileName(), CitationManager::find(), CitationManager::instance(), QCString::isEmpty(), CiteInfo::label(), m_anchor, m_file, m_ref, m_relPath, m_text, DocNode::parent(), DocNode::parser(), CiteInfo::text(), TRUE, and warn_doc_error.

Member Function Documentation

◆ anchor()

◆ file()

◆ ref()

QCString DocCite::ref ( ) const
inline

◆ relPath()

QCString DocCite::relPath ( ) const
inline

Definition at line 248 of file docnode.h.

248{ return m_relPath; }

References m_relPath.

Referenced by HtmlDocVisitor::operator()().

◆ text()

Member Data Documentation

◆ m_anchor

QCString DocCite::m_anchor
private

Definition at line 257 of file docnode.h.

Referenced by anchor(), and DocCite().

◆ m_file

QCString DocCite::m_file
private

Definition at line 254 of file docnode.h.

Referenced by DocCite(), and file().

◆ m_ref

QCString DocCite::m_ref
private

Definition at line 256 of file docnode.h.

Referenced by DocCite(), and ref().

◆ m_relPath

QCString DocCite::m_relPath
private

Definition at line 255 of file docnode.h.

Referenced by DocCite(), and relPath().

◆ m_text

QCString DocCite::m_text
private

Definition at line 258 of file docnode.h.

Referenced by DocCite(), and text().


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