103 explicit
Value(const std::
string& v);
111 explicit Value(
const QString& v);
134 explicit Value(
long v);
262 inline Value& set(
const QString& qs);
274 Value&
set(
int type,
const void* content,
size_t size = 0);
325 Value& assign(
const long v);
360 inline Value& assign(
const QString& s);
460 [[nodiscard]] std::string
getString(
int precision = std::numeric_limits<int>::max())
const;
467 [[nodiscard]] QString getQString(
int precision = std::numeric_limits<int>::max())
const;
494 Value& operator=(
const QString& v);
499 explicit operator QString()
const;
506 explicit operator std::string()
const;
511 explicit operator bool()
const;
648 EType _type{vitUndefined};
682 static const size_t _sizeExtra;
687 static const char* _typeNames[];
721#include <misc/gen/Value.hpp>
Counted vector having additional methods and operators for ease of usage. This template class extends...
Definition TVector.h:20
Value container class able to performing arithmetic functions.
Definition Value.h:19
friend Value operator-(const Value &v1, const Value &v2)
int compare(const Value &v) const
Compare this with the passed value.
Value(const void *v, size_t size)
Binary type constructor for implicit vitBinary.
static std::string_view getType(EType type)
Gets the type string of the passed type enumeration value.
bool setType(EType type)
Convert the instance to the passed type.
EType
Enumerate for available types.
Definition Value.h:34
@ vitFloat
Definition Value.h:44
@ vitCustom
Definition Value.h:50
@ vitBinary
Definition Value.h:48
@ vitUndefined
Definition Value.h:40
@ vitInteger
Definition Value.h:42
@ vitString
Definition Value.h:46
int operator>=(const Value &v) const
Larger than or equal operator.
friend Value operator/(const Value &v1, const Value &v2)
friend Value operator*(const Value &v1, const Value &v2)
Value & assign(const std::string &v)
Assigns a string value but not changing the current type. Except for vitUndefined and vitInvalid type...
Value & operator/=(const Value &v)
Divide by operator.
bool isNumber() const
Checks if this is a numeric type (vitFloat or vitInteger) of instance.
Value(EType type, const void *content, size_t size=0)
Specific type constructor.
static Value calculateOffset(Value value, Value min, Value max, const Value &len, bool clip)
Calculates the offset for a given range and set point.
friend Value operator+(const Value &v1, const Value &v2)
friend std::ostream & operator<<(std::ostream &os, const Value &v)
Value class output stream operator.
Value div(const Value &v) const
Divide this with the passed value.
Value & set(flt_type v)
Sets the type and content. An existing type is undone.
Value & assign(flt_type v)
Assigns a floating point value but not changing the current type. Except for vitUndefined and vitInva...
Value & operator%=(const Value &v)
Modulus operator.
Value & operator=(const Value &v)
Assignment operator that only change the contents. Calls actually assign()
bool operator!() const
Boolean invert operator.
friend std::istream & operator>>(std::istream &is, Value &v)
Value class input stream operator.
Value & round(const Value &v)
Rounds the current instance to a multiple of the passed value.
Value(int_type v)
# 64bit int_type type constructor for implicit vitInteger.
friend Value operator%(const Value &v1, const Value &v2)
flt_type _flt
Definition Value.h:667
Value & set(int v)
Sets the type and content. An existing type is undone.
flt_type getFloat() const
Gets a floating point value of the current value if possible.
size_t getSize() const
Gets the size of the occupied space.
int operator>(const Value &v) const
Larger than operator.
bool isValid() const
Checks if the instance is valid. If the type is equals vitInvalid.
Value & assign(int v)
Assigns an integer value but not changing the current type. Except for vitUndefined and vitInvalid ty...
Value()
Default constructor.
static EType getType(const std::string_view &type)
Gets the type corresponding to the passed type string.
~Value()
Destructor. Frees the allocated memory if some was allocated.
Value & operator=(const Value *v)
Assignment operator setting this instance to references the past instance pointer.
Value mod(const Value &v) const
Modulus this with the passed value.
double flt_type
Type used internally for storing floating point value.
Definition Value.h:28
static const char * _invalidStr
Holds the invalid string when needed.
Definition Value.h:693
Value(bool v)
Boolean type constructor for implicit vitInteger.
Value & set(const char *v)
Sets the type and content. An existing type is undone.
Value & set(const void *v, size_t size)
Sets the type implicitly to vitBinary. An existing type is undone.
int64_t int_type
Type used internally for storing integers.
Definition Value.h:24
int_type getInteger() const
Returns an integer value of the current value if possible.
const void * getBinary() const
Gets the pointer to the binary buffer if vitBinary.
Value sub(const Value &v) const
Subtract this with the passed value.
Value & set(const Value *v)
Set this instance to references to the instance passed here as pointer. Makes this instance an alias ...
int_type getInteger(int *cnv_err) const
Gets an integer value of the current value if possible. if the current type is a string the 'cnv_err'...
char * _ptr
Definition Value.h:663
EType getType() const
Gets the current type for this instance.
Value * _ref
Definition Value.h:675
Value & operator-=(const Value &v)
Subtract operator.
Value & operator=(const std::string &v)
Assignment operator that only change the contents.
int operator!=(const Value &v) const
Not equal operator.
std::string getString(int precision=std::numeric_limits< int >::max()) const
Gets the string of the value with the specified precision.
const char * getData() const
Gets pointer to the data. Only when the type is vitString, vitBinary or vitCustom.
bool isZero() const
Returns if the instance is type is zero. For non-numeric values this is when the data length is zero....
int operator==(const Value &v) const
Equal operator.
Value add(const Value &v) const
Add this with the passed value.
Value & set(const Value &v)
Copies the content and type of the passed value. An existing reference type is undone.
Value & assign(unsigned v)
Assigns an unsigned integer value but not changing the current type. Except for vitUndefined and vitI...
Value & set(int_type v)
Sets the type and content. An existing type is undone.
Value & set(const std::string &v)
Sets the type and content. An existing type is undone.
Value & operator=(Value &&) noexcept
Move assignment operator is default.
int operator<(const Value &v) const
Less than operator.
Value & assign(bool v)
Assigns a boolean value but not changing the current type. Except for vitUndefined and vitInvalid typ...
flt_type getFloat(int *cnv_err) const
Returns a floating point value of the current value if possible. When the current type is a string th...
Value(int v)
32bit integer type constructor for implicit vitInteger.
Value & set(int type, const void *content, size_t size=0)
Sets the instance type and content. Called by constructors and all set functions.
int_type _int
Definition Value.h:671
Value & assign(const Value &v)
Assigns a value of an instance but not changing the current type. Except for vitUndefined and vitInva...
Value(unsigned v)
32-bit unsigned integer type constructor for implicit vitInteger.
Value & assign(const char *v)
Assigns a string value but not changing the current type. Except for vitUndefined and vitInvalid type...
int operator<=(const Value &v) const
Less than or equal operator.
Value mul(const Value &v) const
Multiply this with the passed value.
Value & operator+=(const Value &v)
Add operator.
Value & set(unsigned v)
Sets the type and content. An existing type is undone.
TVector< Value > vector_type
Definition Value.h:697
Value & operator*=(const Value &v)
Multiply by operator.
Value & set(bool v)
Sets the type and content. An existing type is undone.
Value & assign(const void *v, size_t size)
Assigns raw binary data but not changing the current type. Except for vitUndefined and vitInvalid typ...
#define _MISC_FUNC
Definition misc/global.h:39
#define _MISC_CLASS
Definition misc/global.h:40
Definition Application.h:10
_GII_FUNC std::istream & operator>>(std::istream &is, ResultData &)
Stream operator for setting up this instance with a setup std::string.
_GII_FUNC std::ostream & operator<<(std::ostream &os, const ResultData &)
Stream operator for the setup std::string.