Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
Parameter Class Reference

The Parameter class describes one function parameter. More...

#include <parameter.h>

Collaboration diagram for Parameter:

Public Member Functions

 Parameter ()=default
 Parameter (QString type, QString name=QString(), QString defaultValue=QString())
void setName (const QString &name)
bool hasType () const
const QStringtype () const
const QStringname () const
const QStringdefaultValue () const
void setDefaultValue (const QString &t)
void set (const QString &type, const QString &name, const QString &defaultValue=QString())
QString signature (bool includeValue=false) const
 Reconstructs the text signature for the parameter and returns it.
qsizetype nameInsertionPoint () const
 Returns the position within the type string where the parameter name should be inserted, or -1 if the name belongs at the end.
const QStringcanonicalType () const
void setCanonicalType (const QString &t)

Detailed Description

The Parameter class describes one function parameter.

A parameter can be a function parameter or a macro parameter. It has a name, a data type, and an optional default value. These are all stored as strings so they can be compared with a parameter in a function signature to find a match.

Definition at line 13 of file parameter.h.

Constructor & Destructor Documentation

◆ Parameter() [1/2]

Parameter::Parameter ( )
default

◆ Parameter() [2/2]

Parameter::Parameter ( QString type,
QString name = QString(),
QString defaultValue = QString() )
inlineexplicit

Definition at line 17 of file parameter.h.

References Parameter().

Referenced by Parameter().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ canonicalType()

const QString & Parameter::canonicalType ( ) const
inlinenodiscard

Definition at line 39 of file parameter.h.

◆ defaultValue()

const QString & Parameter::defaultValue ( ) const
inlinenodiscard

Definition at line 26 of file parameter.h.

◆ hasType()

bool Parameter::hasType ( ) const
inlinenodiscard

Definition at line 23 of file parameter.h.

◆ name()

const QString & Parameter::name ( ) const
inlinenodiscard

Definition at line 25 of file parameter.h.

◆ nameInsertionPoint()

qsizetype Parameter::nameInsertionPoint ( ) const
nodiscard

Returns the position within the type string where the parameter name should be inserted, or -1 if the name belongs at the end.

For types with inside-out declarator syntax (such as references to arrays, pointers to functions, or pointers to members), the parameter name must be inserted inside the type rather than appended after it. Clang produces types like "const char (&)[Size]" or "void (Cls::*)(int)" where the name belongs before the closing paren: "const char (&data)[Size]", "void (Cls::*cb)(int)".

Definition at line 38 of file parameter.cpp.

◆ set()

void Parameter::set ( const QString & type,
const QString & name,
const QString & defaultValue = QString() )
inline

Definition at line 29 of file parameter.h.

◆ setCanonicalType()

void Parameter::setCanonicalType ( const QString & t)
inline

Definition at line 40 of file parameter.h.

◆ setDefaultValue()

void Parameter::setDefaultValue ( const QString & t)
inline

Definition at line 27 of file parameter.h.

◆ setName()

void Parameter::setName ( const QString & name)
inline

Definition at line 22 of file parameter.h.

◆ signature()

QString Parameter::signature ( bool includeValue = false) const
nodiscard

Reconstructs the text signature for the parameter and returns it.

If includeValue is true and there is a default value, the default value is appended with '='.

Definition at line 53 of file parameter.cpp.

◆ type()

const QString & Parameter::type ( ) const
inlinenodiscard

Definition at line 24 of file parameter.h.


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