Base class for elements of an argument list with mixed types. More...
Public Member Functions | |
ArgMix (ArgMix &&other) | |
Move constructor. More... | |
ArgMix (const ArgMix &other) | |
Copy constructor. More... | |
~ArgMix () | |
Destructor. | |
bool | isAbstractNumber () const |
Check if the argument value is an AbstractNumber value, either input or output. More... | |
bool | isAnyString () const |
Check if the argument value is a string of any type. More... | |
bool | isAnyString16 () const |
Check if the argument value is a string of 16-bit characters. More... | |
bool | isAnyString8 () const |
Check if the argument value is a string of 8-bit characters. More... | |
bool | isBool () const |
Check if the argument value is a bool. More... | |
bool | isCharPtr () const |
Check if the argument value is a char* string. More... | |
bool | isDouble () const |
Check if the argument value is a double floating point value, either input or output. More... | |
bool | isInteger () const |
Check if the argument value is an integer, either input or output. More... | |
bool | isOutputInteger () const |
Check if the argument value is an output integer. More... | |
bool | isSigned () const |
Check if the argument value is a signed integer, either input or output. More... | |
bool | isString () const |
Check if the argument value is a std::string. More... | |
bool | isUCharPtr () const |
Check if the argument value is a UChar* string. More... | |
bool | isUnsigned () const |
Check if the argument value is an unsigned integer, either input or output. More... | |
bool | isUString () const |
Check if the argument value is a ts::UString. More... | |
size_t | size () const |
Get the original integer size in bytes of the argument data. More... | |
template<typename INT , typename std::enable_if< std::is_integral< INT >::value >::type * = nullptr> | |
bool | storeInteger (INT i) const |
Store an integer value in the argument data, for pointers to integer. More... | |
const AbstractNumber & | toAbstractNumber () const |
Get the argument data value as constant reference to an AbstractNumber instance. More... | |
bool | toBool () const |
Get the argument data value as a bool. More... | |
const char * | toCharPtr () const |
Get the argument data value as a nul-terminated string of 8-bit characters. More... | |
double | toDouble () const |
Get the argument data value as a double floating point value. More... | |
int32_t | toInt32 () const |
Get the argument data value as a 32-bit signed integer. More... | |
int64_t | toInt64 () const |
Get the argument data value as a 64-bit signed integer. More... | |
template<typename INT , typename std::enable_if< std::is_integral< INT >::value >::type * = nullptr> | |
INT | toInteger (bool raw=false) const |
Get the argument data value as an integer. More... | |
const std::string & | toString () const |
Get the argument data value as constant reference to a C++ string of 8-bit characters. More... | |
const UChar * | toUCharPtr () const |
Get the argument data value as a nul-terminated string of 16-bit characters. More... | |
uint32_t | toUInt32 () const |
Get the argument data value as a 32-bit unsigned integer. More... | |
uint64_t | toUInt64 () const |
Get the argument data value as a 64-bit unsigned integer. More... | |
const UString & | toUString () const |
Get the argument data value as constant reference to a C++ string of 16-bit characters. More... | |
Protected Types | |
enum | : TypeFlags { INTEGER = 0x0001, SIGNED = 0x0002, STRING = 0x0004, CLASS = 0x0008, BIT1 = 0x0010, BIT8 = 0x0020, BIT16 = 0x0040, BIT32 = 0x0080, BIT64 = 0x0100, POINTER = 0x0200, STRINGIFY = 0x0400, DOUBLE = 0x0800, ANUMBER = 0x1000 } |
Anonymous enum, used as bitmask. More... | |
typedef uint16_t | TypeFlags |
Type of an argument, used as bitmask. | |
Protected Member Functions | |
ArgMix () | |
Default constructor. More... | |
ArgMix (TypeFlags type, size_t size, const Value value) | |
Constructor for subclasses. More... | |
Base class for elements of an argument list with mixed types.
This class is typically used as element in an std::initializer_list to build type-safe variable argument lists. Instances of ArgMix are directly built in the initializer list and cannot be copied or assigned.
This is a base class. It can be used only through the two derived classes ArgMixIn and ArgMixOut.
|
protected |
Anonymous enum, used as bitmask.
Enumerator | |
---|---|
INTEGER | Integer type. |
SIGNED | With INTEGER, 1 means signed, 0 means unsigned. |
STRING | String of characters. |
CLASS | With STRING, 1 means std::string or ts::UString, O means const char* or const UChar*. |
BIT1 | 1-bit integer, ie. bool. |
BIT8 | 8-bit integer or string of 8-bit characters (char). |
BIT16 | 16-bit integer or string of 16-bit characters (UChar). |
BIT32 | 32-bit integer. |
BIT64 | 64-bit integer. |
POINTER | A pointer to a writeable data (data type is given by other bits). |
STRINGIFY | A pointer to a StringifyInterface object. |
DOUBLE | Double floating point type. |
ANUMBER | A pointer to an AbstractNumber object. |
ts::ArgMix::ArgMix | ( | const ArgMix & | other | ) |
Copy constructor.
[in] | other | Other instance to copy. |
ts::ArgMix::ArgMix | ( | ArgMix && | other | ) |
Move constructor.
[in,out] | other | Other instance to move. |
|
protected |
Default constructor.
The argument does not represent anything.
|
protected |
Constructor for subclasses.
[in] | type | Indicate which overlay to use in _value. |
[in] | size | Original size for integer type. |
[in] | value | Actual value of the argument. |
|
inline |
Check if the argument value is an integer, either input or output.
|
inline |
Check if the argument value is an output integer.
|
inline |
Check if the argument value is a signed integer, either input or output.
|
inline |
Check if the argument value is an unsigned integer, either input or output.
|
inline |
Check if the argument value is a bool.
|
inline |
Check if the argument value is a string of any type.
|
inline |
Check if the argument value is a string of 8-bit characters.
|
inline |
Check if the argument value is a string of 16-bit characters.
|
inline |
Check if the argument value is a char* string.
|
inline |
Check if the argument value is a std::string.
|
inline |
Check if the argument value is a UChar* string.
|
inline |
Check if the argument value is a ts::UString.
|
inline |
Check if the argument value is a double floating point value, either input or output.
|
inline |
Check if the argument value is an AbstractNumber value, either input or output.
|
inline |
Get the original integer size in bytes of the argument data.
INT ts::ArgMix::toInteger | ( | bool | raw = false | ) | const |
Get the argument data value as an integer.
INT | An integer type. |
[in] | raw | In the case of fixed-point value, return the integral part when false (the default) and the raw value if true. Ignored for plain integer types. |
|
inline |
Get the argument data value as a 32-bit signed integer.
|
inline |
Get the argument data value as a 32-bit unsigned integer.
|
inline |
Get the argument data value as a 64-bit signed integer.
|
inline |
Get the argument data value as a 64-bit unsigned integer.
|
inline |
Get the argument data value as a bool.
const char* ts::ArgMix::toCharPtr | ( | ) | const |
Get the argument data value as a nul-terminated string of 8-bit characters.
const UChar* ts::ArgMix::toUCharPtr | ( | ) | const |
Get the argument data value as a nul-terminated string of 16-bit characters.
const std::string& ts::ArgMix::toString | ( | ) | const |
Get the argument data value as constant reference to a C++ string of 8-bit characters.
const UString& ts::ArgMix::toUString | ( | ) | const |
Get the argument data value as constant reference to a C++ string of 16-bit characters.
double ts::ArgMix::toDouble | ( | ) | const |
Get the argument data value as a double floating point value.
const AbstractNumber& ts::ArgMix::toAbstractNumber | ( | ) | const |
Get the argument data value as constant reference to an AbstractNumber instance.
bool ts::ArgMix::storeInteger | ( | INT | i | ) | const |
Store an integer value in the argument data, for pointers to integer.
INT | An integer type. |
[in] | i | The integer value to store in the argument data. |