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 1104 of file docnode.h.

Constructor & Destructor Documentation

◆ DocParamList()

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

Definition at line 1107 of file docnode.h.

1108 : 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:1126
DocParamSect::Type m_type
Definition docnode.h:1125

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 1116 of file docnode.h.

1116{ return m_isFirst; }
bool m_isFirst
Definition docnode.h:1127

References m_isFirst.

◆ isLast()

bool DocParamList::isLast ( ) const
inline

Definition at line 1117 of file docnode.h.

1117{ return m_isLast; }
bool m_isLast
Definition docnode.h:1128

References m_isLast.

Referenced by ManDocVisitor::operator()().

◆ markFirst()

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

Definition at line 1114 of file docnode.h.

1114{ m_isFirst=b; }

References m_isFirst.

Referenced by parseXml().

◆ markLast()

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

Definition at line 1115 of file docnode.h.

1115{ m_isLast=b; }

References m_isLast.

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

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

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

1112{ return m_type; }

References m_type.

Member Data Documentation

◆ m_dir

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

Definition at line 1126 of file docnode.h.

Referenced by direction(), and DocParamList().

◆ m_isFirst

bool DocParamList::m_isFirst = false
private

Definition at line 1127 of file docnode.h.

Referenced by isFirst(), and markFirst().

◆ m_isLast

bool DocParamList::m_isLast = false
private

Definition at line 1128 of file docnode.h.

Referenced by isLast(), and markLast().

◆ m_paragraphs

DocNodeList DocParamList::m_paragraphs
private

Definition at line 1122 of file docnode.h.

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

◆ m_params

DocNodeList DocParamList::m_params
private

Definition at line 1123 of file docnode.h.

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

◆ m_paramTypes

DocNodeList DocParamList::m_paramTypes
private

Definition at line 1124 of file docnode.h.

Referenced by paramTypes(), and parse().

◆ m_type

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

Definition at line 1125 of file docnode.h.

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


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