Cpp.TranslationUnit Class
Namespace: Cpp
Superclasses: AstNodeProperties
Represents the translation_unit nodes in the syntax tree of your code
Since R2026a
Description
TranslationUnit class represents the C++ syntax node translation_unit in your code and contains predicates to query properties and children of this node.
Predicates
| Type | Raisable | Printable |
|---|---|---|
TranslationUnit
| Yes | No |
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 |
|---|---|
is(required TranslationUnit &tu)
|
Retrieves syntax nodes of the type TranslationUnit for your C/C++ code and stores it in
tu.
|
isa(Cpp.Node.Node node)
|
Checks if node is a TranslationUnit. Use this relation if you want to
negate it (for example: not Cpp.TranslationUnit.isa(n)).
|
cast(Cpp.Node.Node node, required TranslationUnit &cast)
|
Retrieves syntax nodes of the type TranslationUnit from the nodes in node.
Retrieval occurs if node is compatible with TranslationUnit type.
Use this relation if you need further TranslationUnit properties.
|
templateDeclaration(TranslationUnit self, Cpp.Node.Node &child) | Matches a template declaration that appears as a direct child of the translation unit. |
declaration(TranslationUnit self, Cpp.Node.Node &child) | Matches a (non-template) declaration that appears as a direct child of the translation unit. |
templateInstantiation(TranslationUnit self, Cpp.Node.Node &child) | Matches a template instantiation that appears as a direct child of the translation unit. |
doStatement(TranslationUnit self, Cpp.Node.Node &child) | Matches a do statement that appears as a direct child of the translation unit. |
throwStatement(TranslationUnit self, Cpp.Node.Node &child) | Matches a throw statement that appears as a direct child of the translation unit. |
expressionStatement(TranslationUnit self, Cpp.Node.Node &child) | Matches an expression statement that appears as a direct child of the translation unit. |
tryStatement(TranslationUnit self, Cpp.Node.Node &child) | Matches a try statement that appears as a direct child of the translation unit. |
forRangeLoop(TranslationUnit self, Cpp.Node.Node &child) | Matches a range-based for loop that appears as a direct child of the translation unit. |
typeDefinition(TranslationUnit self, Cpp.Node.Node &child) | Matches a type definition that appears as a direct child of the translation unit. |
forStatement(TranslationUnit self, Cpp.Node.Node &child) | Matches a for statement that appears as a direct child of the translation unit. |
typeSpecifier(TranslationUnit self, Cpp.Node.Node &child) | Matches a type specifier that appears as a direct child of the translation unit. |
functionDefinition(TranslationUnit self, Cpp.Node.Node &child) | Matches a function definition that appears as a direct child of the translation unit. |
usingDeclaration(TranslationUnit self, Cpp.Node.Node &child) | Matches a using declaration that appears as a direct child of the translation unit. |
gotoStatement(TranslationUnit self, Cpp.Node.Node &child) | Matches a goto statement that appears as a direct child of the translation unit. |
whileStatement(TranslationUnit self, Cpp.Node.Node &child) | Matches a while statement that appears as a direct child of the translation unit. |
ifStatement(TranslationUnit self, Cpp.Node.Node &child) | Matches an if statement that appears as a direct child of the translation unit. |
labeledStatement(TranslationUnit self, Cpp.Node.Node &child) | Matches a labeled statement (for example, a case label or user label) that appears as a direct child of the translation unit. |
linkageSpecification(TranslationUnit self, Cpp.Node.Node &child) | Matches a linkage specification (for example, extern "C") that appears as a direct child of the translation unit. |
namespaceAliasDefinition(TranslationUnit self, Cpp.Node.Node &child) | Matches a namespace alias definition that appears as a direct child of the translation unit. |
namespaceDefinition(TranslationUnit self, Cpp.Node.Node &child) | Matches a namespace definition that appears as a direct child of the translation unit. |
preprocCall(TranslationUnit self, Cpp.Node.Node &child) | Matches a preprocessor call-like construct that appears as a direct child of the translation unit. |
aliasDeclaration(TranslationUnit self, Cpp.Node.Node &child) | Matches an alias declaration (for example, using X = Y;) that appears as a direct child of the translation unit. |
preprocDef(TranslationUnit self, Cpp.Node.Node &child) | Matches a preprocessor definition (for example, #define) that appears as a direct child of the translation unit. |
attributedStatement(TranslationUnit self, Cpp.Node.Node &child) | Matches an attributed statement that appears as a direct child of the translation unit. |
preprocFunctionDef(TranslationUnit self, Cpp.Node.Node &child) | Matches a function-like preprocessor definition that appears as a direct child of the translation unit. |
breakStatement(TranslationUnit self, Cpp.Node.Node &child) | Matches a break statement that appears as a direct child of the translation unit. |
preprocIf(TranslationUnit self, Cpp.Node.Node &child) | Matches a preprocessor #if construct that appears as a direct child of the translation unit. |
caseStatement(TranslationUnit self, Cpp.Node.Node &child) | Matches a case statement that appears as a direct child of the translation unit. |
preprocIfdef(TranslationUnit self, Cpp.Node.Node &child) | Matches a preprocessor #ifdef/#ifndef construct that appears as a direct child of the translation unit. |
coReturnStatement(TranslationUnit self, Cpp.Node.Node &child) | Matches a coroutine co_return statement that appears as a direct child of the translation unit. |
preprocInclude(TranslationUnit self, Cpp.Node.Node &child) | Matches a preprocessor #include directive that appears as a direct child of the translation unit. |
coYieldStatement(TranslationUnit self, Cpp.Node.Node &child) | Matches a coroutine co_yield statement that appears as a direct child of the translation unit. |
returnStatement(TranslationUnit self, Cpp.Node.Node &child) | Matches a return statement that appears as a direct child of the translation unit. |
compoundStatement(TranslationUnit self, Cpp.Node.Node &child) | Matches a compound statement (block) that appears as a direct child of the translation unit. |
staticAssertDeclaration(TranslationUnit self, Cpp.Node.Node &child) | Matches a static_assert declaration that appears as a direct child of the translation unit. |
conceptDefinition(TranslationUnit self, Cpp.Node.Node &child) | Matches a C++20 concept definition that appears as a direct child of the translation unit. |
switchStatement(TranslationUnit self, Cpp.Node.Node &child) | Matches a switch statement that appears as a direct child of the translation unit. |
continueStatement(TranslationUnit self, Cpp.Node.Node &child) | Matches a continue statement that appears as a direct child of the translation unit. |
isEnclosedInTranslationUnit(Cpp.Node.Node child)
|
Checks if child is inside a TranslationUnit.
|
getEnclosingTranslationUnit(Cpp.Node.Node child, required TranslationUnit &parent)
|
Finds the nearest TranslationUnit ancestor of child and returns it as
parent.
|
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.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の 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)