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

Node representing a parameter list. More...

#include <src/docnode.h>

+ Inheritance diagram for DocParamList:
+ Collaboration diagram for DocParamList:

Public Member Functions

 DocParamList (DocParser *parser, DocNodeVariant *parent, DocParamSect::Type t, DocParamSect::Direction d)
 
const DocNodeListparameters () const
 
const DocNodeListparamTypes () const
 
const DocNodeListparagraphs () const
 
DocParamSect::Type type () const
 
DocParamSect::Direction direction () const
 
void markFirst (bool b=TRUE)
 
void markLast (bool b=TRUE)
 
bool isFirst () const
 
bool isLast () const
 
Token parse (const QCString &cmdName)
 
Token parseXml (const QCString &paramName)
 
- 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

DocNodeList m_paragraphs
 
DocNodeList m_params
 
DocNodeList m_paramTypes
 
DocParamSect::Type m_type = DocParamSect::Unknown
 
DocParamSect::Direction m_dir = DocParamSect::Unspecified
 
bool m_isFirst = false
 
bool m_isLast = false
 

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 parameter list.

Definition at line 1118 of file docnode.h.

Constructor & Destructor Documentation

◆ DocParamList()

DocParamList::DocParamList ( DocParser * parser,
DocNodeVariant * parent,
DocParamSect::Type t,
DocParamSect::Direction d )
inline

Definition at line 1121 of file docnode.h.

1122 : DocNode(parser,parent), m_type(t), m_dir(d) {}
DocNode(DocParser *parser, DocNodeVariant *parent)
Definition docnode.h:84
DocParser * parser()
Definition docnode.h:97
DocNodeVariant * parent()
Definition docnode.h:89
DocParamSect::Direction m_dir
Definition docnode.h:1140
DocParamSect::Type m_type
Definition docnode.h:1139

References DocNode::DocNode(), m_dir, m_type, DocNode::parent(), and DocNode::parser().

Member Function Documentation

◆ direction()

◆ isFirst()

bool DocParamList::isFirst ( ) const
inline

Definition at line 1130 of file docnode.h.

1130{ return m_isFirst; }
bool m_isFirst
Definition docnode.h:1141

References m_isFirst.

◆ isLast()

bool DocParamList::isLast ( ) const
inline

Definition at line 1131 of file docnode.h.

1131{ return m_isLast; }
bool m_isLast
Definition docnode.h:1142

References m_isLast.

Referenced by ManDocVisitor::operator()().

◆ markFirst()

void DocParamList::markFirst ( bool b = TRUE)
inline

Definition at line 1128 of file docnode.h.

1128{ m_isFirst=b; }

References m_isFirst, and TRUE.

Referenced by parseXml().

◆ markLast()

void DocParamList::markLast ( bool b = TRUE)
inline

Definition at line 1129 of file docnode.h.

1129{ m_isLast=b; }

References m_isLast, and TRUE.

Referenced by DocParamSect::parse(), and parseXml().

◆ paragraphs()

◆ parameters()

◆ paramTypes()

const DocNodeList & DocParamList::paramTypes ( ) const
inline

◆ parse()

Token DocParamList::parse ( const QCString & cmdName)

Definition at line 3046 of file docnode.cpp.

3047{
3048 AUTO_TRACE();
3049 Token retval = Token::make_RetVal_OK();
3050 auto ns = AutoNodeStack(parser(),thisVariant());
3051 DocPara *par=nullptr;
3052 QCString saveCmdName = cmdName;
3053
3054 Token tok=parser()->tokenizer.lex();
3055 if (!tok.is(TokenRetval::TK_WHITESPACE))
3056 {
3057 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after \\{} command",
3058 saveCmdName);
3059 retval = Token::make_RetVal_EndParBlock();
3060 goto endparamlist;
3061 }
3063 tok=parser()->tokenizer.lex();
3064 while (tok.is(TokenRetval::TK_WORD)) /* there is a parameter name */
3065 {
3067 {
3068 int typeSeparator = parser()->context.token->name.find('#'); // explicit type position
3069 if (typeSeparator!=-1)
3070 {
3071 parser()->handleParameterType(thisVariant(),m_paramTypes,parser()->context.token->name.left(typeSeparator));
3072 parser()->context.token->name = parser()->context.token->name.mid(typeSeparator+1);
3075 if (parent() && std::holds_alternative<DocParamSect>(*parent()))
3076 {
3077 std::get<DocParamSect>(*parent()).m_hasTypeSpecifier=true;
3078 }
3079 }
3080 else
3081 {
3084 }
3085 }
3086 else if (m_type==DocParamSect::RetVal)
3087 {
3090 }
3091 //m_params.append(parser()->context.token->name);
3093 tok=parser()->tokenizer.lex();
3094 }
3096 if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) // premature end of comment
3097 {
3098 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected end of comment block while parsing the "
3099 "argument of command {}",saveCmdName);
3100 retval = Token::make_RetVal_EndParBlock();
3101 goto endparamlist;
3102 }
3103 if (!tok.is(TokenRetval::TK_WHITESPACE)) /* premature end of comment block */
3104 {
3105 if (!tok.is(TokenRetval::TK_NEWPARA)) /* empty param description */
3106 {
3107 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected token {} in comment block while parsing the "
3108 "argument of command {}",tok.to_string(),saveCmdName);
3109 }
3110 retval = Token::make_RetVal_EndParBlock();
3111 goto endparamlist;
3112 }
3113
3114 m_paragraphs.append<DocPara>(parser(),thisVariant());
3115 par = m_paragraphs.get_last<DocPara>();
3116 retval = par->parse();
3117 par->markFirst();
3118 par->markLast();
3119
3120endparamlist:
3121 AUTO_TRACE_EXIT("retval={}",retval.to_string());
3122 return retval;
3123}
DocNodeVariant * thisVariant()
Definition docnode.h:92
void markLast(bool v=TRUE)
Definition docnode.h:1080
void markFirst(bool v=TRUE)
Definition docnode.h:1079
Token parse()
Definition docnode.cpp:5467
void handleLinkedWord(DocNodeVariant *parent, DocNodeList &children, bool ignoreAutoLinkFlag=FALSE)
DocTokenizer tokenizer
void handleParameterType(DocNodeVariant *parent, DocNodeList &children, const QCString &paramTypes)
void checkRetvalName()
void checkArgumentName()
DocParserContext context
void setStateParam()
void setStatePara()
int find(char c, int index=0, bool cs=TRUE) const
Definition qcstring.cpp:43
QCString mid(size_t index, size_t len=static_cast< size_t >(-1)) const
Definition qcstring.h:226
bool is(TokenRetval rv) const
TOKEN_SPECIFICATIONS RETVAL_SPECIFICATIONS const char * to_string() const
bool is_any_of(ARGS... args) const
#define AUTO_TRACE(...)
Definition docnode.cpp:46
#define AUTO_TRACE_EXIT(...)
Definition docnode.cpp:48
#define warn_doc_error(file, line, fmt,...)
Definition message.h:112
#define TRUE
Definition qcstring.h:37
TokenInfo * token
Definition docparser_p.h:92
QCString name

References AUTO_TRACE, AUTO_TRACE_EXIT, DocParser::checkArgumentName(), DocParser::checkRetvalName(), DocParser::context, QCString::find(), DocParser::handleLinkedWord(), DocParser::handleParameterType(), DocParserContext::hasParamCommand, DocParserContext::hasReturnCommand, Token::is(), Token::is_any_of(), DocTokenizer::lex(), m_paragraphs, m_params, m_paramTypes, m_type, DocPara::markFirst(), DocPara::markLast(), QCString::mid(), TokenInfo::name, DocParamSect::Param, DocNode::parent(), DocPara::parse(), DocNode::parser(), DocParamSect::RetVal, DocTokenizer::setStatePara(), DocTokenizer::setStateParam(), DocNode::thisVariant(), Token::to_string(), DocParserContext::token, DocParser::tokenizer, TRUE, and warn_doc_error.

◆ parseXml()

Token DocParamList::parseXml ( const QCString & paramName)

Definition at line 3125 of file docnode.cpp.

3126{
3127 AUTO_TRACE();
3128 Token retval = Token::make_RetVal_OK();
3129 auto ns = AutoNodeStack(parser(),thisVariant());
3130
3131 parser()->context.token->name = paramName;
3133 {
3136 }
3137 else if (m_type==DocParamSect::RetVal)
3138 {
3141 }
3142
3144
3145 do
3146 {
3147 m_paragraphs.append<DocPara>(parser(),thisVariant());
3148 DocPara *par = m_paragraphs.get_last<DocPara>();
3149 retval = par->parse();
3150 if (par->isEmpty()) // avoid adding an empty paragraph for the whitespace
3151 // after </para> and before </param>
3152 {
3153 m_paragraphs.pop_back();
3154 break;
3155 }
3156 else // append the paragraph to the list
3157 {
3158 if (!m_paragraphs.empty())
3159 {
3160 m_paragraphs.get_last<DocPara>()->markLast(FALSE);
3161 }
3162 bool markFirst = m_paragraphs.empty();
3163 par = &std::get<DocPara>(m_paragraphs.back());
3164 if (markFirst)
3165 {
3166 par->markFirst();
3167 }
3168 par->markLast();
3169 }
3170
3171 if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) break;
3172
3173 } while (retval.is(TokenRetval::RetVal_CloseXml) &&
3174 Mappers::htmlTagMapper->map(parser()->context.token->name)!=HtmlTagType::XML_PARAM &&
3175 Mappers::htmlTagMapper->map(parser()->context.token->name)!=HtmlTagType::XML_TYPEPARAM &&
3176 Mappers::htmlTagMapper->map(parser()->context.token->name)!=HtmlTagType::XML_EXCEPTION);
3177
3178 if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) /* premature end of comment block */
3179 {
3180 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unterminated param or exception tag");
3181 }
3182 else
3183 {
3184 retval = Token::make_RetVal_OK();
3185 }
3186
3187 AUTO_TRACE_EXIT("retval={}",retval.to_string());
3188 return retval;
3189}
void markFirst(bool b=TRUE)
Definition docnode.h:1128
void markLast(bool b=TRUE)
Definition docnode.h:1129
const Mapper< HtmlTagType > * htmlTagMapper
#define FALSE
Definition qcstring.h:34

References AUTO_TRACE, AUTO_TRACE_EXIT, DocParser::checkArgumentName(), DocParser::checkRetvalName(), DocParser::context, FALSE, DocParser::handleLinkedWord(), DocParserContext::hasParamCommand, DocParserContext::hasReturnCommand, Mappers::htmlTagMapper, Token::is(), Token::is_any_of(), m_paragraphs, m_params, m_type, markFirst(), markLast(), TokenInfo::name, DocParamSect::Param, DocNode::parser(), DocParamSect::RetVal, DocNode::thisVariant(), Token::to_string(), DocParserContext::token, TRUE, warn_doc_error, XML_EXCEPTION, XML_PARAM, and XML_TYPEPARAM.

◆ type()

DocParamSect::Type DocParamList::type ( ) const
inline

Definition at line 1126 of file docnode.h.

1126{ return m_type; }

References m_type.

Member Data Documentation

◆ m_dir

DocParamSect::Direction DocParamList::m_dir = DocParamSect::Unspecified
private

Definition at line 1140 of file docnode.h.

Referenced by direction(), and DocParamList().

◆ m_isFirst

bool DocParamList::m_isFirst = false
private

Definition at line 1141 of file docnode.h.

Referenced by isFirst(), and markFirst().

◆ m_isLast

bool DocParamList::m_isLast = false
private

Definition at line 1142 of file docnode.h.

Referenced by isLast(), and markLast().

◆ m_paragraphs

DocNodeList DocParamList::m_paragraphs
private

Definition at line 1136 of file docnode.h.

Referenced by paragraphs(), parse(), and parseXml().

◆ m_params

DocNodeList DocParamList::m_params
private

Definition at line 1137 of file docnode.h.

Referenced by parameters(), parse(), and parseXml().

◆ m_paramTypes

DocNodeList DocParamList::m_paramTypes
private

Definition at line 1138 of file docnode.h.

Referenced by paramTypes(), and parse().

◆ m_type

DocParamSect::Type DocParamList::m_type = DocParamSect::Unknown
private

Definition at line 1139 of file docnode.h.

Referenced by DocParamList(), parse(), parseXml(), and type().


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