24#include "AstScript/Expr.hpp"
25#include "AstUtil/StringView.hpp"
26#include "AstUtil/SharedPtr.hpp"
63 errc_t setExpr(
Expr* expr);
68 errc_t setBindExpr(
Expr* expr);
73 errc_t setExpr(
Value* value);
83 errc_t setExpr(
const std::string& value);
88 errc_t setExpr(
const Quantity& quantity);
93 errc_t setExpr(
double value);
98 errc_t setExpr(
int value);
103 errc_t setExpr(
bool value);
108 errc_t setExpr(T value) =
delete;
114 errc_t bind(
Expr* expr);
122 const std::string&
name()
const {
return name_; }
123 const std::string&
getName()
const override {
return name_; }
125 Expr* expr()
const {
return expr_.get(); }
127 std::string value()
const;
virtual errc_t setValue(Value *val)
设置表达式的值
定义 Expr.hpp:60
virtual Value * eval() const =0
求值
对象基类,继承自该类的对象可以使用运行时类型信息相关功能,实现强弱引用计数、运行时元信息(属性访问、序列化等)等基础功能
定义 Object.hpp:86
const std::string & name() const
获取对象的名称
定义 Object.hpp:133
const std::string & getName() const override
获取对象的名称
定义 Variable.hpp:123
SharedPtr< Expr > expr_
变量的值,或者绑定的表达式
定义 Variable.hpp:131
bool bind_
是否与表达式双向绑定
定义 Variable.hpp:132
std::string getExpression(Object *context=nullptr) const override
获取变量的表达式
定义 Variable.hpp:120
std::string name_
变量的名称
定义 Variable.hpp:130
void setName(StringView name) override
设置对象的名称
定义 Variable.hpp:124