8 #ifndef INCL_evo_type_h 9 #define INCL_evo_type_h 24 #define EVO_MIN(A, B) ((B) < (A) ? (B) : (A)) 31 #define EVO_MAX(A, B) ((B) > (A) ? (B) : (A)) 76 typedef void (
SafeBool::*SafeBoolType)()
const;
77 void This_type_does_not_support_this_comparison()
const { }
92 operator SafeBoolType()
const 93 {
return (!(static_cast<const T*>(
this))->
operator!() ? &SafeBool::This_type_does_not_support_this_comparison : 0); }
98 { l.This_type_does_not_support_this_comparison();
return false; }
100 { l.This_type_does_not_support_this_comparison();
return false; }
105 struct SafeBoolTestCov :
SafeBool<SafeBoolTestCov> {
107 { This_type_does_not_support_this_comparison(); }
150 { null_ = src.null_; value_ = src.value_;
return *
this; }
157 { null_ =
false; value_ = value;
return *
this; }
165 { null_ =
true; value_ = (T)0;
return *
this; }
171 {
return (null_ || value_ == (T)0); }
178 {
return (null_ ? val.null_ : !val.null_ && value_ == val.value_); }
187 {
return (null_ ?
false : value_ == val); }
194 {
return (null_ ? !val.null_ : val.null_ || value_ != val.value_); }
203 {
return (null_ ?
true : value_ != val); }
211 bool operator<(const Nullable<T>& val)
const 212 {
return (null_ ? !val.null_ : value_ < val.value_); }
221 {
return (null_ ?
true : value_ < val); }
229 bool operator<=(const Nullable<T>& val)
const 230 {
return (null_ ?
true : (val.null_ ?
false : value_ <= val.value_)); }
239 {
return (null_ ?
true : value_ <= val); }
248 {
return (null_ ?
false : (val.null_ ?
true : value_ > val.value_)); }
257 {
return (null_ ?
false : value_ > val); }
266 {
return (null_ ? val.null_ : (val.null_ ?
true : value_ >= val.value_)); }
275 {
return (null_ ?
false : value_ >= val); }
286 }
else if (val.null_)
288 return (value_ == val.value_ ? 0 : (value_ < val.value_ ? -1 : 1));
300 return (value_ == val ? 0 : (value_ < val ? -1 : 1));
343 { null_ =
true; value_ = (T)0;
return *
this; }
350 { null_ = src.null_; value_ = src.value_;
return *
this; }
357 { null_ =
false; value_ = src;
return *
this; }
382 { value_ = (uchar)nvNULL; }
384 { value_ = src.value_; }
386 { value_ = (uchar)(val ? nvTRUE : nvFALSE); }
388 { value_ = src.value_;
return *
this; }
390 { value_ = (uchar)(val ? nvTRUE : nvFALSE);
return *
this; }
392 { value_ = (uchar)nvNULL;
return *
this; }
394 bool operator!()
const 395 {
return (value_ != (uchar)nvTRUE); }
397 {
return (value_ == val.value_); }
399 {
return (value_ != (uchar)nvNULL && val == (value_ == (uchar)nvTRUE)); }
401 {
return (value_ != val.value_); }
403 {
return (value_ == (uchar)nvNULL || val != (value_ == (uchar)nvTRUE)); }
405 bool operator<(const Nullable<bool>& val)
const 406 {
return (value_ < val.value_); }
408 {
return (value_ < (uchar)(val ? nvTRUE : nvFALSE)); }
409 bool operator<=(const Nullable<bool>& val)
const 410 {
return (value_ <= val.value_); }
412 {
return (value_ <= (uchar)(val ? nvTRUE : nvFALSE)); }
414 {
return (value_ > val.value_); }
416 {
return (value_ > (uchar)(val ? nvTRUE : nvFALSE)); }
418 {
return (value_ >= val.value_); }
420 {
return (value_ >= (uchar)(val ? nvTRUE : nvFALSE)); }
423 {
return (value_ == val.value_ ? 0 : (value_ < val.value_ ? -1 : 1)); }
425 const bool operator*()
const 426 {
return (value_ == (uchar)nvTRUE); }
429 {
return (value_ == (uchar)nvNULL); }
431 {
return (value_ != (uchar)nvNULL); }
432 const bool value()
const 433 {
return (value_ == (uchar)nvTRUE); }
436 { value_ = (uchar)nvNULL;
return *
this; }
438 { value_ = src.value_;
return *
this; }
440 { value_ = (uchar)(val ? nvTRUE : nvFALSE);
return *
this; }
443 if (value_ == nvNULL) {
447 return (value_ == nvTRUE);
469 {
return val2 == val1; }
479 {
return val2 != val1; }
488 template<
class T>
inline bool operator<(T val1, const Nullable<T>& val2)
489 {
return val2 > val1; }
498 template<
class T>
inline bool operator<=(T val1, const Nullable<T>& val2)
499 {
return val2 >= val1; }
509 {
return val2 < val1; }
519 {
return val2 <= val1; }
571 static const int BYTES =
sizeof(bool);
572 static const int BITS = 1;
683 static const int BYTES =
sizeof(T);
684 static const int BITS = BYTES * CHAR_BIT;
783 const char chmap[128] = {
784 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
785 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
786 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
787 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2,
788 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
789 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 2, 2, 2, 2, 2,
790 2, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
791 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 2, 2, 2, 2, 0
793 return (
Category)((uchar)ch < 128 ? chmap[(uint)ch] : 0);
803 const char chmap[128] = {
804 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
805 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
806 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
807 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 0, 0, 0, 0, 0, 0,
808 0, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
809 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
810 0, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
811 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0
813 return (
Digit)((uchar)ch < 128 ? chmap[(uint)ch] : 0);
821 {
return (ch ==
' ' || ch ==
'\t' || ch ==
'\n' || ch ==
'\r'); }
828 {
return (ch >=
'A' && ch <=
'Z'); }
835 {
return (ch >=
'a' && ch <=
'z'); }
842 {
return ((ch >=
'A' && ch <=
'Z') || (ch >=
'a' && ch <=
'z')); }
849 {
return ((ch >=
'0' && ch <=
'9') || (ch >=
'A' && ch <=
'Z') || (ch >=
'a' && ch <=
'z')); }
856 {
return (ch >=
'0' && ch <=
'9'); }
899 template<
int IntSize>
struct IntMaxLen { };
901 template<>
struct IntMaxLen<1> {
static const int value = 4; };
902 template<>
struct IntMaxLen<2> {
static const int value = 7; };
903 template<>
struct IntMaxLen<4> {
static const int value = 12; };
904 template<>
struct IntMaxLen<8> {
static const int value = 23; };
911 #if defined(_MSC_VER) 912 #pragma warning(push) 913 #pragma warning(disable:4309) 985 static const int BYTES =
sizeof(T);
986 static const int BITS =
sizeof(T) * 8;
987 static const int MAXSTRLEN = impl::IntMaxLen<sizeof(T)>::value;
989 static const int BITS_MINUS_1 = BITS - 1;
990 static const T RBIT = 0x01;
991 static const T LBIT = RBIT << BITS_MINUS_1;
992 static const T ZERO = 0;
993 static const T ALLBITS = T(~ZERO);
995 static const T MIN = (SIGN ? LBIT : 0);
996 static const T MAX = (SIGN ? ~LBIT : ALLBITS);
1009 assert( base <= 36 );
1010 static const int n = (SIGN ? 1 : 0);
1011 static const int VALUES[] = {
1012 digits(MAX,2)+n, digits(MAX,3)+n, digits(MAX,4)+n, digits(MAX,5)+n, digits(MAX,6)+n,
1013 digits(MAX,7)+n, digits(MAX,8)+1, digits(MAX,9)+n, digits(MAX,10)+n, digits(MAX,11)+n,
1014 digits(MAX,12)+n, digits(MAX,13)+n, digits(MAX,14)+n, digits(MAX,15)+n, digits(MAX,16)+n+1,
1015 digits(MAX,17)+n, digits(MAX,18)+n, digits(MAX,19)+n, digits(MAX,20)+n, digits(MAX,21)+n,
1016 digits(MAX,22)+n, digits(MAX,23)+n, digits(MAX,24)+n, digits(MAX,25)+n, digits(MAX,26)+n,
1017 digits(MAX,27)+n, digits(MAX,28)+n, digits(MAX,29)+n, digits(MAX,30)+n, digits(MAX,31)+n,
1018 digits(MAX,32)+n, digits(MAX,33)+n, digits(MAX,34)+n, digits(MAX,35)+n, digits(MAX,36)+n
1020 return VALUES[base-2];
1032 assert( base < 100 );
1093 #if defined(_MSC_VER) 1094 #pragma warning(pop) 1213 template<
class T>
struct ConstFloatT {
1214 static T point1() {
return 0.1f; }
1215 static T ten() {
return 10.0f; }
1217 template<>
struct ConstFloatT<double> {
1218 static double point1() {
return 0.1; }
1219 static double ten() {
return 10.0; }
1221 template<>
struct ConstFloatT<ldouble> {
1222 static ldouble point1() {
return 0.1L; }
1223 static ldouble ten() {
return 10.0L; }
1296 static const bool SIGN =
true;
1297 static const int BYTES =
sizeof(T);
1298 static const int MAXDIGITS = std::numeric_limits<T>::digits10;
1299 static const bool NANOK = std::numeric_limits<T>::has_quiet_NaN;
1301 static const int MAXDIGITS_AUTO = MAXDIGITS + 15;
1307 const int BASEDIGITS = MAXDIGITS + 9;
1308 return BASEDIGITS + (exp < 0 ? -exp : exp) + precision;
1315 static const T VAL = evo_pow(impl::ConstFloatT<T>::point1(), std::numeric_limits<T>::digits10);
1329 {
return std::numeric_limits<T>::min_exponent10; }
1341 {
return std::numeric_limits<T>::max_exponent10; }
1347 {
return std::numeric_limits<T>::infinity(); }
1355 return (std::numeric_limits<T>::has_infinity && num == std::numeric_limits<T>::infinity());
1362 {
return (num != num); }
1370 static const T val = (T)(NANOK ? std::numeric_limits<T>::quiet_NaN() : 0.0);
1378 {
return std::numeric_limits<T>::epsilon(); }
1388 static bool eq(T val1, T val2) {
1389 static const T EPSILON = std::numeric_limits<T>::epsilon();
1390 return ( (nan(val1) && nan(val2)) || val1 == val2 || evo_fabs(val1 - val2) <= EPSILON );
1399 static bool eq(T val1, T val2, T eps)
1400 {
return ( (nan(val1) && nan(val2)) || val1 == val2 || evo_fabs(val1 - val2) <= eps ); }
1411 else if (num != 0.0) {
1419 for (
int bit = 1; exp != 0; bit <<= 1) {
1428 result = (neg ? num / result : num * result);
1441 { neg =
true; num = -num; }
1443 if (!nan(num) && !inf(num) && num != 0.0) {
1445 static const int BIGNUM_DIGITS = std::numeric_limits<T>::digits10;
1446 static const T BIGNUM = evo_pow(impl::ConstFloatT<T>::ten(), BIGNUM_DIGITS);
1447 while (num >= BIGNUM)
1448 { num /= BIGNUM; exp += BIGNUM_DIGITS; }
1449 while (num >= 1000.0)
1450 { num /= 1000.0; exp += 3; }
1453 }
while (num >= 1.0);
1455 while (num < 0.001 && num > 0.0)
1456 { num *= 1000.0; exp -= 3; }
1459 { num *= 100.0; exp -= 2; }
1461 { num *= 10.0; --exp; }
1465 return (neg ? -num : num);
1511 return ( (this->null() && val.
null()) ||
1522 {
return (!this->null() &&
FloatT<T>::eq(this->value(), val)); }
1561 template<
class T,
class P=T*>
1574 assert(ptr_ != NULL);
1584 assert(ptr_ != NULL);
1594 assert(ptr_ != NULL);
1604 assert(ptr_ != NULL);
1614 assert(ptr_ != NULL);
1624 assert(ptr_ != NULL);
1632 {
return ptr_ == NULL; }
1639 {
return ptr_ == ptr.
ptr_; }
1646 {
return ptr_ == ptr; }
1653 {
return ptr_ != ptr.
ptr_; }
1660 {
return ptr_ != ptr; }
1667 {
return ptr_ < ptr.
ptr_; }
1674 {
return ptr_ < ptr; }
1681 {
return ptr_ <= ptr.
ptr_; }
1688 {
return ptr_ <= ptr; }
1695 {
return ptr_ > ptr.
ptr_; }
1702 {
return ptr_ > ptr; }
1709 {
return ptr_ >= ptr.
ptr_; }
1716 {
return ptr_ >= ptr; }
1722 {
return (ptr_ == NULL); }
1728 {
return (ptr_ != NULL); }
1762 static void set(C& dest, T value)
1769 static void add(C& dest, T value)
1785 static bool addq(C& dest, T value,
typename C::Value delim)
1792 static const T& value(
const T& src)
1802 operator unsigned char()
const 1804 operator unsigned short()
const 1806 operator unsigned int()
const 1808 operator unsigned long()
const 1810 operator unsigned long long()
const 1853 #define EVO_PDEFAULT ((T*)IntegerT<std::size_t>::MAX) 1858 #define EVO_PEMPTY ((T*)1) 1863 #define EVO_PPEMPTY ((T**)1) 1870 template<
class T,
int SZ=sizeof(T)>
1872 static T next(T v) {
1880 template<
class T>
struct NextPow2<T,1> {
1881 static uint8 next(uint8 v) {
1889 template<
class T>
struct NextPow2<T,2> {
1890 static uint16 next(uint16 v) {
1899 template<
class T>
struct NextPow2<T,4> {
1900 static uint32 next(uint32 v) {
1910 template<
class T>
struct NextPow2<T,8> {
1911 static uint64 next(uint64 v) {
1935 return impl::NextPow2<T>::next(v);
1950 template<
class Size>
1953 if (size <= minsize)
1956 if (size >= MAX_SIZE)
1958 return impl::NextPow2<Size>::next(size);
1968 {
return (num && (num & (num - 1)) == 0); }
FloatT< T > & operator=(ValNull)
Assignment operator to set as null.
Definition: type.h:1501
const T & operator*() const
Dereference operator (const).
Definition: type.h:1573
Nullable< T > & operator=(T value)
Constructor to init with value.
Definition: type.h:156
T & max(T &a, T &b)
Returns highest of given values.
Definition: alg.h:47
FloatT()
Constructor.
Definition: type.h:1469
FloatT< long double > FloatL
Basic long-double floating-point type (long double) – see FloatT.
Definition: type.h:1553
Bool & operator=(bool val)
Assignment operator.
Definition: type.h:601
static T inf()
Get infinity value.
Definition: type.h:1346
static bool isupper(char ch)
Check whether uppercase letter (A-Z).
Definition: type.h:827
static int minexp()
Get minimum allowed exponent.
Definition: type.h:1328
T value(T defval) const
Get underlying value or given default if null.
Definition: type.h:1530
FloatT< T > & operator=(T val)
Assignment operator.
Definition: type.h:1495
Char(char val)
Constructor.
Definition: type.h:871
Decimal digit (0-9)
Definition: type.h:707
Bool(bool val)
Constructor.
Definition: type.h:587
Nullable(T num)
Constructor to init with num.
Definition: type.h:142
Basic boolean type.
Definition: type.h:568
static bool isspace(char ch)
Check whether whitespace character (space, tab, newline, carrige return).
Definition: type.h:820
Nullable primitive base type.
Definition: type.h:119
IntegerT< uint32 > UInt32
Basic integer type (uint32) – see IntegerT.
Definition: type.h:1200
bool operator==(void *ptr) const
Equality operator.
Definition: type.h:1645
bool null() const
Get whether null.
Definition: type.h:318
Nullable< T > & set()
Set as null.
Definition: type.h:342
Char & operator=(ValNull)
Assignment operator to set as null.
Definition: type.h:891
FloatT(const FloatT< T > &val)
Copy constructor.
Definition: type.h:1475
CharT< T > & operator=(char val)
Assignment operator.
Definition: type.h:760
PtrBase< T, P > Base
This pointer base type.
Definition: type.h:1564
CharT< T > & operator=(ValNull)
Assignment operator to set as null by passing vNULL.
Definition: type.h:766
bool null() const
Get whether pointer is null.
Definition: type.h:1721
bool operator<(void *ptr) const
Less-than operator.
Definition: type.h:1673
bool operator>=(const Base &ptr) const
Greater-than-or-equals operator.
Definition: type.h:1708
bool operator!=(void *ptr) const
Inequality operator.
Definition: type.h:1659
static T nan()
Get Not-A-Number (NaN) value.
Definition: type.h:1369
T Type
Wrapped POD type.
Definition: type.h:681
static bool eq(T val1, T val2, T eps)
Get whether values are approximately equal using given epsilon value.
Definition: type.h:1399
static Digit digit(char ch)
Get digit type for character.
Definition: type.h:802
bool operator>(const Nullable< T > &val) const
Greater than operator.
Definition: type.h:247
virtual ~PureBase()
Destructor.
Definition: type.h:1978
Basic character type (char) – see CharT.
Definition: type.h:775
FloatT< T > This
This non-POD type
Definition: type.h:1292
IntegerT< uint > UInt
Basic integer type (unsigned int) – see IntegerT.
Definition: type.h:1165
Bool(const Bool &val)
Copy constructor.
Definition: type.h:581
IntegerT< T > & operator=(const IntegerT< T > &val)
Assignment operator.
Definition: type.h:1067
Nullable(const Nullable< T > &src)
Copy constructor.
Definition: type.h:130
bool operator<=(T val) const
Less than or equal operator.
Definition: type.h:238
static bool inf(T num)
Check whether value is infinite.
Definition: type.h:1352
const T & operator[](ulong index) const
Array access operator (const).
Definition: type.h:1613
bool valid() const
Get whether pointer is valid (not null).
Definition: type.h:1727
ValNull
Unique null value type and value (vNULL).
Definition: sys.h:1096
CharT()
Constructor.
Definition: type.h:734
static int maxlen(int base=10)
Get maximum formatted length for type at base.
Definition: type.h:1004
Hexadecimal character.
Definition: type.h:728
bool operator==(const Base &ptr) const
Equality operator.
Definition: type.h:1638
T & value()
Get underlying value.
Definition: type.h:336
static int digits(T num, int base=10)
Get number of digits for given number and base.
Definition: type.h:1028
bool operator!=(const Nullable< T > &val) const
Inequality operator.
Definition: type.h:193
IntegerT< ulongl > ULongL
Basic integer type (unsigned long long) – see IntegerT.
Definition: type.h:1179
IntegerT< ushort > UShort
Basic integer type (unsigned short) – see IntegerT.
Definition: type.h:1158
bool operator<=(const Base &ptr) const
Less-than-or-equals operator.
Definition: type.h:1680
CharT< T > & operator=(const CharT< char > &val)
Assignment operator.
Definition: type.h:753
bool operator>(T val) const
Greater than operator.
Definition: type.h:256
static T eps()
Get machine epsilon.
Definition: type.h:1377
bool operator>=(const PtrBase< T > &ptr1, const PtrBase< T, Atomic< T *> > &ptr2)
Greater-than-or-equals operator for managed pointer base and atomic pointer base. ...
Definition: atomic.h:1238
const T * ptr() const
Get current pointer (const).
Definition: type.h:1735
static int maxexp()
Get maximum allowed exponent.
Definition: type.h:1340
Char & operator=(char val)
Assignment operator.
Definition: type.h:885
T & operator*()
Dereference operator (mutable).
Definition: type.h:1583
Decimal character.
Definition: type.h:729
SafeBool()
Constructor.
Definition: type.h:82
Generic value conversion template.
Definition: type.h:1757
static bool eq(T val1, T val2)
Get whether values are approximately equal.
Definition: type.h:1388
T next_pow2(T v)
Get next power of 2 equal to or greater than given number.
Definition: type.h:1932
void EvoNullableType
Identify as nullable type.
Definition: type.h:1563
IntegerT< int64 > Int64
Basic integer type (int64) – see IntegerT.
Definition: type.h:1151
const T * operator->() const
Member access operator (const).
Definition: type.h:1593
Bool()
Constructor.
Definition: type.h:575
Basic integer type.
Definition: type.h:980
CharT< T > This
This non-POD type
Definition: type.h:680
int compare(const Nullable< T > &val) const
Comparison.
Definition: type.h:281
IntegerT< uint16 > UInt16
Basic integer type (uint16) – see IntegerT.
Definition: type.h:1193
IntegerT< ulong > ULong
Basic integer type (unsigned long) – see IntegerT.
Definition: type.h:1172
T value(T defval) const
Get underlying value or given default if null.
Definition: type.h:1089
T & operator*()
Dereference for explicit conversion to underlying type.
Definition: type.h:312
bool operator!=(T val) const
Inequality operator.
Definition: type.h:202
static T max()
Get maximum normalized value.
Definition: type.h:1334
static Category category(char ch)
Get character category.
Definition: type.h:782
bool operator<=(const PtrBase< T > &ptr1, const PtrBase< T, Atomic< T *> > &ptr2)
Less-than-or-equals operator for managed pointer base and atomic pointer base.
Definition: atomic.h:1220
IntegerT(const IntegerT< T > &val)
Copy constructor.
Definition: type.h:1054
bool operator!() const
Negation operator checks if NULL.
Definition: type.h:1631
T & operator[](ulong index)
Array access operator (mutable).
Definition: type.h:1623
bool operator!=(const Base &ptr) const
Inequality operator.
Definition: type.h:1652
IntegerT(T val)
Constructor.
Definition: type.h:1060
static bool isdigit(char ch)
Check whether a digit (0-9).
Definition: type.h:855
static int maxdigits_prec(int exp, int precision)
Get max formatting digits with given exponent and precision, including sign and any additional chars ...
Definition: type.h:1306
static T min()
Get minimum normalized value.
Definition: type.h:1322
Nullable< T > & operator=(const Nullable< T > &src)
Assignment/Copy operator.
Definition: type.h:149
Safe bool base class.
Definition: type.h:73
bool eq1(const Nullable< T > &val)
Get whether approximately equal to given value.
Definition: type.h:1510
Symbol character (printable but not alphanumeric)
Definition: type.h:705
Category
Character category.
Definition: type.h:702
bool operator==(const PtrBase< T > &ptr1, const PtrBase< T, Atomic< T *> > &ptr2)
Equality operator for managed pointer base and atomic pointer base.
Definition: atomic.h:1193
IntegerT< uint8 > UInt8
Basic integer type (uint8) – see IntegerT.
Definition: type.h:1186
Nullable< T > & operator=(ValNull)
Assignment operator to set as null.
Definition: type.h:164
Bool & operator=(const Bool &val)
Assignment operator.
Definition: type.h:594
FloatT(T val)
Constructor.
Definition: type.h:1481
static const EndT END
Special integer value for indicating end of items or no item.
Definition: type.h:1846
FloatT< T > & operator=(const FloatT< T > &val)
Assignment operator.
Definition: type.h:1488
const T & operator*() const
Dereference for explicit conversion to underlying type (const).
Definition: type.h:306
static const EndT ALL
Special integer value for indicating all items or all remaining items.
Definition: type.h:1839
IntegerT< longl > LongL
Basic integer type (long long) – see IntegerT.
Definition: type.h:1123
Nullable primitive character base type.
Definition: type.h:679
static bool nan(T num)
Get whether value is Not-A-Number (NaN).
Definition: type.h:1361
Evo container foundation types and macros.
bool operator!=(const PtrBase< T > &ptr1, const PtrBase< T, Atomic< T *> > &ptr2)
Inequality operator for managed pointer base and atomic pointer base.
Definition: atomic.h:1202
bool is_pow2(T num)
Get whether a number is a power of 2.
Definition: type.h:1967
int compare(T val) const
Comparison.
Definition: type.h:297
bool operator==(T val) const
Equality operator.
Definition: type.h:186
T Type
Wrapped POD type.
Definition: type.h:1293
void EvoNullableType
Identify as nullable type.
Definition: type.h:121
bool operator<(T val) const
Less than operator.
Definition: type.h:220
T * ptr()
Get current pointer (mutable).
Definition: type.h:1743
bool operator>=(T val) const
Greater than or equal operator.
Definition: type.h:274
bool operator<(const Base &ptr) const
Less-than operator.
Definition: type.h:1666
bool operator>=(const Nullable< T > &val) const
Greater than or equal operator.
Definition: type.h:265
Evo C++ Library namespace.
Definition: alg.h:11
IntegerT< int32 > Int32
Basic integer type (int32) – see IntegerT.
Definition: type.h:1144
static const EndT NONE
Special integer value for indicating no item or unknown item.
Definition: type.h:1832
static T exp10(T num, int exp)
Multiply number by 10 raised to exponent.
Definition: type.h:1407
IntegerT< long > Long
Basic integer type (long) – see IntegerT.
Definition: type.h:1116
bool operator>=(void *ptr) const
Greater-than-or-equals operator.
Definition: type.h:1715
Whitespace (space, tab)
Definition: type.h:704
bool operator>(void *ptr) const
Greater-than operator.
Definition: type.h:1701
T & denull()
Clears null flag and returns value reference.
Definition: type.h:366
Char & operator=(const Char &val)
Assignment operator.
Definition: type.h:878
T Type
Wrapped POD type.
Definition: type.h:982
Char(const Char &val)
Copy constructor.
Definition: type.h:865
static bool islower(char ch)
Check whether lowercase letter (a-z).
Definition: type.h:834
bool operator==(const Nullable< T > &val) const
Equality operator.
Definition: type.h:177
IntegerT< uint64 > UInt64
Basic integer type (uint64) – see IntegerT.
Definition: type.h:1207
Check if type is a floating point type.
Definition: meta.h:277
Check if integer type is unsigned.
Definition: meta.h:296
CharT(const CharT< T > &val)
Copy constructor.
Definition: type.h:740
static T fexp10(int &exp, T num)
Extract normalized base 10 mantissa and exponent from number.
Definition: type.h:1438
bool operator>(const Base &ptr) const
Greater-than operator.
Definition: type.h:1694
bool operator!() const
Negation operator returns whether null or 0.
Definition: type.h:170
P ptr_
Pointer.
Definition: type.h:1566
T * operator->()
Member access operator (mutable).
Definition: type.h:1603
Alphabet – categories greater than this are alphabetic.
Definition: type.h:708
Base 36 character.
Definition: type.h:727
bool eq1(T val)
Get whether approximately equal to given value.
Definition: type.h:1521
Digit
Character digit type.
Definition: type.h:725
Bool & operator=(ValNull)
Assignment operator to set as null.
Definition: type.h:607
bool operator<=(void *ptr) const
Less-than-or-equals operator.
Definition: type.h:1687
IntegerT< T > This
This non-POD type
Definition: type.h:981
bool valid() const
Get whether valid (not null).
Definition: type.h:324
Pure base class, i.e.
Definition: type.h:1975
Nullable()
Constructor.
Definition: type.h:124
IntegerT< int16 > Int16
Basic integer type (int16) – see IntegerT.
Definition: type.h:1137
bool operator>(const PtrBase< T > &ptr1, const PtrBase< T, Atomic< T *> > &ptr2)
Greater-than operator for managed pointer base and atomic pointer base.
Definition: atomic.h:1229
Nullable basic floating-point base type.
Definition: type.h:1291
Alpha-numeric – categories greater than this are alphanumeric.
Definition: type.h:706
bool Type
Wrapped type (bool)
Definition: type.h:569
IntegerT()
Constructor.
Definition: type.h:1048
static bool isalnum(char ch)
Check whether alphanumeric (A-Z, a-z, 0-9).
Definition: type.h:848
const T & value() const
Get underlying value (const).
Definition: type.h:330
static bool isalpha(char ch)
Check whether alphabetic (A-Z, a-z).
Definition: type.h:841
bool operator<(const PtrBase< T > &ptr1, const PtrBase< T, Atomic< T *> > &ptr2)
Less-than operator for managed pointer base and atomic pointer base.
Definition: atomic.h:1211
Alphabet uppercase (A-Z)
Definition: type.h:709
Base managed pointer.
Definition: type.h:1562
IntegerT< short > Short
Basic integer type (short) – see IntegerT.
Definition: type.h:1102
Char()
Constructor.
Definition: type.h:859
T & min(T &a, T &b)
Returns lowest of given values.
Definition: alg.h:26
FloatT< float > Float
Basic single-precision floating-point type (float) – see FloatT.
Definition: type.h:1539
IntegerT< T > & operator=(T val)
Assignment operator.
Definition: type.h:1074
static T precision()
Get best precision value.
Definition: type.h:1314
Size size_pow2(Size size, Size minsize=2)
Get size as power of 2.
Definition: type.h:1951
IntegerT< int > Int
Basic integer type (int) – see IntegerT.
Definition: type.h:1109
Nullable(ValNull)
Constructor to explicitly set as null.
Definition: type.h:136
IntegerT< int8 > Int8
Basic integer type (int8) – see IntegerT.
Definition: type.h:1130
CharT(T val)
Constructor.
Definition: type.h:746
FloatT< double > FloatD
Basic double-precision floating-point type (double) – see FloatT.
Definition: type.h:1546
IntegerT< T > & operator=(ValNull)
Assignment operator to set as null by passing vNULL.
Definition: type.h:1080