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 2240 of file docnode.cpp.

2241{
2242 AUTO_TRACE();
2243 Token retval = Token::make_TK_NONE();
2244 auto ns = AutoNodeStack(parser(),thisVariant());
2245
2246 Token tok = parser()->tokenizer.lex();
2247 while (!tok.is_any_of(TokenRetval::TK_NONE, TokenRetval::TK_EOF))
2248 {
2249 if (!parser()->defaultHandleToken(thisVariant(),tok,children()))
2250 {
2251 switch (tok.value())
2252 {
2253 case TokenRetval::TK_COMMAND_AT:
2254 // fall through
2255 case TokenRetval::TK_COMMAND_BS:
2256 {
2257 QCString cmdName=parser()->context.token->name;
2258 bool isJavaLink=FALSE;
2259 switch (Mappers::cmdMapper->map(cmdName))
2260 {
2262 {
2263 tok=parser()->tokenizer.lex();
2264 if (!tok.is(TokenRetval::TK_WHITESPACE))
2265 {
2266 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after '{:c}{}' command",
2267 tok.command_to_char(),cmdName);
2268 }
2269 else
2270 {
2272 tok=parser()->tokenizer.lex(); // get the reference id
2273 if (!tok.is(TokenRetval::TK_WORD))
2274 {
2275 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected token {} as the argument of '{:c}{}' command",
2276 tok.to_string(),tok.command_to_char(),cmdName);
2277 }
2278 else
2279 {
2281 children().get_last<DocRef>()->parse();
2282 }
2284 }
2285 }
2286 break;
2288 isJavaLink=TRUE;
2289 // fall through
2291 {
2292 tok=parser()->tokenizer.lex();
2293 if (!tok.is(TokenRetval::TK_WHITESPACE))
2294 {
2295 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after \\{} command",
2296 cmdName);
2297 }
2298 else
2299 {
2301 tok=parser()->tokenizer.lex();
2302 if (!tok.is(TokenRetval::TK_WORD))
2303 {
2304 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected token {} as the argument of \\{} command",
2305 tok.to_string(),cmdName);
2306 }
2307 else
2308 {
2311 DocLink *lnk = children().get_last<DocLink>();
2312 QCString leftOver = lnk->parse(isJavaLink);
2313 if (!leftOver.isEmpty())
2314 {
2315 children().append<DocWord>(parser(),thisVariant(),leftOver);
2316 }
2317 }
2318 }
2319 }
2320
2321 break;
2322 default:
2323 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Illegal command '{:c}{}' found as part of a <dt> tag",
2324 tok.command_to_char(),cmdName);
2325 }
2326 }
2327 break;
2328 case TokenRetval::TK_SYMBOL:
2329 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unsupported symbol '{}' found as part of a <dt> tag",
2330 parser()->context.token->name);
2331 break;
2332 case TokenRetval::TK_HTMLTAG:
2333 {
2334 HtmlTagType tagId=Mappers::htmlTagMapper->map(parser()->context.token->name);
2335 if (tagId==HtmlTagType::HTML_DD && !parser()->context.token->endTag) // found <dd> tag
2336 {
2337 retval = Token::make_RetVal_DescData();
2338 goto endtitle;
2339 }
2340 else if (tagId==HtmlTagType::HTML_DT && parser()->context.token->endTag)
2341 {
2342 // ignore </dt> tag.
2343 }
2344 else if (tagId==HtmlTagType::HTML_DT)
2345 {
2346 // missing <dt> tag.
2347 retval = Token::make_RetVal_DescTitle();
2348 goto endtitle;
2349 }
2350 else if (tagId==HtmlTagType::HTML_DL && parser()->context.token->endTag)
2351 {
2352 retval = Token::make_RetVal_EndDesc();
2353 goto endtitle;
2354 }
2355 else if (tagId==HtmlTagType::HTML_A)
2356 {
2357 if (!parser()->context.token->endTag)
2358 {
2359 parser()->handleAHref(thisVariant(),children(),parser()->context.token->attribs);
2360 }
2361 }
2362 else
2363 {
2364 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected html tag <{}{}> found within <dt> context",
2365 parser()->context.token->endTag?"/":"",parser()->context.token->name);
2366 }
2367 }
2368 break;
2369 default:
2370 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected token {} found as part of a <dt> tag",
2371 tok.to_string());
2372 break;
2373 }
2374 }
2375 tok = parser()->tokenizer.lex();
2376 }
2377 if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF))
2378 {
2379 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"Unexpected end of comment while inside"
2380 " <dt> tag");
2381 }
2382endtitle:
2384 return retval;
2385}
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:112
const Mapper< HtmlTagType > * htmlTagMapper
const Mapper< CommandType > * cmdMapper
#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(), 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: