TSDuck v3.40-3963
MPEG Transport Stream Toolkit
|
Base class for elements of an argument list with mixed types. More...
#include <tsArgMix.h>
Public Member Functions | |
ArgMix (ArgMix &&other) | |
Move constructor. | |
ArgMix (const ArgMix &other) | |
Copy constructor. | |
~ArgMix () | |
Destructor. | |
std::intmax_t | den () const |
In the case of a std::chrono::duration value, return the denominator of the ratio. | |
bool | isAbstractNumber () const |
Check if the argument value is an AbstractNumber value, either input or output. | |
bool | isAnyString () const |
Check if the argument value is a string of any type. | |
bool | isAnyString16 () const |
Check if the argument value is a string of 16-bit characters. | |
bool | isAnyString8 () const |
Check if the argument value is a string of 8-bit characters. | |
bool | isBool () const |
Check if the argument value is a bool. | |
bool | isCharPtr () const |
Check if the argument value is a char* string. | |
bool | isChrono () const |
Check if the argument value is a std::chrono::duration value. | |
bool | isDouble () const |
Check if the argument value is a double floating point value, either input or output. | |
bool | isInteger () const |
Check if the argument value is an integer, either input or output. | |
bool | isOutputFloat () const |
Check if the argument value is an output floating point. | |
bool | isOutputInteger () const |
Check if the argument value is an output integer. | |
bool | isSigned () const |
Check if the argument value is a signed integer, either input or output. | |
bool | isString () const |
Check if the argument value is a std::string. | |
bool | isUCharPtr () const |
Check if the argument value is a UChar* string. | |
bool | isUnsigned () const |
Check if the argument value is an unsigned integer, either input or output. | |
bool | isUString () const |
Check if the argument value is a ts::UString. | |
std::intmax_t | num () const |
In the case of a std::chrono::duration value, return the numerator of the ratio. | |
size_t | size () const |
Get the original integer size in bytes of the argument data. | |
template<typename FLOAT , typename std::enable_if< std::is_floating_point< FLOAT >::value >::type * = nullptr> | |
bool | storeFloat (FLOAT f) const |
Store a floating point value in the argument data, for pointers to double. | |
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. | |
const AbstractNumber & | toAbstractNumber () const |
Get the argument data value as constant reference to an AbstractNumber instance. | |
bool | toBool () const |
Get the argument data value as a bool. | |
const char * | toCharPtr () const |
Get the argument data value as a nul-terminated string of 8-bit characters. | |
double | toDouble () const |
Get the argument data value as a double floating point value. | |
int32_t | toInt32 () const |
Get the argument data value as a 32-bit signed integer. | |
int64_t | toInt64 () const |
Get the argument data value as a 64-bit signed integer. | |
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. | |
const std::string & | toString () const |
Get the argument data value as constant reference to a C++ string of 8-bit characters. | |
const UChar * | toUCharPtr () const |
Get the argument data value as a nul-terminated string of 16-bit characters. | |
uint32_t | toUInt32 () const |
Get the argument data value as a 32-bit unsigned integer. | |
uint64_t | toUInt64 () const |
Get the argument data value as a 64-bit unsigned integer. | |
const UString & | toUString () const |
Get the argument data value as constant reference to a C++ string of 16-bit characters. | |
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 , PATH = 0x0800 , DOUBLE = 0x1000 , ANUMBER = 0x2000 , CHRONO = 0x4000 } |
Anonymous enum, used as bitmask. More... | |
using | TypeFlags = uint16_t |
Type of an argument, used as bitmask. | |
Protected Member Functions | |
ArgMix () | |
Default constructor. | |
ArgMix (TypeFlags type, size_t size, const Value value, std::intmax_t num=0, std::intmax_t den=0) | |
Constructor for subclasses. | |
Static Protected Attributes | |
static constexpr TypeFlags | BITPATH |
Size flag for std::filesystem::path, either BIT8 or BIT16. | |
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. |
PATH | A pointer to a StringifyInterface object. |
DOUBLE | Double floating point type. |
ANUMBER | A pointer to an AbstractNumber object. |
CHRONO | A instance of std::chrono::duration. |
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. |
[in] | num | Numerator of the ratio in the case of a std::chrono::duration value. |
[in] | den | Denominator of the ratio in the case of a std::chrono::duration value. |
|
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 an output floating point.
|
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 |
Check if the argument value is a std::chrono::duration value.
|
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.
|
inline |
In the case of a std::chrono::duration value, return the numerator of the ratio.
The chrono count is obtained using tsInt64().
|
inline |
In the case of a std::chrono::duration value, return the denominator of the ratio.
The chrono count is obtained using tsInt64().
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. |
bool ts::ArgMix::storeFloat | ( | FLOAT | f | ) | const |
Store a floating point value in the argument data, for pointers to double.
[in] | f | The floating point value to store in the argument data. |
|
staticconstexprprotected |
Size flag for std::filesystem::path, either BIT8 or BIT16.