Kicking it Olde Sküül! Burgerlib on Github Follow Olde Sküül on Twitter Burgerbecky on LinkedIn Burgerbecky on LinkedIn
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
Burger::ArgumentType Class Reference

Container class for passing data to SafePrint. More...

Inheritance diagram for Burger::ArgumentType:
Inheritance graph
[legend]
Collaboration diagram for Burger::ArgumentType:
Collaboration graph
[legend]

Public Member Functions

template<class T >
 ArgumentType (T Input) noexcept
 Constructor most data types.
 
 ArgumentType (uint16_t fInput, eArgumentType uType) noexcept
 Constructor for a 16 bit float.
 
 ArgumentType (const String *pString) noexcept
 Constructor for a pointer to a Burgerlib String.
 
 ArgumentType (const String &rString) noexcept
 Constructor for a reference to a Burgerlib String.
 
 ArgumentType (__m64 Input) noexcept
 Constructor for an MMX 64 bit value.
 
 ArgumentType (__m64 *pInput) noexcept
 Constructor for a pointer to a MMX 64 bit value.
 
 ArgumentType (const __m64 *pInput) noexcept
 Constructor for a pointer to a MMX 64 bit value.
 
 ArgumentType (const __m128 &rInput) noexcept
 Constructor for an SSE 128 bit value (4 floats)
 
 ArgumentType (const __m128d &rInput) noexcept
 Constructor for an SSE 128 bit value (2 doubles)
 
 ArgumentType (const __m128i &rInput) noexcept
 Constructor for an SSE 128 bit value (4 integers)
 
 ArgumentType (__m128 *pInput) noexcept
 Constructor for a pointer to a SSE 128 bit value (4 floats)
 
 ArgumentType (const __m128 *pInput) noexcept
 Constructor for a pointer to a SSE 128 bit value (4 floats)
 
 ArgumentType (__m128d *pInput) noexcept
 Constructor for a pointer to a SSE 128 bit value (2 doubles.
 
 ArgumentType (const __m128d *pInput) noexcept
 Constructor for a pointer to a SSE 128 bit value (2 doubles.
 
 ArgumentType (__m128i *pInput) noexcept
 Constructor for a pointer to a SSE 128 bit value (4 integers)
 
 ArgumentType (const __m128i *pInput) noexcept
 Constructor for a pointer to a SSE 128 bit value (4 integers)
 
 ArgumentType (void *pInput) noexcept
 Constructor for a pointer.
 
 ArgumentType (const void *pInput) noexcept
 Constructor for a pointer.
 
uint_t IsNumeric (void) const noexcept
 Test if the data is a numeric value.
 
uint_t IsInteger (void) const noexcept
 Test if the data is an integer numeric value.
 
uint_t IsSigned (void) const noexcept
 Test if the data is a signed integer value.
 
uint_t IsUnsigned (void) const noexcept
 Test if the data is an unsigned integer value.
 
uint_t IsBoolean (void) const noexcept
 Test if the data is a boolean.
 
uint_t IsReal (void) const noexcept
 Test if the data is a floating point value.
 
uint_t IsNegative (void) const noexcept
 Returns TRUE if the stored value is negative.
 
uint_t IsZero (void) const noexcept
 Returns TRUE if the stored value is zero.
 
uint_t IsCharacter (void) const noexcept
 Test if the data is a character type.
 
uint_t IsTextPointer (void) const noexcept
 Test if the data is a pointer to a "C" string.
 
uint_t IsPointer (void) const noexcept
 Test if the data is a pointer.
 
uint_t Is64Bit (void) const noexcept
 Test if the data is a 64 bits wide.
 
uint_t IsSIMD (void) const noexcept
 Test if the data is a vector value.
 
uint_t IsSIMDPointer (void) const noexcept
 Test if the data is a pointer to a vector value.
 
uintptr_t GetDataLengthInBytes (void) const noexcept
 Returns the size of the stored data in bytes.
 
const void * GetDataAddress (void) const noexcept
 Returns the pointer the stored data.
 
eArgumentType GetType (void) const noexcept
 Return the type of data contained in the container.
 
void SetType (eArgumentType uType) noexcept
 Set the type of data contained in the container.
 
const char * GetTypeName (void) const noexcept
 Returns the name of the data type contained.
 
int32_t GetInt32 (void) const noexcept
 Returns the value as a signed 32 bit integer.
 
uint32_t GetUInt32 (void) const noexcept
 Returns the value as an unsigned 32 bit integer.
 
int64_t GetInt64 (void) const noexcept
 Returns the value as a signed 64 bit integer.
 
uint64_t GetUInt64 (void) const noexcept
 Returns the value as an unsigned 64 bit integer.
 
char GetChar (void) const noexcept
 Returns the value as a single character.
 
uint_t GetBool (void) const noexcept
 Returns the value as a boolean.
 
const void * GetPointer (void) const noexcept
 Returns the value as a pointer.
 
const char * GetText (void) const noexcept
 Returns the value as a "C" string pointer.
 
uintptr_t GetTextLength (void) const noexcept
 Returns the length of the "C" string.
 
uintptr_t GetUTF8 (char *pOutput) const noexcept
 Convert integer to UTF8 stream.
 

Static Public Member Functions

static const char * GetTypeName (eArgumentType uType) noexcept
 Returns the name of the data type.
 

Static Public Attributes

static const char kInvalidCharConversion = '~'
 Character returned from GetChar() const for invalid character.
 

Additional Inherited Members

- Public Attributes inherited from Burger::ArgumentType_t
ArgumentTypeDataUnion_t m_Data
 Data stored in the container.
 
eArgumentType m_eType
 Type of object found.
 

Detailed Description

Container class for passing data to SafePrint.


Instead of relying on ... for sending parameters to a function, use instances of this type exclusively so that all passed types are known at runtime so robust error checking can be performed.

It's currently used by the SafePrint class to ensure the passed parameters match the data types requested by the format string.

Constructor & Destructor Documentation

◆ ArgumentType() [1/18]

template<class T >
Burger::ArgumentType::ArgumentType ( T Input)
inlinenoexcept

Constructor most data types.


This template will invoke ArgumentType_Dispatch for processing. If it's a pointer, ArgumentType_DispatchPtr will subsequently be invoked to properly handle type determination.

Template Parameters
TData type to be processed
Parameters
InputData to be stored in this class.
See also
ArgumentType_Dispatch or ArgumentType_DispatchPtr

◆ ArgumentType() [2/18]

Burger::ArgumentType::ArgumentType ( uint16_t fInput,
eArgumentType uType )
inlinenoexcept

Constructor for a 16 bit float.


Since 16 bit floats are not native to C++, it has to be manually cast by creating an argument manually. Example is below.

SafePrintf("Float %hf\n",ArgumentType(
fHalf,ArgumentType::kTypeFloat16));
ArgumentType(T Input) noexcept
Constructor most data types.
Definition burger.h:11595
Parameters
fInputuint16_t representation of a 16 bit float
uTypeType override for the 16 bit short

◆ ArgumentType() [3/18]

Burger::ArgumentType::ArgumentType ( const String * pString)
inlinenoexcept

Constructor for a pointer to a Burgerlib String.


Parameters
pStringPointer to a Burgerlib String

◆ ArgumentType() [4/18]

Burger::ArgumentType::ArgumentType ( const String & rString)
inlinenoexcept

Constructor for a reference to a Burgerlib String.


Parameters
rStringReference to a Burgerlib String

◆ ArgumentType() [5/18]

Burger::ArgumentType::ArgumentType ( __m64 Input)
inlinenoexcept

Constructor for an MMX 64 bit value.


Parameters
InputA __m64 MMX 64 bit value

◆ ArgumentType() [6/18]

Burger::ArgumentType::ArgumentType ( __m64 * pInput)
inlinenoexcept

Constructor for a pointer to a MMX 64 bit value.


Note
Only available on x86 processors
Parameters
pInputPointer to a __m64 MMX 64 bit value

◆ ArgumentType() [7/18]

Burger::ArgumentType::ArgumentType ( const __m64 * pInput)
inlinenoexcept

Constructor for a pointer to a MMX 64 bit value.


Note
Only available on x86 processors
Parameters
pInputPointer to a __m64 MMX 64 bit value

◆ ArgumentType() [8/18]

Burger::ArgumentType::ArgumentType ( const __m128 & rInput)
inlinenoexcept

Constructor for an SSE 128 bit value (4 floats)


Note
Only available on x86 or x64 processors
Parameters
rInputA __m128 SSE 128 bit reference

◆ ArgumentType() [9/18]

Burger::ArgumentType::ArgumentType ( const __m128d & rInput)
inlinenoexcept

Constructor for an SSE 128 bit value (2 doubles)


Note
Only available on x86 or x64 processors
Parameters
rInputA __m128d SSE 128 bit reference

◆ ArgumentType() [10/18]

Burger::ArgumentType::ArgumentType ( const __m128i & rInput)
inlinenoexcept

Constructor for an SSE 128 bit value (4 integers)


Note
Only available on x86 or x64 processors
Parameters
rInputA __m128i SSE 128 bit reference

◆ ArgumentType() [11/18]

Burger::ArgumentType::ArgumentType ( __m128 * pInput)
inlinenoexcept

Constructor for a pointer to a SSE 128 bit value (4 floats)


Note
Only available on x86 or x64 processors
Parameters
pInputPointer to a __m128 SSE 128 bit value

◆ ArgumentType() [12/18]

Burger::ArgumentType::ArgumentType ( const __m128 * pInput)
inlinenoexcept

Constructor for a pointer to a SSE 128 bit value (4 floats)


Note
Only available on x86 or x64 processors
Parameters
pInputPointer to a __m128 SSE 128 bit value

◆ ArgumentType() [13/18]

Burger::ArgumentType::ArgumentType ( __m128d * pInput)
inlinenoexcept

Constructor for a pointer to a SSE 128 bit value (2 doubles.


Note
Only available on x86 or x64 processors
Parameters
pInputPointer to a __m128d SSE 128 bit value

◆ ArgumentType() [14/18]

Burger::ArgumentType::ArgumentType ( const __m128d * pInput)
inlinenoexcept

Constructor for a pointer to a SSE 128 bit value (2 doubles.


Note
Only available on x86 or x64 processors
Parameters
pInputPointer to a __m128d SSE 128 bit value

◆ ArgumentType() [15/18]

Burger::ArgumentType::ArgumentType ( __m128i * pInput)
inlinenoexcept

Constructor for a pointer to a SSE 128 bit value (4 integers)


Note
Only available on x86 or x64 processors
Parameters
pInputPointer to a __m128 SSE 128 bit value

◆ ArgumentType() [16/18]

Burger::ArgumentType::ArgumentType ( const __m128i * pInput)
inlinenoexcept

Constructor for a pointer to a SSE 128 bit value (4 integers)


Note
Only available on x86 or x64 processors
Parameters
pInputPointer to a __m128 SSE 128 bit value

◆ ArgumentType() [17/18]

Burger::ArgumentType::ArgumentType ( void * pInput)
inlinenoexcept

Constructor for a pointer.


Parameters
pInputPointer to data that wasn't already captured by a specific constructor

◆ ArgumentType() [18/18]

Burger::ArgumentType::ArgumentType ( const void * pInput)
inlinenoexcept

Constructor for a pointer.


Parameters
pInputPointer to data that wasn't already captured by a specific constructor

Member Function Documentation

◆ GetBool()

uint_t BURGER_API Burger::ArgumentType::GetBool ( void ) const
noexcept

Returns the value as a boolean.


If the value is a compatible to be a boolean, return the converted value.

If it's not of this type, return 0.

Returns
TRUE or FALSE, and FALSE if not compatible.

◆ GetChar()

char BURGER_API Burger::ArgumentType::GetChar ( void ) const
noexcept

Returns the value as a single character.


If the value is a compatible to be a character, return the converted value.

If it's not of this type, return kInvalidCharConversion

Returns
Character or kInvalidCharConversion if not compatible.

◆ GetDataAddress()

const void *BURGER_API Burger::ArgumentType::GetDataAddress ( void ) const
noexcept

Returns the pointer the stored data.


Returns
Number of bytes the data occupies, zero if undefined

◆ GetDataLengthInBytes()

uintptr_t BURGER_API Burger::ArgumentType::GetDataLengthInBytes ( void ) const
noexcept

Returns the size of the stored data in bytes.


Returns
Number of bytes the data occupies, zero if undefined

◆ GetInt32()

int32_t BURGER_API Burger::ArgumentType::GetInt32 ( void ) const
noexcept

Returns the value as a signed 32 bit integer.


If the value is a signed integer, convert to a 32 bit signed integer and return the converted value.

If it's not of this type, return 0.

Note
If the contained data is 64 bits, it will be truncated.
Returns
Signed value or 0 if not compatible.

◆ GetInt64()

int64_t BURGER_API Burger::ArgumentType::GetInt64 ( void ) const
noexcept

Returns the value as a signed 64 bit integer.


If the value is a signed integer, convert to a 64 bit signed integer and return the converted value.

If it's not of this type, return 0.

Returns
Signed value or 0 if not compatible.

◆ GetPointer()

const void *BURGER_API Burger::ArgumentType::GetPointer ( void ) const
noexcept

Returns the value as a pointer.


If the value is a compatible to be a pointer, and return the pointer or nullptr of not.

Returns
Pointer or nullptr if not a pointer

◆ GetText()

const char *BURGER_API Burger::ArgumentType::GetText ( void ) const
noexcept

Returns the value as a "C" string pointer.


If the value is a compatible to a "C" string, return the pointer or nullptr of not.

Returns
Pointer or nullptr if not a pointer

◆ GetTextLength()

uintptr_t BURGER_API Burger::ArgumentType::GetTextLength ( void ) const
noexcept

Returns the length of the "C" string.


If the value is a compatible to a "C" string, return the length of the string or zero.

Returns
Length of the string or zero.

◆ GetType()

eType Burger::ArgumentType::GetType ( void ) const
inlinenoexcept

Return the type of data contained in the container.


Returns
eArgumentType of the data contained in the class.

◆ GetTypeName() [1/2]

const char *BURGER_API Burger::ArgumentType::GetTypeName ( eArgumentType uType)
staticnoexcept

Returns the name of the data type.


Return a "C" string containing a user readable name of the data type.

Example: int8_t data, with an enumeration of kArgumentTypeInt8 returns "int8_t"

Parameters
uTypeEnumeration of the data type to check
Returns
Pointer to a "C" string with the name.

◆ GetTypeName() [2/2]

const char * Burger::ArgumentType::GetTypeName ( void ) const
inlinenoexcept

Returns the name of the data type contained.


Return a "C" string containing a user readable name of the data type contained in this class.

Example: int8_t data, with an enumeration of kArgumentTypeInt8 returns "int8_t"

Returns
Pointer to a "C" string with the name.

◆ GetUInt32()

uint32_t BURGER_API Burger::ArgumentType::GetUInt32 ( void ) const
noexcept

Returns the value as an unsigned 32 bit integer.


If the value is an unsigned integer, convert to a 32 bit unsigned integer and return the converted value.

If it's not of this type, return 0.

Returns
Unsigned value or 0 if not compatible.

◆ GetUInt64()

uint64_t BURGER_API Burger::ArgumentType::GetUInt64 ( void ) const
noexcept

Returns the value as an unsigned 64 bit integer.


If the value is an unsigned integer, convert to a 64 bit unsigned integer and return the converted value.

If it's not of this type, return 0.

Returns
Unsigned value or 0 if not compatible.

◆ GetUTF8()

uintptr_t BURGER_API Burger::ArgumentType::GetUTF8 ( char * pOutput) const
noexcept

Convert integer to UTF8 stream.


If the value is an 8, 16, or 32 bit integer, convert it to UTF8 and return the length of the data stream. The output buffer must be 5 bytes long and the data will not be zero terminated.

Incompatable data types will return a length of zero and perform no operation.

Parameters
pOutputPointer to a buffer at least 5 bytes in length
Returns
Length of the string or zero.

◆ Is64Bit()

uint_t Burger::ArgumentType::Is64Bit ( void ) const
inlinenoexcept

Test if the data is a 64 bits wide.


If the value is 64 bits wide, return TRUE. It will return FALSE if it's anything else.

Returns
TRUE if the value contained is 64 bits wide.

◆ IsBoolean()

uint_t Burger::ArgumentType::IsBoolean ( void ) const
inlinenoexcept

Test if the data is a boolean.


If the value is a boolean, or a pointer to a boolean, return TRUE. It will return FALSE if it's anything else.

Returns
TRUE if the value contained is a boolean.

◆ IsCharacter()

uint_t Burger::ArgumentType::IsCharacter ( void ) const
inlinenoexcept

Test if the data is a character type.


If the value is single character, return TRUE. It will return FALSE if it's anything else.

Note
Characters are integers that are 8, 16, or 32 bits in size. 64 bit integers are not considered characters.
Returns
TRUE if the value contained is a character value.

◆ IsInteger()

uint_t Burger::ArgumentType::IsInteger ( void ) const
inlinenoexcept

Test if the data is an integer numeric value.


If the value is an integer number, return TRUE. It will return FALSE if it's floating point or bool.

Returns
TRUE if the value contained is an integer.

◆ IsNegative()

uint_t BURGER_API Burger::ArgumentType::IsNegative ( void ) const
noexcept

Returns TRUE if the stored value is negative.


If the value is negative, return TRUE, if the data type has no concept of negative, it will always return FALSE. bool and vectors always return FALSE.

Returns
TRUE if negative

◆ IsNumeric()

uint_t Burger::ArgumentType::IsNumeric ( void ) const
inlinenoexcept

Test if the data is a numeric value.


If the value is a number, return TRUE. This includes floating point, bool, and integers.

Returns
TRUE if the value contained is a number.

◆ IsPointer()

uint_t Burger::ArgumentType::IsPointer ( void ) const
inlinenoexcept

Test if the data is a pointer.


If the value is a pointer, return TRUE. It will return FALSE if it's anything else.

Returns
TRUE if the value contained is a pointer.

◆ IsReal()

uint_t Burger::ArgumentType::IsReal ( void ) const
inlinenoexcept

Test if the data is a floating point value.


If the value is floating pointer, return TRUE. It will return FALSE if it's anything else.

Returns
TRUE if the value contained is a floating point value.

◆ IsSigned()

uint_t Burger::ArgumentType::IsSigned ( void ) const
inlinenoexcept

Test if the data is a signed integer value.


If the value is a signed integer, return TRUE. It will return FALSE if it's an unsigned integer or bool.

Returns
TRUE if the value contained supported signed values.

◆ IsSIMD()

uint_t Burger::ArgumentType::IsSIMD ( void ) const
inlinenoexcept

Test if the data is a vector value.


If the value is a vector, return TRUE. It will return FALSE if it's anything else.

Returns
TRUE if the value contained is a vector.

◆ IsSIMDPointer()

uint_t Burger::ArgumentType::IsSIMDPointer ( void ) const
inlinenoexcept

Test if the data is a pointer to a vector value.


If the value is a pointer to a vector, return TRUE. It will return FALSE if it's anything else.

Returns
TRUE if the value contained is a pointer to a vector.

◆ IsTextPointer()

uint_t Burger::ArgumentType::IsTextPointer ( void ) const
inlinenoexcept

Test if the data is a pointer to a "C" string.


If the value is a pointer to a "C" string, return TRUE. It will return FALSE if it's anything else.

Returns
TRUE if the value contained is a pointer to a "C" string.

◆ IsUnsigned()

uint_t Burger::ArgumentType::IsUnsigned ( void ) const
inlinenoexcept

Test if the data is an unsigned integer value.


If the value is an unsigned integer, return TRUE. It will return FALSE if it's signed, bool, or floating point.

Returns
TRUE if the value contained is an unsigned data type.

◆ IsZero()

uint_t BURGER_API Burger::ArgumentType::IsZero ( void ) const
noexcept

Returns TRUE if the stored value is zero.


If the value is zero, return TRUE, if the data type has no concept of zero, it will always return FALSE.

Returns
TRUE if zero

◆ SetType()

void Burger::ArgumentType::SetType ( eArgumentType uType)
inlinenoexcept

Set the type of data contained in the container.


Parameters
uTypeeArgumentType of the new data contained in the class.

Member Data Documentation

◆ kInvalidCharConversion

const char Burger::ArgumentType::kInvalidCharConversion = '~'
static

Character returned from GetChar() const for invalid character.