24#include "AstScript/Expr.hpp"
25#include "AstScript/ScriptAPI.hpp"
26#include "AstUtil/OrderedMap.hpp"
33using ValueMapType = OrderedMap<std::string, SharedPtr<Value>>;
34using NamedValueVector = std::vector<std::pair<std::string, SharedPtr<Value>>>;
45 static Value& NullValue();
48 ~Value()
override =
default;
56 void insert(
const std::string& name,
Value* value);
58 void insert(
const std::string& name, T value)
60 insert(name, aNewValue(value));
62 Value& operator[](
const std::string& name);
63 const Value& operator[](
const std::string& name)
const;
64 Value& operator[](
const char* name);
65 const Value& operator[](
const char* name)
const;
66 Value& operator[](
size_t index);
67 const Value& operator[](
size_t index)
const;
72 bool isDouble()
const;
73 bool isQuantity()
const;
74 bool isString()
const;
76 std::string toString()
const;
77 Quantity toQuantity()
const;
78 double toDouble()
const;
82 operator std::string()
const;
83 operator Quantity()
const;
84 operator double()
const;
86 operator bool()
const;
88 ValDict* toValDict()
const;
89 const NamedValueVector& items()
const;
91 const Value& operator>>(
bool& val)
const;
92 const Value& operator>>(
int& val)
const;
93 const Value& operator>>(
double& val)
const;
Value * eval() const final
求值表达式
定义 Value.hpp:51
errc_t setValue(Value *) final
设置值
定义 Value.hpp:54