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

#include <docparser.h>

Inheritance diagram for DocHtmlHeader:
CompAccept< DocHtmlHeader > DocNode

Public Member Functions

 DocHtmlHeader (DocNode *parent, const HtmlAttribList &attribs, int level)
 
int level () const
 
Kind kind () const
 
const HtmlAttribListattribs () const
 
void accept (DocVisitor *v)
 
int parse ()
 
- Public Member Functions inherited from CompAccept< DocHtmlHeader >
 CompAccept ()
 
virtual ~CompAccept ()
 
void accept (DocHtmlHeader *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
 
HtmlAttribList m_attribs
 

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

Detailed Description

Node Html heading

Definition at line 889 of file docparser.h.

Constructor & Destructor Documentation

DocHtmlHeader::DocHtmlHeader ( DocNode parent,
const HtmlAttribList attribs,
int  level 
)
inline

Definition at line 892 of file docparser.h.

892  :
893  m_level(level), m_attribs(attribs) { m_parent = parent; }
DocNode * parent() const
Definition: docparser.h:147
int level() const
Definition: docparser.h:894
DocNode * m_parent
Definition: docparser.h:163
HtmlAttribList m_attribs
Definition: docparser.h:902

Member Function Documentation

void DocHtmlHeader::accept ( DocVisitor v)
inlinevirtual

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

Parameters
vAbstract visitor.

Implements DocNode.

Definition at line 897 of file docparser.h.

void accept(T *obj, DocVisitor *v)
Definition: docparser.h:177
const HtmlAttribList& DocHtmlHeader::attribs ( ) const
inline

Definition at line 896 of file docparser.h.

896 { return m_attribs; }
HtmlAttribList m_attribs
Definition: docparser.h:902
Kind DocHtmlHeader::kind ( ) const
inlinevirtual

Returns the kind of node. Provides runtime type information

Implements DocNode.

Definition at line 895 of file docparser.h.

int DocHtmlHeader::level ( ) const
inline

Definition at line 894 of file docparser.h.

894 { return m_level; }
int DocHtmlHeader::parse ( )

Definition at line 2935 of file docparser.cpp.

2936 {
2937  int retval=RetVal_OK;
2938  g_nodeStack.push(this);
2939  DBG(("DocHtmlHeader::parse() start\n"));
2940 
2941  int tok;
2942  while ((tok=doctokenizerYYlex()))
2943  {
2944  if (!defaultHandleToken(this,tok,m_children))
2945  {
2946  switch (tok)
2947  {
2948  case TK_COMMAND:
2949  warn_doc_error(g_fileName,doctokenizerYYlineno,"Illegal command %s as part of a <h%d> tag",
2951  break;
2952  case TK_HTMLTAG:
2953  {
2954  int tagId=Mappers::htmlTagMapper->map(g_token->name);
2955  if (tagId==HTML_H1 && g_token->endTag) // found </h1> tag
2956  {
2957  if (m_level!=1)
2958  {
2959  warn_doc_error(g_fileName,doctokenizerYYlineno,"<h%d> ended with </h1>",
2960  m_level);
2961  }
2962  goto endheader;
2963  }
2964  else if (tagId==HTML_H2 && g_token->endTag) // found </h2> tag
2965  {
2966  if (m_level!=2)
2967  {
2968  warn_doc_error(g_fileName,doctokenizerYYlineno,"<h%d> ended with </h2>",
2969  m_level);
2970  }
2971  goto endheader;
2972  }
2973  else if (tagId==HTML_H3 && g_token->endTag) // found </h3> tag
2974  {
2975  if (m_level!=3)
2976  {
2977  warn_doc_error(g_fileName,doctokenizerYYlineno,"<h%d> ended with </h3>",
2978  m_level);
2979  }
2980  goto endheader;
2981  }
2982  else if (tagId==HTML_H4 && g_token->endTag) // found </h4> tag
2983  {
2984  if (m_level!=4)
2985  {
2986  warn_doc_error(g_fileName,doctokenizerYYlineno,"<h%d> ended with </h4>",
2987  m_level);
2988  }
2989  goto endheader;
2990  }
2991  else if (tagId==HTML_H5 && g_token->endTag) // found </h5> tag
2992  {
2993  if (m_level!=5)
2994  {
2995  warn_doc_error(g_fileName,doctokenizerYYlineno,"<h%d> ended with </h5>",
2996  m_level);
2997  }
2998  goto endheader;
2999  }
3000  else if (tagId==HTML_H6 && g_token->endTag) // found </h6> tag
3001  {
3002  if (m_level!=6)
3003  {
3004  warn_doc_error(g_fileName,doctokenizerYYlineno,"<h%d> ended with </h6>",
3005  m_level);
3006  }
3007  goto endheader;
3008  }
3009  else if (tagId==HTML_A)
3010  {
3011  if (!g_token->endTag)
3012  {
3014  }
3015  }
3016  else if (tagId==HTML_BR)
3017  {
3018  DocLineBreak *lb = new DocLineBreak(this);
3019  m_children.append(lb);
3020  }
3021  else
3022  {
3023  warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected html tag <%s%s> found within <h%d> context",
3024  g_token->endTag?"/":"",qPrint(g_token->name),m_level);
3025  }
3026 
3027  }
3028  break;
3029  case TK_SYMBOL:
3030  warn_doc_error(g_fileName,doctokenizerYYlineno,"Unsupported symbol %s found",
3031  qPrint(g_token->name));
3032  break;
3033  default:
3034  warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected token %s",
3035  tokToString(tok));
3036  break;
3037  }
3038  }
3039  }
3040  if (tok==0)
3041  {
3042  warn_doc_error(g_fileName,doctokenizerYYlineno,"Unexpected end of comment while inside"
3043  " <h%d> tag\n",m_level);
3044  }
3045 endheader:
3047  DBG(("DocHtmlHeader::parse() end\n"));
3048  DocNode *n=g_nodeStack.pop();
3049  ASSERT(n==this);
3050  return retval;
3051 }
static QCString g_fileName
Definition: docparser.cpp:95
QList< DocNode > m_children
Definition: docparser.h:189
void append(const type *d)
Definition: qlist.h:73
#define DBG(x)
Definition: docparser.cpp:59
int doctokenizerYYlineno
void warn_doc_error(const char *file, int line, const char *fmt,...)
Definition: message.cpp:210
static Mapper * htmlTagMapper
Definition: cmdmapper.h:220
static QStack< DocNode > g_nodeStack
Definition: docparser.cpp:91
TokenInfo * g_token
int doctokenizerYYlex(void)
void push(const type *d)
Definition: qstack.h:58
static void handlePendingStyleCommands(DocNode *parent, QList< DocNode > &children)
Definition: docparser.cpp:957
std::void_t< T > n
int map(const char *n)
Definition: cmdmapper.cpp:225
type * pop()
Definition: qstack.h:59
HtmlAttribList attribs
Definition: doctokenizer.h:102
static int handleAHref(DocNode *parent, QList< DocNode > &children, const HtmlAttribList &tagHtmlAttribs)
Definition: docparser.cpp:981
static bool defaultHandleToken(DocNode *parent, int tok, QList< DocNode > &children, bool handleWord=TRUE)
Definition: docparser.cpp:1331
QCString name
Definition: doctokenizer.h:77
const char * tokToString(int token)
const char * qPrint(const char *s)
Definition: qcstring.h:797
#define ASSERT(x)
Definition: qglobal.h:590

Member Data Documentation

HtmlAttribList DocHtmlHeader::m_attribs
private

Definition at line 902 of file docparser.h.

int DocHtmlHeader::m_level
private

Definition at line 901 of file docparser.h.


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