32const char *attr_type_to_string(AttrType type);
33AttrType attr_type_from_string(
const char *s);
44 Value(AttrType attr_type,
char *data,
int length = 4) : attr_type_(attr_type)
46 this->set_data(data, length);
49 explicit Value(
int val);
50 explicit Value(
float val);
51 explicit Value(
bool val);
52 explicit Value(
const char *s,
int len = 0);
55 Value &operator=(
const Value &other) =
default;
57 void set_type(AttrType type)
59 this->attr_type_ = type;
61 void set_data(
char *data,
int length);
62 void set_data(
const char *data,
int length)
64 this->set_data(
const_cast<char *
>(data), length);
66 void set_int(
int val);
67 void set_float(
float val);
68 void set_boolean(
bool val);
69 void set_string(
const char *s,
int len = 0);
70 void set_value(
const Value &value);
72 std::string to_string()
const;
74 int compare(
const Value &other)
const;
76 const char *data()
const;
82 AttrType attr_type()
const
93 float get_float()
const;
94 std::string get_string()
const;
95 bool get_boolean()
const;
98 AttrType attr_type_ = UNDEFINED;
106 std::string str_value_;
属性的值
Definition: value.h:40
int get_int() const
Definition: value.cpp:205