@@ -106,16 +106,6 @@ struct Value {
106106 {
107107 }
108108
109- Value (const char *str, size_t len)
110- : type_(VALUE_TYPE_STRING_REF), unit_(UNIT_UNKNOWN), options_(0 )
111- {
112- auto newStr = (char *)alloc (len + 1 );
113- stringCopyLength (newStr, len + 1 , str, len);
114-
115- refString_.refCounter = 1 ;
116- refString_.str = newStr;
117- }
118-
119109 Value (int version, const char *str)
120110 : type_(VALUE_TYPE_VERSIONED_STRING), unit_(version), options_(0 ), str_(str)
121111 {
@@ -140,11 +130,21 @@ struct Value {
140130 {
141131 }
142132
133+ Value (int8_t value, ValueType type)
134+ : type_(type), unit_(UNIT_UNKNOWN), options_(0 ), uint8_(value)
135+ {
136+ }
137+
143138 Value (uint8_t value, ValueType type)
144139 : type_(type), unit_(UNIT_UNKNOWN), options_(0 ), uint8_(value)
145140 {
146141 }
147142
143+ Value (int16_t value, ValueType type)
144+ : type_(type), unit_(UNIT_UNKNOWN), options_(0 ), int16_(value)
145+ {
146+ }
147+
148148 Value (uint16_t value, ValueType type)
149149 : type_(type), unit_(UNIT_UNKNOWN), options_(0 ), uint16_(value)
150150 {
@@ -155,6 +155,16 @@ struct Value {
155155 {
156156 }
157157
158+ Value (int64_t value, ValueType type)
159+ : type_(type), unit_(UNIT_UNKNOWN), options_(0 ), int64_(value)
160+ {
161+ }
162+
163+ Value (uint64_t value, ValueType type)
164+ : type_(type), unit_(UNIT_UNKNOWN), options_(0 ), uint64_(value)
165+ {
166+ }
167+
158168 Value (float value, Unit unit)
159169 : type_(VALUE_TYPE_FLOAT), unit_(unit), options_(0 ), float_(value)
160170 {
@@ -174,10 +184,6 @@ struct Value {
174184 : type_(type), unit_(UNIT_UNKNOWN), options_(0 ), double_(value) {
175185 }
176186
177- Value (int64_t value, ValueType type)
178- : type_(type), unit_(UNIT_UNKNOWN), options_(0 ), int64_(value) {
179- }
180-
181187 Value (const char *value, ValueType type, int16_t options)
182188 : type_(type), unit_(UNIT_UNKNOWN), options_(options), str_(value)
183189 {
@@ -275,11 +281,11 @@ struct Value {
275281 return type_ == VALUE_TYPE_BOOLEAN;
276282 }
277283
278- bool isString () {
284+ bool isString () const {
279285 return type_ == VALUE_TYPE_STRING;
280286 }
281287
282- bool isAnyStringType () {
288+ bool isAnyStringType () const {
283289 return type_ == VALUE_TYPE_STRING || type_ == VALUE_TYPE_STRING_REF || type_ == VALUE_TYPE_ASSETS_STRING;
284290 }
285291
@@ -332,6 +338,9 @@ struct Value {
332338 }
333339
334340 const char *getString () const {
341+ if (type_ == VALUE_TYPE_STRING_REF) {
342+ return refString_.str ;
343+ }
335344 return str_;
336345 }
337346
@@ -587,8 +596,10 @@ struct Value {
587596 return 0 ;
588597 }
589598
590- const char * toString (Assets *assets) const ;
599+ Value toString (Assets *assets) const ;
591600
601+ static Value makeStringRef (const char *str, size_t len);
602+
592603 static Value concatenateString (const char *str1, const char *str2);
593604
594605 // ////////
0 commit comments