Doxygen
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 3037 of file docnode.cpp.

3038{
3039 AUTO_TRACE();
3040 Token retval = Token::make_RetVal_OK();
3041 auto ns = AutoNodeStack(parser(),thisVariant());
3042 DocPara *par=nullptr;
3043 QCString saveCmdName = cmdName;
3044
3045 Token tok=parser()->tokenizer.lex();
3046 if (!tok.is(TokenRetval::TK_WHITESPACE))
3047 {
3048 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"expected whitespace after \\%s command",
3049 qPrint(saveCmdName));
3050 retval = Token::make_RetVal_EndParBlock();
3051 goto endparamlist;
3052 }
3054 tok=parser()->tokenizer.lex();
3055 while (tok.is(TokenRetval::TK_WORD)) /* there is a parameter name */
3056 {
3058 {
3059 int typeSeparator = parser()->context.token->name.find('#'); // explicit type position
3060 if (typeSeparator!=-1)
3061 {
3062 parser()->handleParameterType(thisVariant(),m_paramTypes,parser()->context.token->name.left(typeSeparator));
3063 parser()->context.token->name = parser()->context.token->name.mid(typeSeparator+1);
3066 if (parent() && std::holds_alternative<DocParamSect>(*parent()))
3067 {
3068 std::get<DocParamSect>(*parent()).m_hasTypeSpecifier=true;
3069 }
3070 }
3071 else
3072 {
3075 }
3076 }
3077 else if (m_type==DocParamSect::RetVal)
3078 {
3081 }
3082 //m_params.append(parser()->context.token->name);
3084 tok=parser()->tokenizer.lex();
3085 }
3087 if (tok.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) // premature end of comment
3088 {
3089 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected end of comment block while parsing the "
3090 "argument of command %s",qPrint(saveCmdName));
3091 retval = Token::make_RetVal_EndParBlock();
3092 goto endparamlist;
3093 }
3094 if (!tok.is(TokenRetval::TK_WHITESPACE)) /* premature end of comment block */
3095 {
3096 if (!tok.is(TokenRetval::TK_NEWPARA)) /* empty param description */
3097 {
3098 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unexpected token %s in comment block while parsing the "
3099 "argument of command %s",tok.to_string(),qPrint(saveCmdName));
3100 }
3101 retval = Token::make_RetVal_EndParBlock();
3102 goto endparamlist;
3103 }
3104
3105 m_paragraphs.append<DocPara>(parser(),thisVariant());
3106 par = m_paragraphs.get_last<DocPara>();
3107 retval = par->parse();
3108 par->markFirst();
3109 par->markLast();
3110
3111endparamlist:
3112 AUTO_TRACE_EXIT("retval={}",retval.to_string());
3113 return retval;
3114}
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:5459
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:74
const char * qPrint(const char *s)
Definition qcstring.h:672
#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(), qPrint(), 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 3116 of file docnode.cpp.

3117{
3118 AUTO_TRACE();
3119 Token retval = Token::make_RetVal_OK();
3120 auto ns = AutoNodeStack(parser(),thisVariant());
3121
3122 parser()->context.token->name = paramName;
3124 {
3127 }
3128 else if (m_type==DocParamSect::RetVal)
3129 {
3132 }
3133
3135
3136 do
3137 {
3138 m_paragraphs.append<DocPara>(parser(),thisVariant());
3139 DocPara *par = m_paragraphs.get_last<DocPara>();
3140 retval = par->parse();
3141 if (par->isEmpty()) // avoid adding an empty paragraph for the whitespace
3142 // after </para> and before </param>
3143 {
3144 m_paragraphs.pop_back();
3145 break;
3146 }
3147 else // append the paragraph to the list
3148 {
3149 if (!m_paragraphs.empty())
3150 {
3151 m_paragraphs.get_last<DocPara>()->markLast(FALSE);
3152 }
3153 bool markFirst = m_paragraphs.empty();
3154 par = &std::get<DocPara>(m_paragraphs.back());
3155 if (markFirst)
3156 {
3157 par->markFirst();
3158 }
3159 par->markLast();
3160 }
3161
3162 if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) break;
3163
3164 } while (retval.is(TokenRetval::RetVal_CloseXml) &&
3165 Mappers::htmlTagMapper->map(parser()->context.token->name)!=HtmlTagType::XML_PARAM &&
3166 Mappers::htmlTagMapper->map(parser()->context.token->name)!=HtmlTagType::XML_TYPEPARAM &&
3167 Mappers::htmlTagMapper->map(parser()->context.token->name)!=HtmlTagType::XML_EXCEPTION);
3168
3169 if (retval.is_any_of(TokenRetval::TK_NONE,TokenRetval::TK_EOF)) /* premature end of comment block */
3170 {
3171 warn_doc_error(parser()->context.fileName,parser()->tokenizer.getLineNr(),"unterminated param or exception tag");
3172 }
3173 else
3174 {
3175 retval = Token::make_RetVal_OK();
3176 }
3177
3178 AUTO_TRACE_EXIT("retval={}",retval.to_string());
3179 return retval;
3180}
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: