Cpp.QualifiedIdentifier Class
Namespace: Cpp
Superclasses: AstNodeProperties
Represents the qualified_identifier nodes in the syntax tree of your code
Since R2026a
Description
The PQL class QualifiedIdentifier represents the node
qualified_identifier in the syntax tree of your code.
#include <vector> std::vector<int> v;
The code contains the std::vector qualified identifier.
Predicates
| Type | Raisable | Printable |
|---|---|---|
QualifiedIdentifier
| Yes | Yes |
This class defines these predicates that act on the objects of this class. In addition, objects of this class can access the predicates defined by the base class AstNodeProperties. An object of this class is an object of AstNodeProperties class.
| Predicates | Description | Example |
|---|---|---|
is(required QualifiedIdentifier &qi)
| Checks that a syntax node is a qualified_identifier and returns it as qi for further inspection. |
This PQL defect checks for any defect find_qi =
when
Cpp.QualifiedIdentifier.is(&qi)
and qi.nodeText(&txt)
raise "Found qualified id: \"{txt}\""
on qiIn this C++ code, the defect checks for the
#include <vector>
std::vector<int> v; // qualified_identifier: "std::vector"
int main(){ return 0; } |
cast(Cpp.Node.Node node, required QualifiedIdentifier &cast)
| Tests whether a generic Cpp.Node.Node is actually a qualified_identifier and, if so, returns it as cast for further predicates. | This PQL defect checks whether an arbitrary
defect cast_qi =
when
Cpp.Node.is(&node, &,&,&)
and Cpp.QualifiedIdentifier.cast(node, &qi)
and qi.nodeText(&txt)
raise "Cast to qualified id: \"{txt}\""
on qiIn this C++ code, the defect finds a
#include <vector>
std::vector<int> v;
int main(){ return 0; } |
isa(Cpp.Node.Node node)
| Returns true if the given Cpp.Node.Node is a qualified_identifier. Useful for conditional checks or negation. | This PQL defect checks for a generic node that is a
defect isa_qi =
when
Cpp.Node.is(&node, &,&,&)
and Cpp.QualifiedIdentifier.isa(node)
and node.nodeText(&txt)
raise "Node is a qualified id: \"{txt}\""
on nodeIn this C++ code, the defect identifies the
#include <map>
std::map<int,int> m;
int main(){ return 0; } |
name(QualifiedIdentifier self, Cpp.Node.Node &child)
| Matches the rightmost identifier in the qualified_identifier
and returns it as child. |
This PQL defect checks for the defect qi_name =
when
Cpp.QualifiedIdentifier.is(&qi)
and qi.name(&name)
and name.nodeText(&txt)
raise "Qualified id name: \"{txt}\""
on nameIn this C++ code, the defect targets the
#include <vector>
std::vector<int> v; // name: "vector"
int main(){ return 0; } |
scope(QualifiedIdentifier self, Cpp.Node.Node &child)
| Matches the left-side scope portion(s) of the
qualified_identifier and returns that node as
child. |
This PQL defect checks for the scope portion of a defect qi_scope =
when
Cpp.QualifiedIdentifier.is(&qi)
and qi.scope(&scope)
and scope.nodeText(&txt)
raise "Qualified id scope: \"{txt}\""
on scopeIn this C++ code, the defect finds the
#include <vector>
std::vector<int> v; // scope: "std"
int main(){ return 0; } |
getEnclosingQualifiedIdentifier(Cpp.Node.Node child, required QualifiedIdentifier &parent)
| Finds the nearest parent qualified_identifier of the given
child node and returns it as parent. | This PQL defect checks for the nearest parent
defect enclosing_qi =
when
Cpp.Node.is(&inner, &,&,&)
and Cpp.QualifiedIdentifier.getEnclosingQualifiedIdentifier(inner, &parent)
and parent.nodeText(&txt)
raise "Enclosing qualified id: \"{txt}\""
on parentIn this C++ code, the defect find the
#include <vector>
std::vector<int> v; // enclosing qualified_identifier around "int"
int main(){ return 0; } |
isEnclosedInQualifiedIdentifier(Cpp.Node.Node child)
| Matches any qualified_identifier ancestor parent of the given child node (not only the nearest), allowing inspection of all enclosing qualified identifiers. | This PQL defect checks for any defect any_enclosing_qi =
when
Cpp.Node.is(&inner, &,&,&)
and Cpp.QualifiedIdentifier.isEnclosedInQualifiedIdentifier(inner)
and inner.nodeText(&txt)
raise "Node has ancestor qualified id: \"{txt}\""
on innerIn this C++ code, the defect will find every qualified identifier that encloses a child node.
#include <type_traits>
using my_t = std::vector<int>; //matches std::vector
static_assert(std::is_same_v<my_t, std::vector<int>>); // matches std::is_same_v and std::vector
int main(){ return 0; } |
Version History
Introduced in R2026a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)