🛰️航天仿真算法库 SpaceAST 0.0.1
载入中...
搜索中...
未找到
ast::Variable类 参考

#include <Variable.hpp>

+ 类 ast::Variable 继承关系图:

Public 成员函数

 Variable (StringView name, Expr *expr=nullptr, bool bind=false)
 
 Variable (Expr *expr=nullptr, bool bind=false)
 
Valueeval () const final
 
errc_t setValue (Value *val) final
 
errc_t setExpr (Expr *expr)
 
errc_t setBindExpr (Expr *expr)
 
errc_t setExpr (Value *value)
 
errc_t setExpr (StringView value)
 
errc_t setExpr (const std::string &value)
 
errc_t setExpr (const Quantity &quantity)
 
errc_t setExpr (double value)
 
errc_t setExpr (int value)
 
errc_t setExpr (bool value)
 
template<typename T >
errc_t setExpr (T value)=delete
 
errc_t bind (Expr *expr)
 
std::string getExpression (Object *context=nullptr) const override
 
const std::string & name () const
 
const std::string & getName () const override
 
void setName (StringView name) override
 
Exprexpr () const
 
errc_t setValue (StringView value)
 
- Public 成员函数 继承自 ast::Expr
virtual void accept (ExprVisitor &visitor)=0
 
virtual Exprexec () const
 
 Object ()
 
 Object (Object *parentScope)
 
 Object (std::nullptr_t)
 
 Object (initial_strong_ref_t)
 
 Object (const Object &obj)
 
- Public 成员函数 继承自 ast::Object
 Object (Object *parentScope)
 
 Object (std::nullptr_t)
 
 Object (initial_strong_ref_t)
 
virtual ClassgetType () const
 
virtual std::string getRepresentation () const
 
const std::string & name () const
 
errc_t showEditDialog ()
 
Attribute attr (StringView path)
 
errc_t getAttrBool (StringView path, bool &value) const
 
errc_t getAttrInt (StringView path, int &value) const
 
errc_t getAttrDouble (StringView path, double &value) const
 
errc_t getAttrString (StringView path, std::string &value) const
 
errc_t getAttrObject (StringView path, Object *&value) const
 
double getAttrDouble (StringView path) const
 
int getAttrInt (StringView path) const
 
bool getAttrBool (StringView path) const
 
std::string getAttrString (StringView path) const
 
ObjectgetAttrObject (StringView path) const
 
errc_t setAttrBool (StringView path, bool value)
 
errc_t setAttrInt (StringView path, int value)
 
errc_t setAttrDouble (StringView path, double value)
 
errc_t setAttrString (StringView path, StringView value)
 
errc_t setAttrObject (StringView path, Object *value)
 
Classtype () const
 
const std::string & typeName () const
 
PropertygetProperty (StringView fieldName) const
 
ObjectId getID () const
 
errc_t setParentScope (Object *parentScope)
 
ObjectgetParentScope () const
 
bool isOfType (const Class *type) const
 
bool isOfType (StringView typeName) const
 
template<typename T >
bool isOfType () const
 
uint32_t refCount () const
 
uint32_t weakRefCount () const
 
bool isDestructed () const
 
void destruct ()
 
uint32_t incWeakRef ()
 
uint32_t decWeakRef ()
 
uint32_t incRef ()
 
uint32_t decRef ()
 
uint32_t decRefNoDelete ()
 
template<typename Func >
void addDelayedLink (Func &&link)
 
template<typename Func >
void addDelayedLinkIfFailed (Func &&link)
 
void resolveLinks ()
 

静态 Public 成员函数

static VariableNew ()
 
- 静态 Public 成员函数 继承自 ast::Object
static ObjectResolve (StringView value)
 
static void ClassInit (Class *cls)
 
static ClassStaticType ()
 

Public 属性

AST_PROPERTIES : std::string value() const
 

Protected 属性

std::string name_
 
SharedPtr< Exprexpr_
 
bool bind_
 

额外继承的成员函数

- 静态 Public 属性 继承自 ast::Object
static Class staticType
 
- Protected 成员函数 继承自 ast::Object
 Object (const Object &obj)
 
Objectoperator= (const Object &)
 

详细描述

变量

变量是脚本语言中的基本元素,表示存储数据的命名位置 变量可以存储各种类型的值,如整数、浮点数、字符串、 变量也可以与其他变量单向/双向绑定,实现引用传递的效果

成员函数说明

◆ bind()

errc_t ast::Variable::bind ( Expr * expr)

绑定变量到表达式

参数
expr要绑定的表达式
返回
错误码

◆ eval()

Value * ast::Variable::eval ( ) const
finalvirtual

计算变量的值

返回
变量的值

实现了 ast::Expr.

◆ getExpression()

std::string ast::Variable::getExpression ( Object * context = nullptr) const
inlineoverridevirtual

获取变量的表达式

参数
context上下文对象
返回
变量的表达式字符串

实现了 ast::Expr.

◆ getName()

const std::string & ast::Variable::getName ( ) const
inlineoverridevirtual

获取对象的名称

重载 ast::Object .

◆ setBindExpr()

errc_t ast::Variable::setBindExpr ( Expr * expr)

设置变量的表达式为双向绑定

参数
expr要设置的表达式
返回
错误码

◆ setExpr() [1/8]

errc_t ast::Variable::setExpr ( bool value)

设置变量的表达式

参数
value要设置的布尔值
返回
错误码

◆ setExpr() [2/8]

errc_t ast::Variable::setExpr ( const Quantity & quantity)

设置变量的表达式

参数
quantity要设置的数量
返回
错误码

◆ setExpr() [3/8]

errc_t ast::Variable::setExpr ( const std::string & value)

设置变量的表达式

参数
value要设置的字符串
返回
错误码

◆ setExpr() [4/8]

errc_t ast::Variable::setExpr ( double value)

设置变量的表达式

参数
value要设置的浮点数
返回
错误码

◆ setExpr() [5/8]

errc_t ast::Variable::setExpr ( Expr * expr)

设置变量的表达式

参数
expr要设置的表达式
返回
错误码

◆ setExpr() [6/8]

errc_t ast::Variable::setExpr ( int value)

设置变量的表达式

参数
value要设置的整数
返回
错误码

◆ setExpr() [7/8]

errc_t ast::Variable::setExpr ( StringView value)

设置变量的表达式

参数
value要设置的字符串
返回
错误码

◆ setExpr() [8/8]

errc_t ast::Variable::setExpr ( Value * value)

设置变量的表达式

参数
value要设置的值
返回
错误码

◆ setName()

void ast::Variable::setName ( StringView name)
inlineoverridevirtual

设置对象的名称

参数
name对象名称

重载 ast::Expr .

◆ setValue()

errc_t ast::Variable::setValue ( Value * val)
finalvirtual

设置变量的值

参数
val要设置的值
返回
错误码

重载 ast::Expr .


该类的文档由以下文件生成: