Public Member Functions | Private Attributes | List of all members
DocSection Class Reference

#include <docparser.h>

Inheritance diagram for DocSection:
CompAccept< DocSection > DocNode

Public Member Functions

 DocSection (DocNode *parent, int level, const QCString &id)
 
Kind kind () const
 
int level () const
 
QCString title () const
 
QCString anchor () const
 
QCString id () const
 
QCString file () const
 
void accept (DocVisitor *v)
 
int parse ()
 
- Public Member Functions inherited from CompAccept< DocSection >
 CompAccept ()
 
virtual ~CompAccept ()
 
void accept (DocSection *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

int m_level
 
QCString m_id
 
QCString m_title
 
QCString m_anchor
 
QCString m_file
 

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

Detailed Description

Node representing a normal section

Definition at line 936 of file docparser.h.

Constructor & Destructor Documentation

DocSection::DocSection ( DocNode parent,
int  level,
const QCString id 
)
inline

Definition at line 939 of file docparser.h.

939  :
940  m_level(level), m_id(id) { m_parent = parent; }
DocNode * parent() const
Definition: docparser.h:147
int level() const
Definition: docparser.h:942
QCString m_id
Definition: docparser.h:952
DocNode * m_parent
Definition: docparser.h:163
int m_level
Definition: docparser.h:951

Member Function Documentation

void DocSection::accept ( DocVisitor v)
inlinevirtual

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

Parameters
vAbstract visitor.

Implements DocNode.

Definition at line 947 of file docparser.h.

void accept(T *obj, DocVisitor *v)
Definition: docparser.h:177
QCString DocSection::anchor ( ) const
inline

Definition at line 944 of file docparser.h.

944 { return m_anchor; }
QCString m_anchor
Definition: docparser.h:954
QCString DocSection::file ( ) const
inline

Definition at line 946 of file docparser.h.

946 { return m_file; }
QCString m_file
Definition: docparser.h:955
QCString DocSection::id ( ) const
inline

Definition at line 945 of file docparser.h.

945 { return m_id; }
QCString m_id
Definition: docparser.h:952
Kind DocSection::kind ( ) const
inlinevirtual

Returns the kind of node. Provides runtime type information

Implements DocNode.

Definition at line 941 of file docparser.h.

int DocSection::level ( ) const
inline

Definition at line 942 of file docparser.h.

942 { return m_level; }
int m_level
Definition: docparser.h:951
int DocSection::parse ( )

Definition at line 6666 of file docparser.cpp.

6667 {
6668  DBG(("DocSection::parse() start %s level=%d\n",qPrint(g_token->sectionId),m_level));
6669  int retval=RetVal_OK;
6670  g_nodeStack.push(this);
6671 
6672  SectionInfo *sec;
6673  if (!m_id.isEmpty())
6674  {
6676  if (sec)
6677  {
6678  m_file = sec->fileName;
6679  m_anchor = sec->label;
6680  m_title = sec->title;
6681  if (m_title.isEmpty()) m_title = sec->label;
6683  {
6684  g_sectionDict->append(m_id,sec);
6685  }
6686  }
6687  }
6688 
6689  // first parse any number of paragraphs
6690  bool isFirst=TRUE;
6691  DocPara *lastPar=0;
6692  do
6693  {
6694  DocPara *par = new DocPara(this);
6695  if (isFirst) { par->markFirst(); isFirst=FALSE; }
6696  retval=par->parse();
6697  if (!par->isEmpty())
6698  {
6699  m_children.append(par);
6700  lastPar=par;
6701  }
6702  else
6703  {
6704  delete par;
6705  }
6706  if (retval==TK_LISTITEM)
6707  {
6708  warn_doc_error(g_fileName,doctokenizerYYlineno,"Invalid list item found");
6709  }
6710  if (retval==RetVal_Internal)
6711  {
6712  DocInternal *in = new DocInternal(this);
6713  m_children.append(in);
6714  retval = in->parse(m_level+1);
6715  if (retval==RetVal_EndInternal)
6716  {
6717  retval=RetVal_OK;
6718  }
6719  }
6720  } while (retval!=0 &&
6721  retval!=RetVal_Section &&
6722  retval!=RetVal_Subsection &&
6723  retval!=RetVal_Subsubsection &&
6724  retval!=RetVal_Paragraph &&
6725  retval!=RetVal_EndInternal
6726  );
6727 
6728  if (lastPar) lastPar->markLast();
6729 
6730  //printf("m_level=%d <-> %d\n",m_level,Doxygen::subpageNestingLevel);
6731 
6733  {
6734  // then parse any number of nested sections
6735  while (retval==RetVal_Subsection) // more sections follow
6736  {
6737  //SectionInfo *sec=Doxygen::sectionDict[g_token->sectionId];
6738  DocSection *s=new DocSection(this,
6740  m_children.append(s);
6741  retval = s->parse();
6742  }
6743  }
6745  {
6746  // then parse any number of nested sections
6747  while (retval==RetVal_Subsubsection) // more sections follow
6748  {
6749  //SectionInfo *sec=Doxygen::sectionDict[g_token->sectionId];
6750  DocSection *s=new DocSection(this,
6752  m_children.append(s);
6753  retval = s->parse();
6754  }
6755  }
6756  else if (retval==RetVal_Paragraph && m_level==QMIN(5,Doxygen::subpageNestingLevel+3))
6757  {
6758  // then parse any number of nested sections
6759  while (retval==RetVal_Paragraph) // more sections follow
6760  {
6761  //SectionInfo *sec=Doxygen::sectionDict[g_token->sectionId];
6762  DocSection *s=new DocSection(this,
6764  m_children.append(s);
6765  retval = s->parse();
6766  }
6767  }
6768  else if ((m_level<=1+Doxygen::subpageNestingLevel && retval==RetVal_Subsubsection) ||
6770  )
6771  {
6772  int level = (retval==RetVal_Subsubsection) ? 3 : 4;
6774  "command found inside %s!",
6776  retval=0; // stop parsing
6777  }
6778  else
6779  {
6780  }
6781 
6782  INTERNAL_ASSERT(retval==0 ||
6783  retval==RetVal_Section ||
6784  retval==RetVal_Subsection ||
6785  retval==RetVal_Subsubsection ||
6786  retval==RetVal_Paragraph ||
6787  retval==RetVal_Internal ||
6788  retval==RetVal_EndInternal
6789  );
6790 
6791  DBG(("DocSection::parse() end: retval=%x\n",retval));
6792  DocNode *n = g_nodeStack.pop();
6793  ASSERT(n==this);
6794  return retval;
6795 }
static QCString g_fileName
Definition: docparser.cpp:95
QList< DocNode > m_children
Definition: docparser.h:189
static SectionDict * g_sectionDict
Definition: docparser.cpp:104
bool isEmpty() const
Definition: qcstring.h:189
void append(const type *d)
Definition: qlist.h:73
int level() const
Definition: docparser.h:942
QCString m_file
Definition: docparser.h:955
static const char * sectionLevelToName[]
Definition: docparser.cpp:73
#define DBG(x)
Definition: docparser.cpp:59
int doctokenizerYYlineno
const bool FALSE
Definition: qglobal.h:370
QCString label
Definition: section.h:56
void warn_doc_error(const char *file, int line, const char *fmt,...)
Definition: message.cpp:210
QCString sectionId
Definition: doctokenizer.h:89
void markFirst(bool v=TRUE)
Definition: docparser.h:1122
static int subpageNestingLevel
Definition: doxygen.h:150
static QStack< DocNode > g_nodeStack
Definition: docparser.cpp:91
void append(const char *key, const T *d)
Definition: sortdict.h:135
TokenInfo * g_token
void push(const type *d)
Definition: qstack.h:58
#define QMIN(a, b)
Definition: qglobal.h:391
QCString m_id
Definition: docparser.h:952
QCString m_anchor
Definition: docparser.h:954
std::void_t< T > n
void markLast(bool v=TRUE)
Definition: docparser.h:1123
int parse()
Definition: docparser.cpp:6348
#define INTERNAL_ASSERT(x)
Definition: docparser.cpp:68
QCString fileName
Definition: section.h:61
static SectionDict * sectionDict
Definition: doxygen.h:117
QCString title
Definition: section.h:57
type * pop()
Definition: qstack.h:59
int m_level
Definition: docparser.h:951
QCString m_title
Definition: docparser.h:953
T * find(const char *key)
Definition: sortdict.h:232
if(!yymsg) yymsg
static QCString * s
Definition: config.cpp:1042
bool isEmpty() const
Definition: docparser.h:1120
const char * qPrint(const char *s)
Definition: qcstring.h:797
const bool TRUE
Definition: qglobal.h:371
int parse(int)
Definition: docparser.cpp:3113
#define ASSERT(x)
Definition: qglobal.h:590
DocSection(DocNode *parent, int level, const QCString &id)
Definition: docparser.h:939
QCString DocSection::title ( ) const
inline

Definition at line 943 of file docparser.h.

943 { return m_title; }
QCString m_title
Definition: docparser.h:953

Member Data Documentation

QCString DocSection::m_anchor
private

Definition at line 954 of file docparser.h.

QCString DocSection::m_file
private

Definition at line 955 of file docparser.h.

QCString DocSection::m_id
private

Definition at line 952 of file docparser.h.

int DocSection::m_level
private

Definition at line 951 of file docparser.h.

QCString DocSection::m_title
private

Definition at line 953 of file docparser.h.


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