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
Parameters Class Reference

A class for parsing and managing a function parameter list. More...

#include <parameters.h>

Collaboration diagram for Parameters:

Public Member Functions

 Parameters ()
 Parameters (const QString &signature)
void clear ()
const ParameterVectorparameters () const
bool isPrivateSignal () const
bool isEmpty () const
bool isValid () const
int count () const
void reserve (int count)
const Parameterat (int i) const
Parameterlast ()
const Parameterlast () const
Parameteroperator[] (int index)
void append (const QString &type, const QString &name, const QString &value)
 Append a Parameter constructed from type, name, and value to the parameter vector.
void append (const QString &type, const QString &name)
void append (const QString &type)
void pop_back ()
void setPrivateSignal ()
QString signature (bool includeValues=false) const
 Returns the list of reconstructed parameters.
QString rawSignature (bool names=false, bool values=false) const
 Returns the signature of all the parameters with all the spaces and commas removed.
void set (const QString &signature)
 Parse the parameter signature by splitting the string, and store the individual parameters in the parameter vector.
QSet< QStringgetNames () const
 Insert all the parameter names into names.
QString generateTypeList () const
 Construct a list of the parameter types and return it.
QString generateTypeAndNameList () const
 Construct a list of the parameter type/name pairs and return it.
bool match (const Parameters &parameters) const
 Returns true if parameters contains the same parameter signature as this.

Public Attributes

std::optional< QStringargAppPath
QString appWasmPath
std::optional< QDirqtHostDir
std::optional< QDirqtWasmDir
QList< QDirlibPaths
std::optional< QDirqmlRootPath
QSet< QStringloadedQtLibraries

Detailed Description

A class for parsing and managing a function parameter list.

The constructor is passed a string that is the text inside the parentheses of a function declaration. The constructor parses the parameter list into a vector of class Parameter.

The Parameters object is then used in function searches to find the correct function node given the function name and the signature of its parameters.

Definition at line 27 of file main.cpp.

Constructor & Destructor Documentation

◆ Parameters() [1/2]

Parameters::Parameters ( )

Definition at line 63 of file parameters.cpp.

◆ Parameters() [2/2]

Parameters::Parameters ( const QString & signature)

Definition at line 68 of file parameters.cpp.

Member Function Documentation

◆ append() [1/3]

void Parameters::append ( const QString & type)
inline

Definition at line 80 of file parameters.h.

◆ append() [2/3]

void Parameters::append ( const QString & type,
const QString & name )
inline

Definition at line 79 of file parameters.h.

◆ append() [3/3]

void Parameters::append ( const QString & type,
const QString & name,
const QString & value )

Append a Parameter constructed from type, name, and value to the parameter vector.

Definition at line 390 of file parameters.cpp.

◆ at()

const Parameter & Parameters::at ( int i) const
inlinenodiscard

Definition at line 74 of file parameters.h.

Referenced by Aggregate::findFunctionChild(), DocBookGenerator::generateDocBookSynopsis(), CppCodeMarker::markedUpQmlItem(), CppCodeMarker::markedUpSynopsis(), and match().

Here is the caller graph for this function:

◆ clear()

void Parameters::clear ( )
inline

Definition at line 62 of file parameters.h.

Referenced by QmlSignatureParser::matchFunctionDecl(), and set().

Here is the caller graph for this function:

◆ count()

int Parameters::count ( ) const
inlinenodiscard

Definition at line 72 of file parameters.h.

Referenced by FunctionNode::compare, Aggregate::findFunctionChild(), DocBookGenerator::generateDocBookSynopsis(), generateTypeAndNameList(), generateTypeList(), CppCodeMarker::markedUpQmlItem(), CppCodeMarker::markedUpSynopsis(), match(), and FnCommandParser::operator()().

Here is the caller graph for this function:

◆ generateTypeAndNameList()

QString Parameters::generateTypeAndNameList ( ) const
nodiscard

Construct a list of the parameter type/name pairs and return it.

Definition at line 509 of file parameters.cpp.

References count().

Here is the call graph for this function:

◆ generateTypeList()

QString Parameters::generateTypeList ( ) const
nodiscard

Construct a list of the parameter types and return it.

Definition at line 492 of file parameters.cpp.

References count().

Here is the call graph for this function:

◆ getNames()

QSet< QString > Parameters::getNames ( ) const
nodiscard

Insert all the parameter names into names.

Definition at line 478 of file parameters.cpp.

◆ isEmpty()

bool Parameters::isEmpty ( ) const
inlinenodiscard

Definition at line 70 of file parameters.h.

Referenced by Aggregate::findFunctionChild(), DocBookGenerator::generateDocBookSynopsis(), CppCodeMarker::markedUpQmlItem(), and CppCodeMarker::markedUpSynopsis().

Here is the caller graph for this function:

◆ isPrivateSignal()

bool Parameters::isPrivateSignal ( ) const
inlinenodiscard

Definition at line 69 of file parameters.h.

Referenced by CodeMarker::extraSynopsis(), and FunctionNode::isPrivateSignal().

Here is the caller graph for this function:

◆ isValid()

bool Parameters::isValid ( ) const
inlinenodiscard

Definition at line 71 of file parameters.h.

◆ last() [1/2]

Parameter & Parameters::last ( )
inline

Definition at line 75 of file parameters.h.

◆ last() [2/2]

const Parameter & Parameters::last ( ) const
inlinenodiscard

Definition at line 76 of file parameters.h.

◆ match()

bool Parameters::match ( const Parameters & parameters) const
nodiscard

Returns true if parameters contains the same parameter signature as this.

Definition at line 530 of file parameters.cpp.

References at(), and count().

Here is the call graph for this function:

◆ operator[]()

Parameter & Parameters::operator[] ( int index)
inline

Definition at line 77 of file parameters.h.

Referenced by FnCommandParser::operator()().

Here is the caller graph for this function:

◆ parameters()

const ParameterVector & Parameters::parameters ( ) const
inlinenodiscard

Definition at line 68 of file parameters.h.

◆ pop_back()

void Parameters::pop_back ( )
inline

Definition at line 81 of file parameters.h.

◆ rawSignature()

QString Parameters::rawSignature ( bool names = false,
bool values = false ) const
nodiscard

Returns the signature of all the parameters with all the spaces and commas removed.

It is unintelligible, but that is what the caller wants.

If names is true, the parameter names are included. If values is true, the default values are included.

Definition at line 420 of file parameters.cpp.

◆ reserve()

void Parameters::reserve ( int count)
inline

Definition at line 73 of file parameters.h.

◆ set()

void Parameters::set ( const QString & signature)

Parse the parameter signature by splitting the string, and store the individual parameters in the parameter vector.

This method of parsing is naive but sufficient for QML methods and macros.

Definition at line 441 of file parameters.cpp.

References clear().

Here is the call graph for this function:

◆ setPrivateSignal()

void Parameters::setPrivateSignal ( )
inline

Definition at line 82 of file parameters.h.

◆ signature()

QString Parameters::signature ( bool includeValues = false) const
nodiscard

Returns the list of reconstructed parameters.

If includeValues is true, the default values are included, if any are present.

Definition at line 399 of file parameters.cpp.

Member Data Documentation

◆ appWasmPath

QString Parameters::appWasmPath

Definition at line 30 of file main.cpp.

◆ argAppPath

std::optional< QString > Parameters::argAppPath

Definition at line 29 of file main.cpp.

◆ libPaths

QList< QDir > Parameters::libPaths

Definition at line 33 of file main.cpp.

◆ loadedQtLibraries

QSet< QString > Parameters::loadedQtLibraries

Definition at line 36 of file main.cpp.

◆ qmlRootPath

std::optional< QDir > Parameters::qmlRootPath

Definition at line 34 of file main.cpp.

◆ qtHostDir

std::optional< QDir > Parameters::qtHostDir

Definition at line 31 of file main.cpp.

◆ qtWasmDir

std::optional< QDir > Parameters::qtWasmDir

Definition at line 32 of file main.cpp.


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