🛰️航天仿真算法库 SpaceAST
0.0.1
载入中...
搜索中...
未找到
ExprCondition.hpp
浏览该文件的文档.
1
20
21
#pragma once
22
23
#include "AstGlobal.h"
24
#include "
Expr.hpp
"
25
#include "AstScript/ScriptAPI.hpp"
26
#include "AstUtil/SharedPtr.hpp"
27
28
AST_NAMESPACE_BEGIN
29
32
class
ExprCondition
:
public
Expr
33
{
34
public
:
35
AST_EXPR(
ExprCondition
)
36
37
public
:
38
ExprCondition
(
Expr
* condition,
Expr
* thenExpr,
Expr
* elseExpr)
39
: condition_(condition), thenExpr_(thenExpr), elseExpr_(elseExpr)
40
{};
41
virtual
~ExprCondition
() =
default
;
42
43
// accept函数由AST_EXPR宏自动生成,无需手动声明
44
Value
* eval()
const override
;
45
errc_t setValue(
Value
* val)
override
;
46
std::string getExpression(
Object
* context=
nullptr
)
const override
;
47
48
private
:
49
SharedPtr<Expr>
condition_;
50
SharedPtr<Expr>
thenExpr_;
51
SharedPtr<Expr>
elseExpr_;
52
};
53
54
AST_NAMESPACE_END
Expr.hpp
~
ast::ExprCondition
条件表达式 (三元运算符 ? :)
定义
ExprCondition.hpp:33
ast::Expr
表达式基类
定义
Expr.hpp:39
ast::Object
对象基类,继承自该类的对象可以使用运行时类型信息相关功能,实现强弱引用计数、运行时元信息(属性访问、序列化等)等基础功能
定义
Object.hpp:81
ast::SharedPtr
共享指针
定义
SharedPtr.hpp:33
ast::Value
值对象基类
定义
Value.hpp:36
src
AstScript
Expression
ExprCondition.hpp
制作者
1.12.0