Evo C++ Library v0.5.1
|
#include <evo/type.h>
Basic integer type.
A basic Evo container template for integer types.
T | Integer plain type (short, int, long, longl, ushort, uint, ulong, ulongl, etc) |
Integer types:
Examples – using Int type (and int type) here, other supported integer types work the same:
Public Types | |
typedef void | EvoNullableType |
Identify as nullable type. More... | |
typedef IntegerT< T > | This |
This non-POD type More... | |
typedef T | Type |
Wrapped POD type. More... | |
Public Member Functions | |
IntegerT () | |
Constructor. More... | |
IntegerT (const IntegerT< T > &val) | |
Copy constructor. More... | |
IntegerT (T val) | |
Constructor. More... | |
int | compare (const Nullable< T > &val) const |
Comparison. More... | |
int | compare (T val) const |
Comparison. More... | |
T & | denull () |
Clears null flag and returns value reference. More... | |
bool | null () const |
Get whether null. More... | |
operator SafeBoolType () const | |
Safe (explicit) evaluation as bool type. More... | |
bool | operator! () const |
Negation operator returns whether null or 0. More... | |
bool | operator!= (const Nullable< T > &val) const |
Inequality operator. More... | |
bool | operator!= (T val) const |
Inequality operator. More... | |
const T & | operator* () const |
Dereference for explicit conversion to underlying type (const). More... | |
T & | operator* () |
Dereference for explicit conversion to underlying type. More... | |
bool | operator< (const Nullable< T > &val) const |
Less than operator. More... | |
bool | operator< (T val) const |
Less than operator. More... | |
bool | operator<= (const Nullable< T > &val) const |
Less than or equal operator. More... | |
bool | operator<= (T val) const |
Less than or equal operator. More... | |
IntegerT< T > & | operator= (const IntegerT< T > &val) |
Assignment operator. More... | |
IntegerT< T > & | operator= (T val) |
Assignment operator. More... | |
IntegerT< T > & | operator= (ValNull) |
Assignment operator to set as null by passing vNULL. More... | |
bool | operator== (const Nullable< T > &val) const |
Equality operator. More... | |
bool | operator== (T val) const |
Equality operator. More... | |
bool | operator> (const Nullable< T > &val) const |
Greater than operator. More... | |
bool | operator> (T val) const |
Greater than operator. More... | |
bool | operator>= (const Nullable< T > &val) const |
Greater than or equal operator. More... | |
bool | operator>= (T val) const |
Greater than or equal operator. More... | |
Nullable< T > & | set () |
Set as null. More... | |
Nullable< T > & | set (const Nullable< T > &src) |
Set as copy of given value. More... | |
Nullable< T > & | set (T src) |
Set as given value. More... | |
bool | valid () const |
Get whether valid (not null). More... | |
const T & | value () const |
Get underlying value (const). More... | |
T & | value () |
Get underlying value. More... | |
T | value (T defval) const |
Get underlying value or given default if null. More... | |
Static Public Member Functions | |
static int | digits (T num, int base=10) |
Get number of digits for given number and base. More... | |
static int | maxlen (int base=10) |
Get maximum formatted length for type at base. More... | |
Static Public Attributes | |
static const T | ALLBITS = T(~ZERO) |
Mask with all bits set. More... | |
static const int | BITS = sizeof(T) * 8 |
Type size in bits. More... | |
static const int | BITS_MINUS_1 = BITS - 1 |
BITS minus 1, used by bit manipulation code. More... | |
static const int | BYTES = sizeof(T) |
Type size in bytes. More... | |
static const T | LBIT = RBIT << BITS_MINUS_1 |
Mask with left-most (most significant) bit set. More... | |
static const T | MAX = (SIGN ? ~LBIT : ALLBITS) |
Maximum interger value. More... | |
static const int | MAXSTRLEN = impl::IntMaxLen<sizeof(T)>::value |
Max formatted length, including either sign or hex/octal prefix (0x/0), but not both. More... | |
static const T | MIN = (SIGN ? LBIT : 0) |
Minimum integer value. More... | |
static const T | RBIT = 0x01 |
Mask with right-most (least significant) bit set. More... | |
static const bool | SIGN = IsSigned<T>::value |
Whether type is signed. More... | |
static const T | ZERO = 0 |
Mask with all bits cleared (no bits set) More... | |
|
inherited |
Identify as nullable type.
typedef T Type |
Wrapped POD type.
|
inline |
Constructor.
|
inline |
Constructor.
val | Value to set |
|
inlineinherited |
Comparison.
val | Value to compare to |
|
inlineinherited |
Comparison.
val | Value to compare to |
|
inlineinherited |
Clears null flag and returns value reference.
Nullable<bool>
template specialization returns by value instead of reference
|
inlinestatic |
Get number of digits for given number and base.
Includes sign if negative.
num | Number to use |
base | Number base to use |
|
inlinestatic |
Get maximum formatted length for type at base.
base | Number base to use |
|
inlineinherited |
Get whether null.
|
inlineinherited |
Safe (explicit) evaluation as bool type.
|
inlineinherited |
Negation operator returns whether null or 0.
Inequality operator.
val | Value to compare to |
|
inlineinherited |
Inequality operator.
val | Value to compare to |
|
inlineinherited |
Dereference for explicit conversion to underlying type (const).
Alternative to value().
|
inlineinherited |
Dereference for explicit conversion to underlying type.
Alternative to value().
|
inlineinherited |
Less than operator.
val | Value to compare to |
val
|
inlineinherited |
Less than operator.
val | Value to compare to |
val
|
inlineinherited |
Less than or equal operator.
val | Value to compare to |
val
, true if null
|
inlineinherited |
Less than or equal operator.
val | Value to compare to |
val
, true if null Assignment operator.
val | Value to copy |
|
inline |
Assignment operator.
val | Value to set |
Assignment operator to set as null by passing vNULL.
|
inlineinherited |
Equality operator.
val | Value to compare to |
|
inlineinherited |
Equality operator.
val | Value to compare to |
|
inlineinherited |
Greater than operator.
val | Value to compare to |
val
, false if null
|
inlineinherited |
Greater than operator.
val | Value to compare to |
val
, false if null
|
inlineinherited |
Greater than or equal operator.
val | Value to compare to |
val
|
inlineinherited |
Greater than or equal operator.
val | Value to compare to |
val
|
inlineinherited |
Set as null.
Set as copy of given value.
src | Source to copy |
|
inlineinherited |
Set as given value.
src | Source to set |
|
inlineinherited |
Get whether valid (not null).
|
inlineinherited |
|
inlineinherited |
|
inline |
Get underlying value or given default if null.
defval | Default value to use if null |
|
static |
Mask with all bits set.
|
static |
Type size in bits.
|
static |
BITS minus 1, used by bit manipulation code.
|
static |
Type size in bytes.
|
static |
Mask with left-most (most significant) bit set.
|
static |
Max formatted length, including either sign or hex/octal prefix (0x/0), but not both.
|
static |
Mask with right-most (least significant) bit set.
|
static |
Mask with all bits cleared (no bits set)