Evo C++ Library v0.5.1
Namespaces | Classes | Macros | Typedefs | Functions | Variables
EvoCore

Evo core types and primitives. More...

Namespaces

 evo
 Evo C++ Library namespace.
 

Classes

struct  Bool
 Basic boolean type. More...
 
struct  Char
 Basic character type (char) – see CharT. More...
 
struct  CharT< T >
 Nullable primitive character base type. More...
 
struct  Convert< T, C >
 Generic value conversion template. More...
 
struct  FloatT< T >
 Nullable basic floating-point base type. More...
 
struct  IntegerT< T >
 Basic integer type. More...
 
struct  IsSmartPtr< T >
 Check if type is a SmartPtr or SharedPtr. More...
 
class  Nullable< T >
 Nullable primitive base type. More...
 
class  Ptr< T >
 Dumb pointer to single object. More...
 
class  Ptr< T[]>
 Dumb pointer to array. More...
 
struct  PtrBase< T, P >
 Base managed pointer. More...
 
class  PureBase
 Pure base class, i.e. More...
 
struct  RawBuffer
 Simple raw memory buffer. More...
 
class  SafeBool< T >
 Safe bool base class. More...
 
class  SharedPtr< T, TSize >
 Shared smart pointer to single object. More...
 
class  SharedPtr< T[], TSize >
 Shared smart pointer to array. More...
 
class  SmartPtr< T >
 Smart pointer to single object. More...
 
class  SmartPtr< T[]>
 Smart pointer to array. More...
 

Macros

#define EVO_ALLOCATORS   0
 Enable container allocators – NOT YET SUPPORTED. More...
 
#define EVO_CATCH_DEBUG   0
 Enable additional debug info when printing exceptions from EVO_CATCH() and EVO_CATCH_MT(). More...
 
#define EVO_CNULL   ((const char*)0)
 Shortcut for NULL as const-char pointer. More...
 
#define EVO_EXCEPTIONS   1
 Whether to throw exceptions on error by default. More...
 
#define EVO_LIST_OPT_EXTREF   1
 List: Enable optimization for referencing external lists rather than copying. More...
 
#define EVO_LIST_OPT_LAZYBUF   1
 List: Enable lazy buffer optimization for keeping buffer when not used. More...
 
#define EVO_LIST_OPT_LAZYREM   0
 List: Enable lazy removal optimization when removing items. More...
 
#define EVO_LIST_OPT_REFTERM   0
 List: Enable optimization when referencing terminated lists. More...
 
#define EVO_LIST_REALLOC   1
 List: Enable using realloc to resize buffer. More...
 
#define EVO_MAX(A, B)   ((B) > (A) ? (B) : (A))
 Macro returning highest argument. More...
 
#define EVO_MIN(A, B)   ((B) < (A) ? (B) : (A))
 Macro returning lowest argument. More...
 
#define EVO_PDEFAULT   ((T*)IntegerT<std::size_t>::MAX)
 Special pointer value for default initialization (used in containers). More...
 
#define EVO_PEMPTY   ((T*)1)
 Special pointer value for empty but not NULL (used in containers). More...
 
#define EVO_PPEMPTY   ((T**)1)
 Special pointer value for empty but not NULL (used in containers). More...
 
#define EVO_SIZE_TYPE   uint32
 Sets default size type for Evo containers. More...
 
#define EVO_STD_STRING   0
 Whether to support std::string compatibility in Evo string classes (String, SubString). More...
 
#define EVO_STD_STRING_VIEW   0
 Whether to support std::string_view compatibility in Evo string classes (String, SubString). More...
 
#define EVO_STR_SIZE_TYPE   uint32
 Sets default string size type for Evo string containers. More...
 
#define EVO_VERSION   0.5
 Evo version number (major.minor). More...
 
#define EVO_VERSION_PATCH   1
 Evo version patch number. More...
 
#define EVO_VERSION_STRING   "0.5.1"
 Evo version string (major.minor.patch). More...
 
#define EVO_VNULL   ((void*)0)
 Shortcut for NULL as void-pointer. More...
 

Typedefs

typedef FloatT< float > Float
 Basic single-precision floating-point type (float) – see FloatT. More...
 
typedef FloatT< double > FloatD
 Basic double-precision floating-point type (double) – see FloatT. More...
 
typedef FloatT< long double > FloatL
 Basic long-double floating-point type (long double) – see FloatT. More...
 
typedef IntegerT< int > Int
 Basic integer type (int) – see IntegerT. More...
 
typedef IntegerT< int16 > Int16
 Basic integer type (int16) – see IntegerT. More...
 
typedef IntegerT< int32 > Int32
 Basic integer type (int32) – see IntegerT. More...
 
typedef IntegerT< int64 > Int64
 Basic integer type (int64) – see IntegerT. More...
 
typedef IntegerT< int8 > Int8
 Basic integer type (int8) – see IntegerT. More...
 
typedef IntegerT< long > Long
 Basic integer type (long) – see IntegerT. More...
 
typedef IntegerT< longl > LongL
 Basic integer type (long long) – see IntegerT. More...
 
typedef IntegerT< short > Short
 Basic integer type (short) – see IntegerT. More...
 
typedef IntegerT< uint > UInt
 Basic integer type (unsigned int) – see IntegerT. More...
 
typedef IntegerT< uint16 > UInt16
 Basic integer type (uint16) – see IntegerT. More...
 
typedef IntegerT< uint32 > UInt32
 Basic integer type (uint32) – see IntegerT. More...
 
typedef IntegerT< uint64 > UInt64
 Basic integer type (uint64) – see IntegerT. More...
 
typedef IntegerT< uint8 > UInt8
 Basic integer type (uint8) – see IntegerT. More...
 
typedef IntegerT< ulong > ULong
 Basic integer type (unsigned long) – see IntegerT. More...
 
typedef IntegerT< ulongl > ULongL
 Basic integer type (unsigned long long) – see IntegerT. More...
 
typedef IntegerT< ushort > UShort
 Basic integer type (unsigned short) – see IntegerT. More...
 

Functions

template<class T >
bool is_pow2 (T num)
 Get whether a number is a power of 2. More...
 
template<class T >
next_pow2 (T v)
 Get next power of 2 equal to or greater than given number. More...
 
template<class T >
bool operator!= (T val1, const Nullable< T > &val2)
 Inequality operator comparing value with Nullable value. More...
 
template<class T >
bool operator< (T val1, const Nullable< T > &val2)
 Less than operator comparing value with Nullable value. More...
 
template<class T >
bool operator<= (T val1, const Nullable< T > &val2)
 Less than or equal operator comparing value with Nullable value. More...
 
template<class T >
bool operator== (T val1, const Nullable< T > &val2)
 Equality operator comparing value with Nullable value. More...
 
template<class T >
bool operator> (T val1, const Nullable< T > &val2)
 Greater than operator comparing value with Nullable value. More...
 
template<class T >
bool operator>= (T val1, const Nullable< T > &val2)
 Greater than or equal operator comparing value with Nullable value. More...
 
template<class Size >
Size size_pow2 (Size size, Size minsize=2)
 Get size as power of 2. More...
 

Variables

static const EndT ALL
 Special integer value for indicating all items or all remaining items. More...
 
static const EndT END
 Special integer value for indicating end of items or no item. More...
 
static const EndT NONE
 Special integer value for indicating no item or unknown item. More...
 

Detailed Description

Evo core types and primitives.

Macro Definition Documentation

◆ EVO_ALLOCATORS

#define EVO_ALLOCATORS   0

Enable container allocators – NOT YET SUPPORTED.

  • Default: 0

◆ EVO_CATCH_DEBUG

#define EVO_CATCH_DEBUG   0

Enable additional debug info when printing exceptions from EVO_CATCH() and EVO_CATCH_MT().

  • Default: 0
  • Enabling this changes the EVO_CATCH() helpers to include source file path and line number in the exception error message

◆ EVO_CNULL

#define EVO_CNULL   ((const char*)0)

Shortcut for NULL as const-char pointer.

◆ EVO_EXCEPTIONS

#define EVO_EXCEPTIONS   1

Whether to throw exceptions on error by default.

  • Default: 1
  • Disabling exceptions can help performance when critical, however error codes should then be checked directly

◆ EVO_LIST_OPT_EXTREF

#define EVO_LIST_OPT_EXTREF   1

List: Enable optimization for referencing external lists rather than copying.

  • When enabled, each String variable uses a little more memory
  • Disabling this also disables EVO_LIST_OPT_LAZYBUF and EVO_LIST_OPT_EXTREF (?)
  • Default: 1

◆ EVO_LIST_OPT_LAZYBUF

#define EVO_LIST_OPT_LAZYBUF   1

List: Enable lazy buffer optimization for keeping buffer when not used.

  • When enabled, list buffer is not immediately freed when unused in case it's needed again
  • Default: 1

◆ EVO_LIST_OPT_LAZYREM

#define EVO_LIST_OPT_LAZYREM   0

List: Enable lazy removal optimization when removing items.

  • When enabled, List::remove() will trim begining/end items, to be actually removed later
  • Can improve performance when beginning and/or end items are added and removed a lot
  • Default: 0

◆ EVO_LIST_OPT_REFTERM

#define EVO_LIST_OPT_REFTERM   0

List: Enable optimization when referencing terminated lists.

  • When enabled, each String variable uses a little more memory (4 bytes)
  • Can improve performance when list referencing external terminated list and using cstr()
  • Default: 1

◆ EVO_LIST_REALLOC

#define EVO_LIST_REALLOC   1

List: Enable using realloc to resize buffer.

  • This could improve performance in some systems
  • Default: 1

◆ EVO_MAX

#define EVO_MAX (   A,
 
)    ((B) > (A) ? (B) : (A))

Macro returning highest argument.

Parameters
AFirst number
BSecond number
Returns
Max number

◆ EVO_MIN

#define EVO_MIN (   A,
 
)    ((B) < (A) ? (B) : (A))

Macro returning lowest argument.

Parameters
AFirst number
BSecond number
Returns
Max number

◆ EVO_PDEFAULT

#define EVO_PDEFAULT   ((T*)IntegerT<std::size_t>::MAX)

Special pointer value for default initialization (used in containers).

  • This only works inside container classes with item type "T" defined

◆ EVO_PEMPTY

#define EVO_PEMPTY   ((T*)1)

Special pointer value for empty but not NULL (used in containers).

  • This only works inside container classes with item type "T" defined

◆ EVO_PPEMPTY

#define EVO_PPEMPTY   ((T**)1)

Special pointer value for empty but not NULL (used in containers).

  • This only works inside container classes with item type "T" defined

◆ EVO_SIZE_TYPE

#define EVO_SIZE_TYPE   uint32

Sets default size type for Evo containers.

  • Default: uint32
  • Always unsigned
  • This becomes type: SizeT

◆ EVO_STD_STRING

#define EVO_STD_STRING   0

Whether to support std::string compatibility in Evo string classes (String, SubString).

  • Default: 0 (auto-detect, enable if std::string include detected)
  • By default this will try to auto-detect whether STL string has been included already, and if so enable std::string support
  • Set to 1 to explicitly enable (and auto-include for std::string), -1 to explicitly disable and skip auto-detect
  • Set this BEFORE including any Evo headers
  • When enabled, any function that takes "const StringBase&" will automatically support "const std::string&" and "const std::string*"
  • See also: EVO_STD_STRING and String Passing

◆ EVO_STD_STRING_VIEW

#define EVO_STD_STRING_VIEW   0

Whether to support std::string_view compatibility in Evo string classes (String, SubString).

  • Default: 0 (auto-detect, enable if std::string_view include detected)
  • By default this will try to auto-detect whether STL string_view has been included already, and if so enable std::string_view support
  • Set to 1 to explicitly enable (and auto-include for std::string_view), -1 to explicitly disable and skip auto-detect
  • Set this BEFORE including any Evo headers
  • When enabled, any function that takes "const StringBase&" will automatically support "const std::string_view&" and "const std::string_view*"
  • This is ignored if C++17 (or string_view) is not supported
  • See also: EVO_STD_STRING and String Passing

◆ EVO_STR_SIZE_TYPE

#define EVO_STR_SIZE_TYPE   uint32

Sets default string size type for Evo string containers.

  • Default: uint32
  • Always unsigned
  • This becomes type: StrSizeT

◆ EVO_VERSION

#define EVO_VERSION   0.5

Evo version number (major.minor).

◆ EVO_VERSION_PATCH

#define EVO_VERSION_PATCH   1

Evo version patch number.

◆ EVO_VERSION_STRING

#define EVO_VERSION_STRING   "0.5.1"

Evo version string (major.minor.patch).

◆ EVO_VNULL

#define EVO_VNULL   ((void*)0)

Shortcut for NULL as void-pointer.

Typedef Documentation

◆ Float

typedef FloatT<float> Float

Basic single-precision floating-point type (float) – see FloatT.

A basic Evo container for floating-point values.

Float num(12.3f);

◆ FloatD

typedef FloatT<double> FloatD

Basic double-precision floating-point type (double) – see FloatT.

A basic Evo container for floating-point values.

FloatD num(12.3);

◆ FloatL

typedef FloatT<long double> FloatL

Basic long-double floating-point type (long double) – see FloatT.

A basic Evo container for floating-point values.

FloatL num(12.3L);

◆ Int

typedef IntegerT<int> Int

Basic integer type (int) – see IntegerT.

A basic Evo container for integer values.

Int num(123);

◆ Int16

typedef IntegerT<int16> Int16

Basic integer type (int16) – see IntegerT.

A basic Evo container for integer values.

Int16 num(123);

◆ Int32

typedef IntegerT<int32> Int32

Basic integer type (int32) – see IntegerT.

A basic Evo container for integer values.

Int32 num(123);

◆ Int64

typedef IntegerT<int64> Int64

Basic integer type (int64) – see IntegerT.

A basic Evo container for integer values.

Int64 num(123);

◆ Int8

typedef IntegerT<int8> Int8

Basic integer type (int8) – see IntegerT.

A basic Evo container for integer values.

Int8 num(123);

◆ Long

typedef IntegerT<long> Long

Basic integer type (long) – see IntegerT.

A basic Evo container for integer values.

Long num(123);

◆ LongL

typedef IntegerT<longl> LongL

Basic integer type (long long) – see IntegerT.

A basic Evo container for integer values.

LongL num(123);

◆ Short

typedef IntegerT<short> Short

Basic integer type (short) – see IntegerT.

A basic Evo container for integer values.

Short num(123);

◆ UInt

typedef IntegerT<uint> UInt

Basic integer type (unsigned int) – see IntegerT.

A basic Evo container for integer values.

uint num(123);

◆ UInt16

typedef IntegerT<uint16> UInt16

Basic integer type (uint16) – see IntegerT.

A basic Evo container for integer values.

UInt16 num(123);

◆ UInt32

typedef IntegerT<uint32> UInt32

Basic integer type (uint32) – see IntegerT.

A basic Evo container for integer values.

UInt32 num(123);

◆ UInt64

typedef IntegerT<uint64> UInt64

Basic integer type (uint64) – see IntegerT.

A basic Evo container for integer values.

UInt64 num(123);

◆ UInt8

typedef IntegerT<uint8> UInt8

Basic integer type (uint8) – see IntegerT.

A basic Evo container for integer values.

UInt8 num(123);

◆ ULong

typedef IntegerT<ulong> ULong

Basic integer type (unsigned long) – see IntegerT.

A basic Evo container for integer values.

ulong num(123);

◆ ULongL

typedef IntegerT<ulongl> ULongL

Basic integer type (unsigned long long) – see IntegerT.

A basic Evo container for integer values.

ulongl num(123);

◆ UShort

typedef IntegerT<ushort> UShort

Basic integer type (unsigned short) – see IntegerT.

A basic Evo container for integer values.

ushort num(123);

Function Documentation

◆ is_pow2()

bool evo::is_pow2 ( num)
inline

Get whether a number is a power of 2.

Template Parameters
TNumber type, inferred from param
Parameters
numNumber to check
Returns
Whether num is a power of 2

◆ next_pow2()

T evo::next_pow2 ( v)
inline

Get next power of 2 equal to or greater than given number.

Template Parameters
TNumber type, inferred from param – must be unsigned
Parameters
vValue to get next power of 2 from
Returns
Next power of 2 that's greater than or equal to v, 0 on overflow
See also
size_pow2()

◆ operator!=()

bool evo::operator!= ( val1,
const Nullable< T > &  val2 
)
inline

Inequality operator comparing value with Nullable value.

  • If val2 is null, the result is always true as null is not equal to any non-null value
Parameters
val1Value to compare
val2Value to compare to
Returns
Whether inequal, true if null

◆ operator<()

bool evo::operator< ( val1,
const Nullable< T > &  val2 
)
inline

Less than operator comparing value with Nullable value.

  • If val2 is null, no non-null value is less than null
Parameters
val1Value to compare
val2Value to compare to
Returns
Whether val1 is less than val2, false if val2 is null

◆ operator<=()

bool evo::operator<= ( val1,
const Nullable< T > &  val2 
)
inline

Less than or equal operator comparing value with Nullable value.

  • If val2 is null, no non-null value is less than null
Parameters
val1Value to compare
val2Value to compare to
Returns
Whether val1 is less than or equal to val2, false if val2 is null

◆ operator==()

bool evo::operator== ( val1,
const Nullable< T > &  val2 
)
inline

Equality operator comparing value with Nullable value.

  • If val2 is null, the result is always false as null is not equal to any non-null value
Parameters
val1Value to compare
val2Value to compare to
Returns
Whether equal, false if null

◆ operator>()

bool evo::operator> ( val1,
const Nullable< T > &  val2 
)
inline

Greater than operator comparing value with Nullable value.

  • If val2 is null, any non-null value is greater than null
Parameters
val1Value to compare
val2Value to compare to
Returns
Whether val1 is greater than val2, true if val2 is null

◆ operator>=()

bool evo::operator>= ( val1,
const Nullable< T > &  val2 
)
inline

Greater than or equal operator comparing value with Nullable value.

  • If val2 is null, any non-null value is greater than null
Parameters
val1Value to compare
val2Value to compare to
Returns
Whether val1 is greater or equal to val2, true if val2 is null

◆ size_pow2()

Size evo::size_pow2 ( Size  size,
Size  minsize = 2 
)
inline

Get size as power of 2.

  • This finds the lowest power of 2 that fits input size, and is at least minsize
  • On overflow the max power of 2 for Size is returned
  • Using powers of 2 allows a "faster modulus" on size using a mask (size - 1):
    • i & (size - 1) is equivalent to i % size
Template Parameters
SizeSize type to use, inferred from params
Parameters
sizeInput size to convert to power of 2
minsizeMinimum allowed size – must be positive and a power of 2
Returns
Requested size as power of 2, always positive 0
See also
next_pow2()

Variable Documentation

◆ ALL

const EndT ALL
static

Special integer value for indicating all items or all remaining items.

  • Passed to methods like replace()
  • Evo uses unsigned Size types, so this is used instead of the common special index value -1
  • Implicitly converts and compares with any Size (integer) type – actual value is the max integer of the type converted/compared to

◆ END

const EndT END
static

Special integer value for indicating end of items or no item.

  • Passed as a position/index to methods like find()
  • Evo uses unsigned Size types, so this is used instead of the common special index value -1
  • Implicitly converts and compares with any Size (integer) type – actual value is the max integer of the type converted/compared to

◆ NONE

const EndT NONE
static

Special integer value for indicating no item or unknown item.

  • Returned by methods like find()
  • Evo uses unsigned Size types, so this is used instead of the common special index value -1
  • Implicitly converts and compares with any Size (integer) type – actual value is the max integer of the type converted/compared to