QGIS API Documentation 4.3.0-Master (bd2f5e21fd1)
Loading...
Searching...
No Matches
QgsEsriArcadeMemberAccessExpression Class Reference

Represents a member access expression using dot or bracket notation. More...

#include <qgsesriarcadescript.h>

Inheritance diagram for QgsEsriArcadeMemberAccessExpression:

Public Member Functions

 QgsEsriArcadeMemberAccessExpression (QgsEsriArcadeExpression *containerExpression, const QString &memberName, bool isSafeAccess=false)
 Constructor for QgsEsriArcadeMemberAccessExpression.
void accept (QgsEsriArcadeVisitor &visitor) const override
 Accepts a visitor to traverse the node.
QgsEsriArcadeNode * clone () const override
 Creates a copy of the node.
QgsEsriArcadeExpression * containerExpression () const
 Returns the container expression being accessed.
QString dump () const override
 Returns the formatted script representation of the node.
bool isSafeAccess () const
 Returns true if member access uses the safe access operator "?.".
QString memberName () const
 Returns the member attribute name.
QgsEsriArcadeNode::NodeType nodeType () const override
 Returns the node type.
void setIsSafeAccess (bool isSafeAccess)
 Sets whether member access uses the safe access operator "?.".
Public Member Functions inherited from QgsEsriArcadeExpression
 ~QgsEsriArcadeExpression () override=default
Public Member Functions inherited from QgsEsriArcadeNode
virtual ~QgsEsriArcadeNode ()=default

Additional Inherited Members

Public Types inherited from QgsEsriArcadeNode
enum class  NodeType {
  BlockStatement , VariableDeclarationStatement , ReturnStatement , AssignmentStatement ,
  FunctionDeclarationStatement , ExpressionStatement , LiteralExpression , VariableReferenceExpression ,
  ProfileVariableReferenceExpression , MemberAccessExpression , BinaryOperatorExpression , UnaryOperatorExpression ,
  FunctionCallExpression , IndexExpression , ArrayLiteralExpression , DictionaryLiteralExpression ,
  IfStatement , ForStatement , ForInStatement , WhileStatement ,
  BreakStatement , ContinueStatement
}
 Node type identifier. More...

Detailed Description

Represents a member access expression using dot or bracket notation.

For example $feature.ATTRIBUTE. or my_dict["ATTRIBUTE"] for accessing members of a dictionary.

Arcade also supports a "?." accessor which performs a "safe access", where null values are returned when the container itself is null. For these "?." forms isSafeAccess() will return true.

Since
QGIS 4.4

Definition at line 632 of file qgsesriarcadescript.h.

Constructor & Destructor Documentation

◆ QgsEsriArcadeMemberAccessExpression()

QgsEsriArcadeMemberAccessExpression::QgsEsriArcadeMemberAccessExpression ( QgsEsriArcadeExpression * containerExpression,
const QString & memberName,
bool isSafeAccess = false )

Constructor for QgsEsriArcadeMemberAccessExpression.

Ownership of containerExpression is transferred to this expression.

Definition at line 325 of file qgsesriarcadescript.cpp.

Member Function Documentation

◆ accept()

void QgsEsriArcadeMemberAccessExpression::accept ( QgsEsriArcadeVisitor & visitor) const
overridevirtual

Accepts a visitor to traverse the node.

Implements QgsEsriArcadeNode.

Definition at line 342 of file qgsesriarcadescript.cpp.

◆ clone()

QgsEsriArcadeNode * QgsEsriArcadeMemberAccessExpression::clone ( ) const
overridevirtual

Creates a copy of the node.

Caller takes ownership of the returned object.

Implements QgsEsriArcadeNode.

Definition at line 336 of file qgsesriarcadescript.cpp.

◆ containerExpression()

QgsEsriArcadeExpression * QgsEsriArcadeMemberAccessExpression::containerExpression ( ) const
inline

Returns the container expression being accessed.

Definition at line 650 of file qgsesriarcadescript.h.

◆ dump()

QString QgsEsriArcadeMemberAccessExpression::dump ( ) const
overridevirtual

Returns the formatted script representation of the node.

This can be used to export a script node back to a valid Esri arcade script string.

Implements QgsEsriArcadeNode.

Definition at line 331 of file qgsesriarcadescript.cpp.

◆ isSafeAccess()

bool QgsEsriArcadeMemberAccessExpression::isSafeAccess ( ) const
inline

Returns true if member access uses the safe access operator "?.".

Definition at line 660 of file qgsesriarcadescript.h.

◆ memberName()

QString QgsEsriArcadeMemberAccessExpression::memberName ( ) const
inline

Returns the member attribute name.

Definition at line 655 of file qgsesriarcadescript.h.

◆ nodeType()

QgsEsriArcadeNode::NodeType QgsEsriArcadeMemberAccessExpression::nodeType ( ) const
inlineoverridevirtual

Returns the node type.

Implements QgsEsriArcadeNode.

Definition at line 642 of file qgsesriarcadescript.h.

◆ setIsSafeAccess()

void QgsEsriArcadeMemberAccessExpression::setIsSafeAccess ( bool isSafeAccess)
inline

Sets whether member access uses the safe access operator "?.".

Definition at line 665 of file qgsesriarcadescript.h.


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