9 #if !defined(_Value_h_) 12 #include "format_string.h" 50 virtual value_type_t
getType()
const {
return m_type; }
64 virtual size_t getSize()
const = 0;
71 virtual std::string
toString()
const = 0;
103 :
Value(kIntegerValue)
115 :
Value(kIntegerValue)
128 , m_value(other.m_value)
129 , m_intType(other.m_intType)
145 virtual size_t getSize()
const {
return sizeof(m_value); }
154 return (m_intType == kSignedLong || m_intType == kUnsignedLong) ? m_value : (uint32_t)m_value;
169 operator uint64_t()
const {
return m_value; }
191 if (m_intType == kUnsigned)
192 return format_string(
"%uU", (uint32_t)m_value);
193 else if (m_intType == kSigned)
194 return format_string(
"%d", (int32_t)m_value);
195 else if (m_intType == kUnsignedLong)
196 return format_string(
"%lluU", m_value);
198 return format_string(
"%lld", (int64_t)m_value);
257 , m_value(other.m_value)
286 virtual size_t getSize()
const {
return sizeof(m_value); }
300 operator double()
const {
return m_value; }
307 operator float()
const {
return static_cast<float>(m_value); }
340 virtual std::string
toString()
const {
return format_string(
"%g", m_value); }
365 :
Value(kStringValue)
376 :
Value(kStringValue)
387 :
Value(kStringValue)
398 :
Value(kStringValue)
399 , m_value(other.m_value)
415 virtual size_t getSize()
const {
return m_value.size(); }
422 const std::string &
getString()
const {
return m_value; }
429 operator const char *()
const {
return m_value.c_str(); }
436 operator const std::string &()
const {
return m_value; }
443 operator std::string &() {
return m_value; }
450 operator const std::string *() {
return &m_value; }
457 operator std::string *() {
return &m_value; }
503 virtual std::string
toString()
const {
return m_value; }
const std::string & getString() const
Get StringValue value.
Definition: Value.h:422
virtual std::string toString() const
Get StringValue type string representation.
Definition: Value.h:503
uint64_t m_value
The integer value.
Definition: Value.h:209
FloatValue & operator=(float value)
Assign operator.
Definition: Value.h:329
IntegerValue(const IntegerValue &other)
Copy constructor.
Definition: Value.h:126
FloatValue & operator=(const FloatValue &other)
Assign operator.
Definition: Value.h:268
IntegerValue(uint64_t value, int_type_t type=kSigned)
Constructor.
Definition: Value.h:114
StringValue & operator=(const StringValue &other)
Assign operator.
Definition: Value.h:466
virtual std::string getTypeName() const
Get StringValue type name.
Definition: Value.h:408
StringValue(const std::string &value)
Constructor.
Definition: Value.h:375
64-bit integer value.
Definition: Value.h:87
virtual std::string getTypeName() const =0
Get Value type name.
virtual Value * clone() const
Clone FloatValue.
Definition: Value.h:347
uint64_t getValue() const
This function returns value.
Definition: Value.h:152
virtual std::string toString() const =0
Get Value type string representation.
StringValue & operator=(const char *value)
Assign operator.
Definition: Value.h:492
virtual Value * clone() const
Clone IntegerValue.
Definition: Value.h:206
Double floating point value.
Definition: Value.h:216
String value.
Definition: Value.h:358
virtual std::string getTypeName() const
Get IntegerValue type name.
Definition: Value.h:138
virtual size_t getSize() const
Get IntegerValue type size.
Definition: Value.h:145
FloatValue(const FloatValue &other)
Copy constructor.
Definition: Value.h:255
int_type_t m_intType
The integer type.
Definition: Value.h:210
double m_value
The double value.
Definition: Value.h:350
int_type_t
Supported sizes of integers.
Definition: Value.h:91
Abstract base class for values of arbitrary types.
Definition: Value.h:27
virtual value_type_t getType() const
Get Value type.
Definition: Value.h:50
virtual size_t getSize() const
Get StringValue type size.
Definition: Value.h:415
virtual ~Value()
Destructor.
Definition: Value.h:43
virtual Value * clone() const =0
Clone Value.
double getValue() const
This function returns value.
Definition: Value.h:293
virtual std::string getTypeName() const
Get FloatValue type name.
Definition: Value.h:279
virtual Value * clone() const
Clone StringValue.
Definition: Value.h:510
virtual std::string toString() const
Get IntegerValue type string representation.
Definition: Value.h:189
virtual size_t getSize() const
Get FloatValue type size.
Definition: Value.h:286
Value(value_type_t theType)
Constructor.
Definition: Value.h:35
FloatValue(float value)
Constructor.
Definition: Value.h:244
int_type_t getIntType()
This function returns signed/unsigned type.
Definition: Value.h:162
virtual std::string toString() const
Get FloatValue type string representation.
Definition: Value.h:340
IntegerValue(int_type_t type=kSigned)
Constructor.
Definition: Value.h:102
StringValue()
Constructor.
Definition: Value.h:364
FloatValue(double value)
Constructor.
Definition: Value.h:233
FloatValue & operator=(double value)
Assign operator.
Definition: Value.h:316
IntegerValue & operator=(int64_t value)
Assign operator.
Definition: Value.h:178
StringValue(const StringValue &other)
Copy constructor.
Definition: Value.h:397
StringValue & operator=(const std::string &value)
Assign operator.
Definition: Value.h:479
FloatValue()
Constructor.
Definition: Value.h:222
std::string m_value
The string value.
Definition: Value.h:513
virtual size_t getSize() const =0
Get Value type size.
StringValue(const std::string *value)
Constructor.
Definition: Value.h:386