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

Node representing a Html description item. More...

#include <src/docnode.h>

+ Inheritance diagram for DocHtmlDescTitle:
+ Collaboration diagram for DocHtmlDescTitle:

Public Member Functions

 DocHtmlDescTitle (DocParser *parser, DocNodeVariant *parent, const HtmlAttribList &attribs)
 
const HtmlAttribListattribs () const
 
Token parse ()
 
- Public Member Functions inherited from DocCompoundNode
 DocCompoundNode (DocParser *parser, DocNodeVariant *parent)
 
DocNodeListchildren ()
 
const DocNodeListchildren () 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

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 a Html description item.

Definition at line 881 of file docnode.h.

Constructor & Destructor Documentation

◆ DocHtmlDescTitle()

DocHtmlDescTitle::DocHtmlDescTitle ( DocParser * parser,
DocNodeVariant * parent,
const HtmlAttribList & attribs )
inline

Definition at line 884 of file docnode.h.

884 :
DocCompoundNode(DocParser *parser, DocNodeVariant *parent)
Definition docnode.h:140
HtmlAttribList m_attribs
Definition docnode.h:890
const HtmlAttribList & attribs() const
Definition docnode.h:886
DocParser * parser()
Definition docnode.h:97
DocNodeVariant * parent()
Definition docnode.h:89

References attribs(), DocCompoundNode::DocCompoundNode(), m_attribs, DocNode::parent(), and DocNode::parser().

Member Function Documentation

◆ attribs()

const HtmlAttribList & DocHtmlDescTitle::attribs ( ) const
inline

Definition at line 886 of file docnode.h.

886{ return m_attribs; }

References m_attribs.

Referenced by DocHtmlDescTitle(), and HtmlDocVisitor::operator()().

◆ parse()

Token DocHtmlDescTitle::parse ( )

Definition at line 2231 of file docnode.cpp.

2232{
2233 AUTO_TRACE();
2234 Token retval = Token::make_TK_NONE();
2235 auto ns = AutoNodeStack(parser(),thisVariant());
2236
2237 Token tok = parser()->tokenizer.lex();
2238 while (!tok.is_any_of(TokenRetval::TK_NONE, TokenRetval::TK_EOF))
2239 {
2240 if (!parser()->defaultHandleToken(thisVariant(),tok,children()))
2241 {
2242 switch (tok.value())
2243 {
2244 case TokenRetval::TK_COMMAND_AT:
2245 // fall through
2246 case TokenRetval::TK_COMMAND_BS:
2247 {
2248 QCString cmdName=parser()->context.token->name;
2249 bool isJavaLink=FALSE;
2250 switch (Mappers::cmdMapper->map(cmdName))
2251 {
2253 {
2254 tok=parser()->tokenizer.lex();
2255 if (!tok.is(TokenRetval::TK_WHITESPACE))
2256 {
2257 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after '%c%s' command",
2258 tok.command_to_char(),qPrint(cmdName));
2259 }
2260 else
2261 {
2263 tok=parser()->tokenizer.lex(); // get the reference id
2264 if (!tok.is(TokenRetval::TK_WORD))
2265 {
2266 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected token %s as the argument of '%c%s' command",
2267 tok.to_string(),tok.command_to_char(),qPrint(cmdName));
2268 }
2269 else
2270 {
2272 children().get_last<DocRef>()->parse();
2273 }
2275 }
2276 }
2277 break;
2279 isJavaLink=TRUE;
2280 // fall through
2282 {
2283 tok=parser()->tokenizer.lex();
2284 if (!tok.is(TokenRetval::TK_WHITESPACE))
2285 {
2286 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after \\%s command",
2287 qPrint(cmdName));
2288 }
2289 else
2290 {
2292 tok=parser()->tokenizer.lex();
2293 if (!tok.is(TokenRetval::TK_WORD))
2294 {
2295 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected token %s as the argument of \\%s command",
2296 tok.to_string(),qPrint(cmdName));
2297 }
2298 else
2299 {
2302 DocLink *lnk = children().get_last<DocLink>();
2303 QCString leftOver = lnk->parse(isJavaLink);
2304 if (!leftOver.isEmpty())
2305 {
2306 children().append<DocWord>(parser(),thisVariant(),leftOver);
2307 }
2308 }
2309 }
2310 }
2311
2312 break;
2313 default:
2314 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Illegal command '%c%s' found as part of a <dt> tag",
2315 tok.command_to_char(),qPrint(cmdName));
2316 }
2317 }
2318 break;
2319 case TokenRetval::TK_SYMBOL:
2320 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unsupported symbol '%s' found as part of a <dt> tag",
2321 qPrint(parser()->context.token->name));
2322 break;
2323 case TokenRetval::TK_HTMLTAG:
2324 {
2325 HtmlTagType tagId=Mappers::htmlTagMapper->map(parser()->context.token->name);
2326 if (tagId==HtmlTagType::HTML_DD && !parser()->context.token->endTag) // found <dd> tag
2327 {
2328 retval = Token::make_RetVal_DescData();
2329 goto endtitle;
2330 }
2331 else if (tagId==HtmlTagType::HTML_DT && parser()->context.token->endTag)
2332 {
2333 // ignore </dt> tag.
2334 }
2335 else if (tagId==HtmlTagType::HTML_DT)
2336 {
2337 // missing <dt> tag.
2338 retval = Token::make_RetVal_DescTitle();
2339 goto endtitle;
2340 }
2341 else if (tagId==HtmlTagType::HTML_DL && parser()->context.token->endTag)
2342 {
2343 retval = Token::make_RetVal_EndDesc();
2344 goto endtitle;
2345 }
2346 else if (tagId==HtmlTagType::HTML_A)
2347 {
2348 if (!parser()->context.token->endTag)
2349 {
2350 parser()->handleAHref(thisVariant(),children(),parser()->context.token->attribs);
2351 }
2352 }
2353 else
2354 {
2355 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected html tag <%s%s> found within <dt> context",
2356 parser()->context.token->endTag?"/":"",qPrint(parser()->context.token->name));
2357 }
2358 }
2359 break;
2360 default:
2361 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected token %s found as part of a <dt> tag",
2362 tok.to_string());
2363 break;
2364 }
2365 }
2366 tok = parser()->tokenizer.lex();
2367 }
2368 if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF))
2369 {
2370 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected end of comment while inside"
2371 " <dt> tag");
2372 }
2373endtitle:
2375 return retval;
2376}
DocNodeList & children()
Definition docnode.h:142
DocNodeVariant * thisVariant()
Definition docnode.h:92
DocTokenizer tokenizer
Token handleAHref(DocNodeVariant *parent, DocNodeList &children, const HtmlAttribList &tagHtmlAttribs)
void handlePendingStyleCommands(DocNodeVariant *parent, DocNodeList &children)
DocParserContext context
void setStateLink()
void setStatePara()
bool is(TokenRetval rv) const
TOKEN_SPECIFICATIONS RETVAL_SPECIFICATIONS const char * to_string() const
TokenRetval value() const
bool is_any_of(ARGS... args) const
char command_to_char() const
HtmlTagType
Definition cmdmapper.h:169
#define AUTO_TRACE(...)
Definition docnode.cpp:46
#define warn_doc_error(file, line, fmt,...)
Definition message.h:74
const Mapper< HtmlTagType > * htmlTagMapper
const Mapper< CommandType > * cmdMapper
const char * qPrint(const char *s)
Definition qcstring.h:672
#define TRUE
Definition qcstring.h:37
#define FALSE
Definition qcstring.h:34
void append(Args &&... args)
Append a new DocNodeVariant to the list by constructing it with type T and parameters Args.
Definition docnode.h:1393
T * get_last()
Returns a pointer to the last element in the list if that element exists and holds a T,...
Definition docnode.h:1404
TokenInfo * token
Definition docparser_p.h:92
QCString name

References DocNodeList::append(), AUTO_TRACE, DocCompoundNode::children(), CMD_JAVALINK, CMD_LINK, CMD_REF, Mappers::cmdMapper, Token::command_to_char(), DocParser::context, DocParserContext::context, FALSE, DocNodeList::get_last(), DocParser::handleAHref(), DocParser::handlePendingStyleCommands(), HTML_A, HTML_DD, HTML_DL, HTML_DT, Mappers::htmlTagMapper, Token::is(), Token::is_any_of(), DocTokenizer::lex(), TokenInfo::name, parse(), DocNode::parser(), qPrint(), DocTokenizer::setStateLink(), DocTokenizer::setStatePara(), DocTokenizer::setStateRef(), DocNode::thisVariant(), Token::to_string(), DocParserContext::token, DocParser::tokenizer, TRUE, Token::value(), and warn_doc_error.

Referenced by parse().

Member Data Documentation

◆ m_attribs

HtmlAttribList DocHtmlDescTitle::m_attribs
private

Definition at line 890 of file docnode.h.

Referenced by attribs(), and DocHtmlDescTitle().


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