diff options
author | Martin Smith <martin.smith@digia.com> | 2015-08-06 13:47:44 +0200 |
---|---|---|
committer | Martin Smith <martin.smith@digia.com> | 2015-08-16 14:47:58 +0000 |
commit | 8c5ce68fcf09d128072c31d74878fcb0fd9b9c7a (patch) | |
tree | 7f548c676454ee99f6220e06f033a2a71f1b3af9 /src/tools/qdoc/cppcodeparser.h | |
parent | 6dde874c3203464f76170834234c026e02dc7abc (diff) |
qdoc: Allow formal parameters in link targets
This update allows qdoc to handle \l commands for linking
to functions, where the formal parameters are included in
the link target.
For example, \l {QWidget::find(QString name)} will only match
a member function of QWidget that has a single parameter of type
QString. The parameter name is not used in the search.
Change-Id: I8a31c9a7ed632f12a0e6d8a33cbb5cd361098317
Task-number: QTBUG-47286
Reviewed-by: Martin Smith <martin.smith@digia.com>
Diffstat (limited to 'src/tools/qdoc/cppcodeparser.h')
-rw-r--r-- | src/tools/qdoc/cppcodeparser.h | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/tools/qdoc/cppcodeparser.h b/src/tools/qdoc/cppcodeparser.h index 733418e27a..ec04482321 100644 --- a/src/tools/qdoc/cppcodeparser.h +++ b/src/tools/qdoc/cppcodeparser.h @@ -51,16 +51,6 @@ class CppCodeParser : public CodeParser { Q_DECLARE_TR_FUNCTIONS(QDoc::CppCodeParser) - struct ParsedParameter { - bool qPrivateSignal_; - QString dataType_; - QString name_; - QString defaultValue_; - ParsedParameter() : qPrivateSignal_(false) { } - }; - friend class QTypeInfo<ParsedParameter>; - typedef QVector<ParsedParameter> ParsedParameterList; - struct ExtraFuncData { Aggregate* root; // Used as the parent. Node::NodeType type; // The node type: Function, etc. @@ -74,6 +64,7 @@ class CppCodeParser : public CodeParser public: CppCodeParser(); ~CppCodeParser(); + static CppCodeParser* cppParser() { return cppParser_; } virtual void initializeParser(const Config& config) Q_DECL_OVERRIDE; virtual void terminateParser() Q_DECL_OVERRIDE; @@ -84,6 +75,7 @@ public: virtual void parseSourceFile(const Location& location, const QString& filePath) Q_DECL_OVERRIDE; virtual void doneParsingHeaderFiles() Q_DECL_OVERRIDE; virtual void doneParsingSourceFiles() Q_DECL_OVERRIDE; + bool parseParameters(const QString& parameters, QVector<Parameter>& pvect, bool& isQPrivateSignal); protected: const QSet<QString>& topicCommands(); @@ -126,7 +118,7 @@ protected: bool matchTemplateAngles(CodeChunk *type = 0); bool matchTemplateHeader(); bool matchDataType(CodeChunk *type, QString *var = 0); - bool matchParameter(ParsedParameterList& pplist); + bool matchParameter(QVector<Parameter>& pvect, bool& isQPrivateSignal); bool matchFunctionDecl(Aggregate *parent, QStringList *parentPathPtr, FunctionNode **funcPtr, @@ -184,10 +176,10 @@ protected: static QStringList exampleFiles; static QStringList exampleDirs; + static CppCodeParser* cppParser_; QString exampleNameFilter; QString exampleImageFilter; }; -Q_DECLARE_TYPEINFO(CppCodeParser::ParsedParameter, Q_MOVABLE_TYPE); #define COMMAND_ABSTRACT Doc::alias("abstract") #define COMMAND_CLASS Doc::alias("class") |