|
| Value (AttrType attr_type, char *data, int length=4) |
|
| Value (int val) |
|
| Value (float val) |
|
| Value (bool val) |
|
| Value (const char *s, int len=0) |
|
| Value (const Value &other) |
|
| Value (Value &&other) |
|
Value & | operator= (const Value &other) |
|
Value & | operator= (Value &&other) |
|
void | reset () |
|
void | set_type (AttrType type) |
|
void | set_data (char *data, int length) |
|
void | set_data (const char *data, int length) |
|
void | set_value (const Value &value) |
|
void | set_boolean (bool val) |
|
string | to_string () const |
|
int | compare (const Value &other) const |
|
const char * | data () const |
|
int | length () const |
|
AttrType | attr_type () const |
|
int | get_int () const |
|
float | get_float () const |
|
string | get_string () const |
|
bool | get_boolean () const |
|
|
static RC | add (const Value &left, const Value &right, Value &result) |
|
static RC | subtract (const Value &left, const Value &right, Value &result) |
|
static RC | multiply (const Value &left, const Value &right, Value &result) |
|
static RC | divide (const Value &left, const Value &right, Value &result) |
|
static RC | negative (const Value &value, Value &result) |
|
static RC | cast_to (const Value &value, AttrType to_type, Value &result) |
|
属性的值
与DataType,就是数据类型,配套完成各种算术运算、比较、类型转换等操作。这里同时记录了数据的值与类型。 当需要对值做运算时,建议使用类似 Value::add 的操作而不是 DataType::add。在进行运算前,应该设置好结果的类型, 比如进行两个INT类型的除法运算时,结果类型应该设置为FLOAT。