TSDuck v3.40-4163
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
C++ language

C++ language features and design patterns. More...

Collaboration diagram for C++ language:

Files

file  tsAfterStandardHeaders.h
 Technical header to include after including standard and system headers.
 
file  tsBCD.h
 Binary Coded Decimal utilities.
 
file  tsBeforeStandardHeaders.h
 Technical header to include before including standard and system headers.
 
file  tsEnumUtils.h
 Some utilities on enumeration types.
 
file  tsFloatUtils.h
 Some utilities on floating point types.
 
file  tsIntegerUtils.h
 Some utilities on integers.
 
file  tsMemory.h
 Utility routines for memory operations.
 
file  tsPlatform.h
 Cross-platforms portable base definitions for the TSDuck project.
 
file  tsUChar.h
 Unicode characters.
 

Concepts

concept  ts::int_enum
 A C++20 concept which requires a type to be an integer or an enumeration type.
 

Classes

class  ts::AbstractNumber
 Abstract base class for different representations of "numbers". More...
 
class  ts::AbstractOutputStream
 Intermediate abstract class to help implementing std::ostream. More...
 
class  ts::ArgMix
 Base class for elements of an argument list with mixed types. More...
 
class  ts::ArgMixIn
 Define an element of an argument list with mixed integer and string input types. More...
 
class  ts::ArgMixOut
 Define an element of an argument list with integer output types of mixed sizes. More...
 
struct  ts::Assign< T >
 Assign ("=") functor. More...
 
struct  ts::AssignAnd< T >
 Assign with binary and ("&=") functor. More...
 
struct  ts::AssignOr< T >
 Assign with binary or ("|=") functor. More...
 
struct  ts::AssignXor< T >
 Assign with binary exclusive or ("^=") functor. More...
 
class  ts::Buffer
 General-purpose memory buffer with bit access. More...
 
class  ts::ByteBlock
 Definition of a generic block of bytes. More...
 
class  ts::CompactBitSet< BITS >
 A compact version of std::bitset. More...
 
class  ts::DisplayInterface
 An interface to be implemented by classes supporting display to a standard text stream. More...
 
struct  ts::EnableBitMaskOperators< T >
 This traits is used to enable bitmask operators on an enumeration type. More...
 
class  ts::Exception
 Base class for all exceptions in TSDuck. More...
 
class  ts::Expressions
 Expression resolver based on the definition of symbols. More...
 
class  ts::FixedPoint< INT_T, PREC >
 Template representation of fixed-precision numbers. More...
 
class  ts::FloatingPoint< FLOAT_T, PREC >
 Encapsulation of a double floating-point as an AbstractNumber. More...
 
class  ts::Fraction< INT_T >
 Template representation of fractional numbers. More...
 
class  ts::Grid
 This class produces a report in a grid format with tables and sections. More...
 
struct  ts::ieee_float< storage_bits, exponent_bits, mantissa_bits >
 Definition of an IEEE floating point type with a given represenation. More...
 
class  ts::ImplementationError
 Implementation error. More...
 
struct  ts::int_max< INT >
 The meta-type ts::int_max selects the integer type with largest width and same signedness as another integer type. More...
 
class  ts::Integer< INT_T >
 Encapsulation of an integer type as an AbstractNumber. More...
 
class  ts::IntegerMap< KEY, VALUE, NAMESFILE, KEYNAMESECTION >
 Generic map of integers, indexed by integer. More...
 
class  ts::IOManipulatorProxy< OSTREAM, PARAM, TRAITS >
 I/O manipulator with argument for subclasses of std::basic_ostream. More...
 
struct  ts::make_signed< T >
 The meta-type ts::make_signed is a generalization of std::make_signed which works on floating point-types as well. More...
 
class  ts::Object
 General-purpose base class for polymophic objects. More...
 
class  ts::ObjectRepository
 A global repository of general-purpose base class for polymophic objects. More...
 
class  ts::RingNode
 Base class for objects being part of a ring, ie. More...
 
class  ts::SingleDataStatistics< NUMBER, DEFAULT_FLOAT, class >
 Statistics over a single set of data (integer or floating point). More...
 
struct  ts::smaller_unsigned< BITS >
 Define the smaller unsigned integer type with at least a given number of bits. More...
 
struct  ts::static_power10< INT, POW >
 Static values of power of 10. More...
 
class  ts::StringifyInterface
 An interface to be implemented by classes supporting a conversion to UString. More...
 
class  ts::TextFormatter
 Format and print a text document using various output types and indentation. More...
 
class  ts::TextParser
 A support class for applications which parse various text formats. More...
 
class  ts::TextTable
 This class produces a formatted table of text lines and columns. More...
 
struct  ts::underlying_type< T >
 The meta-type ts::underlying_type is a generalization of std::underlying_type which works on integral or floating-point types as well. More...
 
class  ts::UString
 An implementation of UTF-16 strings. More...
 

Macros

#define TS_ANDROID
 Defined when compiled for an Android target platform.
 
#define TS_ARM32
 Defined when the target processor architecture is 32-bit ARM.
 
#define TS_ARM64
 Defined when the target processor architecture is 64-bit ARM.
 
#define TS_ASM_ARM64
 Defined when the target processor architecture is 64-bit ARM and inline assembler is allowed.
 
#define TS_BSD
 Defined when compiled for a BSD target platform (FreeBSD, OpenBSD, NetBSD, DragonFlyBSD).
 
#define TS_CPLUSPLUS
 Level of C++ language, same as predefined __cplusplus, but safe with MSVC.
 
#define TS_CXX20
 Defined when the compiler is compliant with C++20.
 
#define TS_CXX23
 Defined when the compiler is compliant with C++23.
 
#define TS_CYGWIN
 Defined when compiled for a Cygwin target platform.
 
#define TS_DECLARE_EXCEPTION(name)
 This macro declares an exception as a subclass of ts::Exception.
 
#define TS_DEFAULT_ASSIGMENTS(classname)
 A macro to declare the default assignment operators in the declaration of a class.
 
#define TS_DEFAULT_COPY_MOVE(classname)
 A macro to declare the default copy and move constructors and assignment operators in the declaration of a class.
 
#define TS_DEFINE_SINGLETON(fullclassname)
 Singleton class definition.
 
#define TS_DRAGONFLYBSD
 Defined when compiled for a DragonFlyBSD target platform.
 
#define TS_ENABLE_BITMASK_OPERATORS(T)
 This macro enables bitmask operators on an enumeration type.
 
#define TS_FREEBSD
 Defined when compiled for a FreeBSD target platform.
 
#define TS_FUNCTION
 Definition of the name of the current function.
 
#define TS_GCC
 Defined when the compiler is GCC, also known as "GNU C", or a GCC-compatible compiler.
 
#define TS_GCC_NOWARNING(name)
 Disable a warning with the GCC compiler (does nothing on other compilers).
 
#define TS_GCC_ONLY
 Defined when the compiler is exactly GCC, also known as "GNU C", not a GCC-compatible compiler.
 
#define TS_GCC_VERSION
 GCC version, encoded as an integer.
 
#define TS_I386
 Defined when the target processor architecture is Intel IA-32, also known as x86.
 
#define TS_INTERFACE(classname)
 A macro to declare the basic operators in the declaration of an interface class.
 
#define TS_LINUX
 Defined when compiled for a Linux target platform.
 
#define TS_LLVM_NOWARNING(name)
 Disable a warning with the LLVM/clang compiler (does nothing on other compilers).
 
#define TS_MAC
 Defined when compiled for a macOS target platform.
 
#define TS_MIPS
 Defined when the target processor architecture is 32-bit MIPS architecture.
 
#define TS_MIPS64
 Defined when the target processor architecture is 64-bit MIPS architecture.
 
#define TS_MSC
 Defined when the compiler is Microsoft C/C++, the default compiler in the Microsoft Visual Studio environment.
 
#define TS_MSC_NOWARNING(num)
 Disable a warning with the Microsoft Visual C++ compiler (does nothing on other compilers).
 
#define TS_NETBSD
 Defined when compiled for a NetBSD target platform.
 
#define TS_NO_ARM_CRC32_INSTRUCTIONS
 Define TS_NO_ARM_CRC32_INSTRUCTIONS from the command line if you want to disable the usage of Arm64 CRC32 instructions.
 
#define TS_NO_DEFAULT_CONSTRUCTORS(classname)
 A macro to disable default constructors in the declaration of a class.
 
#define TS_NO_OPTIMIZE   platform_specific
 Attribute to explicitly disable optimization in a function.
 
#define TS_NOBUILD_NOCOPY(classname)
 A macro to disable default constructor and object copy in the declaration of a class.
 
#define TS_NOCOPY(classname)
 A macro to disable object copy in the declaration of a class.
 
#define TS_NOMOVE(classname)
 A macro to disable object move in the declaration of a class.
 
#define TS_OPENBSD
 Defined when compiled for an OpenBSD target platform.
 
#define TS_POP_WARNING()
 Restore the compiler's warnings reporting from a previous TS_PUSH_WARNING().
 
#define TS_POWERPC
 Defined when the target processor architecture is 32-bit Power PC.
 
#define TS_POWERPC64
 Defined when the target processor architecture is 64-bit Power PC.
 
#define TS_PRAGMA(directive)
 Helper macro for the C++11 keyword _Pragma.
 
#define TS_PUSH_WARNING()
 Save the compiler's warnings reporting.
 
#define TS_REGISTER_CHRONO_UNIT(classname, ...)
 Registration of a new std::chrono::duration unit name.
 
#define TS_RISCV64
 Defined when the target processor architecture is 64-bit RISC-V.
 
#define TS_RULE_OF_FIVE(classname, dtor_attributes)
 A macro to apply the C++ "rule of five" in the declaration of a class.
 
#define TS_S390X
 Defined when the target processor architecture is S390X.
 
#define TS_SINGLETON(classname)
 Singleton class declaration.
 
#define TS_SLINE   TS_STRINGIFY(__LINE__)
 String version of LINE, the source code line number.
 
#define TS_SPARC
 Defined when the target processor architecture is Sun SPARC architecture.
 
#define TS_SRCLOC   __FILE__ ":" TS_SLINE ": "
 Locate the source of the exception in the Exception constructor message string.
 
#define TS_STATIC_REFERENCE(suffix, addr)
 This macro generates a reference to some address (string literal, external symbol, etc.) The reference is a unique static symbol which is otherwise unused.
 
#define TS_STRICT_MEMORY_ALIGN   1
 Defined when the CPU requires strict memory alignment (address must be a multiple of the data size).
 
#define TS_STRINGIFY(x)
 This macro transforms the value of a macro parameter into the equivalent string literal.
 
#define TS_UNIQUE_NAME(prefix)
 This macro generates a unique name based on the source line number.
 
#define TS_UNIX
 Defined when compiled for any flavor of UNIX target platforms.
 
#define TS_USTRINGIFY(x)
 This macro transforms the value of a macro parameter into the equivalent 16-bit Unicode string literal.
 
#define TS_WINDOWS
 Defined when compiled for a Microsoft Windows target platform.
 
#define TS_X86_64
 Defined when the target processor architecture is the 64-bit extension of the IA-32 architecture, also known as AMD-64 or Intel x86-64.
 
#define TS_ZERO(var)   ts::MemZero(&(var), sizeof(var))
 Zeroing an plain memory variable.
 
#define TSDUCK_STATIC
 User-defined macro to enable full static linking.
 
#define TSDUCK_STATIC_LIBRARY
 Applications which link against the TSDuck static library.
 
#define TSDUCK_STATIC_PLUGINS
 User-defined macro to enable static linking of plugins.
 

Typedefs

using ts::BoolPredicate = bool(*)(bool, bool)
 Declaration of a boolean predicate with two arguments.
 
using ts::const_char_ptr = const char *
 Pointer to const char.
 
using ts::const_int16_ptr = const int16_t *
 Pointer to const int16_t.
 
using ts::const_int32_ptr = const int32_t *
 Pointer to const int32_t.
 
using ts::const_int64_ptr = const int64_t *
 Pointer to const int64_t.
 
using ts::const_int8_ptr = const int8_t *
 Pointer to const int8_t.
 
using ts::const_uint16_ptr = const uint16_t *
 Pointer to const uint16_t.
 
using ts::const_uint32_ptr = const uint32_t *
 Pointer to const uint32_t.
 
using ts::const_uint64_ptr = const uint64_t *
 Pointer to const uint64_t.
 
using ts::const_uint8_ptr = const uint8_t *
 Pointer to const uint8_t.
 
using ts::deciseconds = cn::duration< cn::milliseconds::rep, std::deci >
 A derivative of std::chrono::duration for deciseconds (1/10 of a second).
 
using ts::ieee_float128_t = typename ieee_float< 128, 15, 112 >::type
 128-bit IEEE floating point type.
 
using ts::ieee_float32_t = typename ieee_float< 32, 8, 23 >::type
 32-bit IEEE floating point type.
 
using ts::ieee_float64_t = typename ieee_float< 64, 11, 52 >::type
 64-bit IEEE floating point type.
 
using ts::ieee_float80_t = typename ieee_float< 80, 15, 64 >::type
 80-bit IEEE floating point type.
 
using ts::int16_ptr = int16_t *
 Pointer to int16_t.
 
using ts::int32_ptr = int32_t *
 Pointer to int32_t.
 
using ts::int64_ptr = int64_t *
 Pointer to int64_t.
 
using ts::int8_ptr = int8_t *
 Pointer to int8_t.
 
template<typename INT >
using ts::int_max_t = typename int_max< INT >::type
 Helper type for ts::int_max.
 
template<typename T >
using ts::make_signed_t = typename make_signed< T >::type
 Helper type for ts::make_signed.
 
using ts::MonoBoolPredicate = bool(*)(bool)
 Declaration of a boolean predicate with one argument.
 
using ts::monotonic_time = cn::time_point< cn::steady_clock >
 Definition of a monotonic time.
 
using ts::MultiBoolPredicate = bool(*)(std::initializer_list< bool >)
 Declaration of a boolean predicate with a variable number of arguments.
 
using ts::ObjectPtr = std::shared_ptr< Object >
 Safe pointer for Object (thread-safe).
 
using ts::UChar = char16_t
 UTF-16 character.
 
using ts::uint16_ptr = uint16_t *
 Pointer to uint16_t.
 
using ts::uint32_ptr = uint32_t *
 Pointer to uint32_t.
 
using ts::uint64_ptr = uint64_t *
 Pointer to uint64_t.
 
using ts::uint8_ptr = uint8_t *
 Pointer to uint8_t.
 
template<typename T >
using ts::underlying_type_t = typename underlying_type< T >::type
 Helper type for ts::underlying_type.
 
using ts::UStringList = std::list< UString >
 List of strings.
 
using ts::UStringVector = std::vector< UString >
 Vector of strings.
 

Enumerations

enum  : uint32_t {
  ts::CCHAR_LETTER = 0x0001 ,
  ts::CCHAR_DIGIT = 0x0002 ,
  ts::CCHAR_HEXA = 0x0004 ,
  ts::CCHAR_LATIN = 0x0008 ,
  ts::CCHAR_GREEK = 0x0010 ,
  ts::CCHAR_HEBREW = 0x0020 ,
  ts::CCHAR_ARABIC = 0x0040 ,
  ts::CCHAR_THAI = 0x0080 ,
  ts::CCHAR_CYRILLIC = 0x0100 ,
  ts::CCHAR_CDIACRIT = 0x0200 ,
  ts::CCHAR_SPACE = 0x0400 ,
  ts::CCHAR_PRINT = 0x0800
}
 Characteristics of a character. More...
 
enum  ts::CaseSensitivity {
  ts::CASE_SENSITIVE ,
  ts::CASE_INSENSITIVE
}
 Case sensitivity used on string operations. More...
 
enum class  ts::Replacement : uint8_t {
  ts::Replacement::NONE = 0x00 ,
  ts::Replacement::UPDATE = 0x01 ,
  ts::Replacement::REPLACE = 0x02 ,
  ts::Replacement::ADD = 0x04 ,
  ts::Replacement::REMOVE = 0x08
}
 Enumeration type used to indicate the replacement policy in containers of data structures. More...
 
enum class  ts::ShareMode {
  ts::ShareMode::COPY ,
  ts::ShareMode::SHARE
}
 Enumeration type used to indicate if the data referenced by a pointer shall be copied or shared. More...
 
enum  ts::StringComparison : uint32_t {
  ts::SCOMP_DEFAULT = 0x0000 ,
  ts::SCOMP_CASE_INSENSITIVE = 0x0001 ,
  ts::SCOMP_IGNORE_BLANKS = 0x0002 ,
  ts::SCOMP_NUMERIC = 0x0004
}
 Options used on string comparisons. More...
 
enum  ts::StringDirection {
  ts::LEFT_TO_RIGHT ,
  ts::RIGHT_TO_LEFT
}
 Direction used on string operations. More...
 
enum class  ts::Tristate {
  ts::Tristate::Maybe = -1 ,
  ts::Tristate::False = 0 ,
  ts::Tristate::True = 1
}
 Tristate boolean. More...
 

Functions

template<typename INT >
requires std::integral<INT>
constexpr INT ts::abs (INT a)
 Absolute value of integer types, also working on unsigned types.
 
template<typename INT >
requires std::integral<INT>
bool ts::add_overflow (INT a, INT b) platform_specific
 Check if an integer addition generates an overflow.
 
template<typename INT >
requires std::integral<INT>
constexpr bool ts::add_overflow (INT a, INT b, INT res)
 Check if an integer addition generates an overflow.
 
bool ts::And (bool arg1, bool arg2)
 BoolPredicate "and".
 
template<typename ELEMENT , class CONTAINER >
bool ts::AppendUnique (CONTAINER &container, const ELEMENT &e)
 Append an element into a container if not already present in the container.
 
void ts::BCDToString (std::string &str, const uint8_t *bcd, size_t bcd_count, int decimal, bool left_justified=true)
 Decode a string representation of a variable-length Binary Coded Decimal (BCD) encoded integer.
 
template<typename INT >
requires std::integral<INT>
size_t ts::BitSize (INT x)
 Get the size in bits of an integer value.
 
template<typename INT1 , typename INT2 >
requires std::integral<INT1> && std::integral<INT2>
constexpr bool ts::bound_check (INT2 x)
 Integer cross-type bound check.
 
template<typename INT >
requires std::integral<INT>
INT ts::bounded_add (INT a, INT b)
 Perform a bounded addition without overflow.
 
template<typename INT1 , typename INT2 >
requires std::integral<INT1> && std::integral<INT2>
constexpr INT1 ts::bounded_cast (INT2 x)
 Bounded integer cast.
 
template<typename INT >
requires std::integral<INT>
INT ts::bounded_sub (INT a, INT b)
 Perform a bounded subtraction without overflow.
 
uint16_t ts::ByteSwap16 (uint16_t x)
 Inlined function performing byte swap on 16-bit integer data.
 
uint32_t ts::ByteSwap24 (uint32_t x)
 Inlined function performing byte swap on 24-bit integer data.
 
uint32_t ts::ByteSwap32 (uint32_t x)
 Inlined function performing byte swap on 32-bit integer data.
 
uint64_t ts::ByteSwap64 (uint64_t x)
 Inlined function performing byte swap on 64-bit integer data.
 
UString ts::ClassName (const std::type_index index)
 Get the name of a class from the type_index of a class.
 
UString ts::ClassName (const std::type_info &info)
 Get the name of a class from the type_info of an object.
 
template<typename INT >
requires std::integral<INT>
INT ts::CondByteSwap (INT x)
 Template function performing conditional byte swap on integer data to obtain the data in big endian representation.
 
uint16_t ts::CondByteSwap16 (uint16_t x)
 Inlined function performing conditional byte swap on 16-bit integer data to obtain the data in big endian representation.
 
uint16_t ts::CondByteSwap16BE (uint16_t x)
 Inlined function performing conditional byte swap on 16-bit integer data to obtain the data in big endian representation.
 
uint16_t ts::CondByteSwap16LE (uint16_t x)
 Inlined function performing conditional byte swap on 16-bit integer data to obtain the data in little endian representation.
 
uint32_t ts::CondByteSwap24 (uint32_t x)
 Inlined function performing conditional byte swap on 24-bit integer data to obtain the data in big endian representation.
 
uint32_t ts::CondByteSwap24BE (uint32_t x)
 Inlined function performing conditional byte swap on 24-bit integer data to obtain the data in big endian representation.
 
uint32_t ts::CondByteSwap24LE (uint32_t x)
 Inlined function performing conditional byte swap on 24-bit integer data to obtain the data in little endian representation.
 
uint32_t ts::CondByteSwap32 (uint32_t x)
 Inlined function performing conditional byte swap on 32-bit integer data to obtain the data in big endian representation.
 
uint32_t ts::CondByteSwap32BE (uint32_t x)
 Inlined function performing conditional byte swap on 32-bit integer data to obtain the data in big endian representation.
 
uint32_t ts::CondByteSwap32LE (uint32_t x)
 Inlined function performing conditional byte swap on 32-bit integer data to obtain the data in little endian representation.
 
uint64_t ts::CondByteSwap64 (uint64_t x)
 Inlined function performing conditional byte swap on 64-bit integer data to obtain the data in big endian representation.
 
uint64_t ts::CondByteSwap64BE (uint64_t x)
 Inlined function performing conditional byte swap on 64-bit integer data to obtain the data in big endian representation.
 
uint64_t ts::CondByteSwap64LE (uint64_t x)
 Inlined function performing conditional byte swap on 64-bit integer data to obtain the data in little endian representation.
 
template<typename INT >
requires std::integral<INT>
INT ts::CondByteSwapBE (INT x)
 Template function performing conditional byte swap on integer data to obtain the data in big endian representation.
 
template<typename INT >
requires std::integral<INT>
INT ts::CondByteSwapLE (INT x)
 Template function performing conditional byte swap on integer data to obtain the data in little endian representation.
 
template<typename INT >
requires std::integral<INT>
void ts::debug_thow_neg_overflow (INT a)
 In debug mode, throw an exception if the negation (opposite sign) of an integer generates an overflow.
 
template<typename INT >
requires std::integral<INT>
void ts::debug_throw_add_overflow (INT a, INT b, INT res)
 In debug mode, throw an exception if an integer addition generates an overflow.
 
template<typename INT1 , typename INT2 >
requires std::integral<INT1> && std::integral<INT2>
void ts::debug_throw_bound_check (INT2 x)
 In debug mode, throw an exception if an integer value does not fall into the range of another integer type.
 
template<typename INT >
requires std::integral<INT>
void ts::debug_throw_div_zero (INT den)
 In debug mode, throw an exception if the denominator of an integer division is zero.
 
template<typename INT >
requires std::integral<INT>
void ts::debug_throw_mul_overflow (INT a, INT b, INT res)
 In debug mode, throw an exception if an integer multiplication generates an overflow.
 
template<typename INT >
requires std::integral<INT>
void ts::debug_throw_sub_overflow (INT a, INT b, INT res)
 In debug mode, throw an exception if an integer substraction generates an overflow.
 
uint32_t ts::DecodeBCD (const uint8_t *bcd, size_t bcd_count, bool left_justified=true)
 Return the decimal value of a Binary Coded Decimal (BCD) encoded string.
 
int ts::DecodeBCD (uint8_t b)
 Return the decimal value of a Binary Coded Decimal (BCD) encoded byte.
 
bool ts::DecomposePrecombined (UChar c, UChar &letter, UChar &mark)
 Decompose a precombined character into its base letter and non-spacing diacritical mark.
 
uint8_t ts::EncodeBCD (int i)
 Return a one-byte Binary Coded Decimal (BCD) representation of an integer.
 
void ts::EncodeBCD (uint8_t *bcd, size_t bcd_count, uint32_t value, bool left_justified=true, uint8_t pad_nibble=0)
 Encode a Binary Coded Decimal (BCD) string.
 
template<typename T , class UnaryPredicate >
bool ts::EnumerateCombinations (const std::set< T > &values, const std::set< T > &fixed, size_t size, UnaryPredicate predicate)
 Enumerate all 'k'-elements combinations of a 'n'-elements set.
 
template<typename T >
requires std::floating_point<T>
bool ts::equal_float (T a, T b, T epsilon=2 *std::numeric_limits< T >::epsilon())
 This template function compares two floating point values for approximated equality.
 
UChar ts::FromHTML (const UString &entity)
 Convert the body on an HTML entity into a character.
 
char32_t ts::FromSurrogatePair (UChar lead, UChar trail)
 Build a 32-bit Unicode code point from a surrogate pair.
 
template<typename INT >
requires std::integral<INT>
INT ts::GCD (INT x, INT y)
 Compute a greatest common denominator (GCD).
 
ieee_float32_t ts::GetFloat32 (const void *p)
 Function getting a 32-bit IEEE float from serialized data in big endian representation.
 
ieee_float32_t ts::GetFloat32BE (const void *p)
 Function getting a 32-bit IEEE float from serialized data in big endian representation.
 
ieee_float32_t ts::GetFloat32LE (const void *p)
 Function getting a 32-bit IEEE float from serialized data in little endian representation.
 
ieee_float64_t ts::GetFloat64 (const void *p)
 Function getting a 64-bit IEEE float from serialized data in big endian representation.
 
ieee_float64_t ts::GetFloat64BE (const void *p)
 Function getting a 64-bit IEEE float from serialized data in big endian representation.
 
ieee_float64_t ts::GetFloat64LE (const void *p)
 Function getting a 64-bit IEEE float from serialized data in little endian representation.
 
template<typename INT >
requires std::integral<INT>
INT ts::GetInt (const void *p)
 Template function getting an integer from serialized data in big endian representation.
 
template<typename INT >
requires std::integral<INT>
void ts::GetInt (const void *p, INT &i)
 Template function getting an integer from serialized data in big endian representation.
 
int16_t ts::GetInt16 (const void *p)
 Function getting a 16-bit signed integer from serialized data in big endian representation.
 
void ts::GetInt16 (const void *p, int16_t &i)
 Function getting a 16-bit signed integer from serialized data in big endian representation.
 
int16_t ts::GetInt16BE (const void *p)
 Function getting a 16-bit signed integer from serialized data in big endian representation.
 
void ts::GetInt16BE (const void *p, int16_t &i)
 Function getting a 16-bit signed integer from serialized data in big endian representation.
 
int16_t ts::GetInt16LE (const void *p)
 Function getting a 16-bit signed integer from serialized data in little endian representation.
 
void ts::GetInt16LE (const void *p, int16_t &i)
 Function getting a 16-bit signed integer from serialized data in little endian representation.
 
int32_t ts::GetInt24 (const void *p)
 Function getting a 24-bit signed integer from serialized data in big endian representation.
 
void ts::GetInt24 (const void *p, int32_t &i)
 Function getting a 24-bit signed integer from serialized data in big endian representation.
 
int32_t ts::GetInt24BE (const void *p)
 Function getting a 24-bit signed integer from serialized data in big endian representation.
 
void ts::GetInt24BE (const void *p, int32_t &i)
 Function getting a 24-bit signed integer from serialized data in big endian representation.
 
int32_t ts::GetInt24LE (const void *p)
 Function getting a 24-bit signed integer from serialized data in little endian representation.
 
void ts::GetInt24LE (const void *p, int32_t &i)
 Function getting a 24-bit signed integer from serialized data in little endian representation.
 
int32_t ts::GetInt32 (const void *p)
 Function getting a 32-bit signed integer from serialized data in big endian representation.
 
void ts::GetInt32 (const void *p, int32_t &i)
 Function getting a 32-bit signed integer from serialized data in big endian representation.
 
int32_t ts::GetInt32BE (const void *p)
 Function getting a 32-bit signed integer from serialized data in big endian representation.
 
void ts::GetInt32BE (const void *p, int32_t &i)
 Function getting a 32-bit signed integer from serialized data in big endian representation.
 
int32_t ts::GetInt32LE (const void *p)
 Function getting a 32-bit signed integer from serialized data in little endian representation.
 
void ts::GetInt32LE (const void *p, int32_t &i)
 Function getting a 32-bit signed integer from serialized data in little endian representation.
 
int64_t ts::GetInt40BE (const void *p)
 Function getting a 40-bit signed integer from serialized data in big endian representation.
 
int64_t ts::GetInt40LE (const void *p)
 Function getting a 40-bit signed integer from serialized data in little endian representation.
 
int64_t ts::GetInt48BE (const void *p)
 Function getting a 48-bit signed integer from serialized data in big endian representation.
 
int64_t ts::GetInt48LE (const void *p)
 Function getting a 48-bit signed integer from serialized data in little endian representation.
 
int64_t ts::GetInt64 (const void *p)
 Function getting a 64-bit signed integer from serialized data in big endian representation.
 
void ts::GetInt64 (const void *p, int64_t &i)
 Function getting a 64-bit signed integer from serialized data in big endian representation.
 
int64_t ts::GetInt64BE (const void *p)
 Function getting a 64-bit signed integer from serialized data in big endian representation.
 
void ts::GetInt64BE (const void *p, int64_t &i)
 Function getting a 64-bit signed integer from serialized data in big endian representation.
 
int64_t ts::GetInt64LE (const void *p)
 Function getting a 64-bit signed integer from serialized data in little endian representation.
 
void ts::GetInt64LE (const void *p, int64_t &i)
 Function getting a 64-bit signed integer from serialized data in little endian representation.
 
int8_t ts::GetInt8 (const void *p)
 Function getting an 8-bit signed integer from serialized data.
 
void ts::GetInt8 (const void *p, int8_t &i)
 Function getting an 8-bit signed integer from serialized data.
 
template<typename INT >
requires std::integral<INT>
INT ts::GetIntBE (const void *p)
 Template function getting an integer from serialized data in big endian representation.
 
template<typename INT >
requires std::integral<INT>
void ts::GetIntBE (const void *p, INT &i)
 Template function getting an integer from serialized data in big endian representation.
 
template<typename INT >
requires std::integral<INT>
INT ts::GetIntLE (const void *p)
 Template function getting an integer from serialized data in little endian representation.
 
template<typename INT >
requires std::integral<INT>
void ts::GetIntLE (const void *p, INT &i)
 Template function getting an integer from serialized data in little endian representation.
 
template<typename INT >
requires std::integral<INT>
INT ts::GetIntVar (const void *p, size_t size)
 Template function getting a variable-length integer from serialized data in big endian representation.
 
template<typename INT >
requires std::integral<INT>
void ts::GetIntVar (const void *p, size_t size, INT &i)
 Template function getting a variable-length integer from serialized data in big endian representation.
 
template<typename INT >
requires std::integral<INT>
INT ts::GetIntVarBE (const void *p, size_t size)
 Template function getting a variable-length integer from serialized data in big endian representation.
 
template<typename INT >
requires std::integral<INT>
void ts::GetIntVarBE (const void *p, size_t size, INT &i)
 Template function getting a variable-length integer from serialized data in big endian representation.
 
template<typename INT >
requires std::integral<INT>
INT ts::GetIntVarLE (const void *p, size_t size)
 Template function getting a variable-length integer from serialized data in little endian representation.
 
template<typename INT >
requires std::integral<INT>
void ts::GetIntVarLE (const void *p, size_t size, INT &i)
 Template function getting a variable-length integer from serialized data in little endian representation.
 
uint16_t ts::GetUInt16 (const void *p)
 Function getting a 16-bit unsigned integer from serialized data in big endian representation.
 
void ts::GetUInt16 (const void *p, uint16_t &i)
 Function getting a 16-bit unsigned integer from serialized data in big endian representation.
 
uint16_t ts::GetUInt16BE (const void *p)
 Function getting a 16-bit unsigned integer from serialized data in big endian representation.
 
void ts::GetUInt16BE (const void *p, uint16_t &i)
 Function getting a 16-bit unsigned integer from serialized data in big endian representation.
 
uint16_t ts::GetUInt16LE (const void *p)
 Function getting a 16-bit unsigned integer from serialized data in little endian representation.
 
void ts::GetUInt16LE (const void *p, uint16_t &i)
 Function getting a 16-bit unsigned integer from serialized data in little endian representation.
 
uint32_t ts::GetUInt24 (const void *p)
 Function getting a 24-bit unsigned integer from serialized data in big endian representation.
 
void ts::GetUInt24 (const void *p, uint32_t &i)
 Function getting a 24-bit unsigned integer from serialized data in big endian representation.
 
uint32_t ts::GetUInt24BE (const void *p)
 Function getting a 24-bit unsigned integer from serialized data in big endian representation.
 
void ts::GetUInt24BE (const void *p, uint32_t &i)
 Function getting a 24-bit unsigned integer from serialized data in big endian representation.
 
uint32_t ts::GetUInt24LE (const void *p)
 Function getting a 24-bit unsigned integer from serialized data in little endian representation.
 
void ts::GetUInt24LE (const void *p, uint32_t &i)
 Function getting a 24-bit unsigned integer from serialized data in little endian representation.
 
uint32_t ts::GetUInt32 (const void *p)
 Function getting a 32-bit unsigned integer from serialized data in big endian representation.
 
void ts::GetUInt32 (const void *p, uint32_t &i)
 Function getting a 32-bit unsigned integer from serialized data in big endian representation.
 
uint32_t ts::GetUInt32BE (const void *p)
 Function getting a 32-bit unsigned integer from serialized data in big endian representation.
 
void ts::GetUInt32BE (const void *p, uint32_t &i)
 Function getting a 32-bit unsigned integer from serialized data in big endian representation.
 
uint32_t ts::GetUInt32LE (const void *p)
 Function getting a 32-bit unsigned integer from serialized data in little endian representation.
 
void ts::GetUInt32LE (const void *p, uint32_t &i)
 Function getting a 32-bit unsigned integer from serialized data in little endian representation.
 
uint64_t ts::GetUInt40 (const void *p)
 Function getting a 40-bit unsigned integer from serialized data in big endian representation.
 
void ts::GetUInt40 (const void *p, uint64_t &i)
 Function getting a 40-bit unsigned integer from serialized data in big endian representation.
 
uint64_t ts::GetUInt40BE (const void *p)
 Function getting a 40-bit unsigned integer from serialized data in big endian representation.
 
uint64_t ts::GetUInt40LE (const void *p)
 Function getting a 40-bit unsigned integer from serialized data in little endian representation.
 
uint64_t ts::GetUInt48 (const void *p)
 Function getting a 48-bit unsigned integer from serialized data in big endian representation.
 
void ts::GetUInt48 (const void *p, uint64_t &i)
 Function getting a 48-bit unsigned integer from serialized data in big endian representation.
 
uint64_t ts::GetUInt48BE (const void *p)
 Function getting a 48-bit unsigned integer from serialized data in big endian representation.
 
uint64_t ts::GetUInt48LE (const void *p)
 Function getting a 48-bit unsigned integer from serialized data in little endian representation.
 
uint64_t ts::GetUInt64 (const void *p)
 Function getting a 64-bit unsigned integer from serialized data in big endian representation.
 
void ts::GetUInt64 (const void *p, uint64_t &i)
 Function getting a 64-bit unsigned integer from serialized data in big endian representation.
 
uint64_t ts::GetUInt64BE (const void *p)
 Function getting a 64-bit unsigned integer from serialized data in big endian representation.
 
void ts::GetUInt64BE (const void *p, uint64_t &i)
 Function getting a 64-bit unsigned integer from serialized data in big endian representation.
 
uint64_t ts::GetUInt64LE (const void *p)
 Function getting a 64-bit unsigned integer from serialized data in little endian representation.
 
void ts::GetUInt64LE (const void *p, uint64_t &i)
 Function getting a 64-bit unsigned integer from serialized data in little endian representation.
 
uint8_t ts::GetUInt8 (const void *p)
 Function getting an 8-bit unsigned integer from serialized data.
 
void ts::GetUInt8 (const void *p, uint8_t &i)
 Function getting an 8-bit unsigned integer from serialized data.
 
bool ts::IdenticalBytes (const void *area, size_t area_size)
 Check if a memory area contains all identical byte values.
 
bool ts::Identity (bool arg)
 MonoBoolPredicate identity.
 
template<class OSTREAM , class TRAITS = std::char_traits<typename OSTREAM::char_type>>
std::basic_ostream< typename OSTREAM::char_type, TRAITS > & ts::IOManipulator (std::basic_ostream< typename OSTREAM::char_type, TRAITS > &strm, OSTREAM &(OSTREAM::*func)())
 I/O manipulator for subclasses of std::basic_ostream.
 
template<typename T >
requires int_enum<T>
constexpr bool ts::is_negative (T x)
 Statically check if a integral or enum value is negative.
 
bool ts::IsAccented (UChar c)
 Check if a character contains an accent.
 
bool ts::IsAlpha (UChar c)
 Check if a character is a letter.
 
bool ts::IsAlphaNum (UChar c)
 Check if a character is alphanumerical.
 
bool ts::IsCombiningDiacritical (UChar c)
 Check if a character is a combining diacritical character.
 
bool ts::IsDigit (UChar c)
 Check if a character is a decimal digit.
 
bool ts::IsHexa (UChar c)
 Check if a character is an hexadecimal digit.
 
bool ts::IsLeadingSurrogate (UChar c)
 Check if a character is a "leading surrogate" value.
 
bool ts::IsLower (UChar c)
 Check if a character is a lower case letter.
 
bool ts::IsPrintable (UChar c)
 Check if a character is printable according to the current C locale.
 
bool ts::IsSpace (UChar c)
 Check if a character is a space.
 
bool ts::IsTrailingSurrogate (UChar c)
 Check if a character is a "trailing surrogate" value.
 
bool ts::IsUpper (UChar c)
 Check if a character is an upper case letter.
 
bool ts::IsValidBCD (uint8_t b)
 Check if a byte is a valid Binary Coded Decimal (BCD) value.
 
template<class CONTAINER >
size_t ts::LargestSize (const CONTAINER &container)
 Get the size of the largest object in a container of objects having a size() method.
 
UChar ts::LeadingSurrogate (char32_t cp)
 Compute the first part of the surrogate pair of a 32-bit Unicode code point (which needs a surrogate pair).
 
const uint8_t * ts::LocatePattern (const void *area, size_t area_size, const void *pattern, size_t pattern_size)
 Locate a pattern into a memory area.
 
const uint8_t * ts::LocateZeroZero (const void *area, size_t area_size, uint8_t third)
 Locate a 3-byte pattern 00 00 XY into a memory area.
 
template<typename INT >
requires std::integral<INT>
INT ts::LSBMask (size_t bits)
 Get the mask to select a given number of least significant bits in an integer value.
 
template<class MAP >
std::list< typename MAP::key_type > ts::MapKeysList (const MAP &container)
 Get the list of all keys in a map.
 
template<class MAP >
std::set< typename MAP::key_type > ts::MapKeysSet (const MAP &container)
 Get the set of all keys in a map.
 
template<class MAP >
std::list< typename MAP::mapped_type > ts::MapValuesList (const MAP &container)
 Get the list of all values in a map.
 
bool ts::Match (UChar c1, UChar c2, CaseSensitivity cs)
 Check two characters match, case sensitive or insensitive.
 
template<typename T , int storage_bits, int exponent_bits, int mantissa_bits>
requires std::floating_point<T>
constexpr bool ts::match_ieee_float ()
 This template function checks if a floating point type matches a given IEEE represenation.
 
size_t ts::MaxDecimalWidth (size_t typeSize, size_t digitSeparatorSize=0)
 Compute the maximum width of the decimal representation of an integer type.
 
size_t ts::MaxHexaWidth (size_t typeSize, size_t digitSeparatorSize=0)
 Compute the maximum width of the hexadecimal representation of an integer type.
 
int ts::MemCompare (const void *addr1, const void *addr2, size_t size)
 Comparing two memory areas.
 
void ts::MemCopy (void *dest, const void *src, size_t size)
 Copying a memory area.
 
bool ts::MemEqual (const void *addr1, const void *addr2, size_t size)
 Check if two memory areas are identical.
 
void ts::MemSet (void *addr, uint8_t value, size_t size)
 Setting a memory area.
 
void ts::MemXor (void *dest, const void *src1, const void *src2, size_t size)
 Compute an exclusive or over memory areas.
 
void ts::MemZero (void *addr, size_t size)
 Zeroing a memory area.
 
template<typename INT >
requires std::integral<INT>
bool ts::mul_overflow (INT a, INT b) platform_specific
 Check if an integer multiplication generates an overflow.
 
template<typename INT >
requires std::integral<INT>
constexpr bool ts::mul_overflow (INT a, INT b, INT res)
 Check if an integer multiplication generates an overflow.
 
bool ts::MultiAnd (std::initializer_list< bool > args)
 MultiBoolPredicate "and".
 
bool ts::MultiNand (std::initializer_list< bool > args)
 MultiBoolPredicate "nand".
 
bool ts::MultiNor (std::initializer_list< bool > args)
 MultiBoolPredicate "nor".
 
bool ts::MultiOr (std::initializer_list< bool > args)
 MultiBoolPredicate "or".
 
bool ts::Nand (bool arg1, bool arg2)
 BoolPredicate "nand".
 
bool ts::NeedSurrogate (char32_t cp)
 Check if a 32-bit Unicode code point needs a surrogate pair in UTF-16 representation.
 
template<typename INT >
requires std::integral<INT>
bool ts::neg_overflow (INT a)
 Check if the negation (opposite sign) of an integer generates an overflow.
 
bool ts::Nor (bool arg1, bool arg2)
 BoolPredicate "nor".
 
bool ts::Not (bool arg)
 MonoBoolPredicate "not".
 
template<class OSTREAM , class PARAM , class TRAITS = std::char_traits<typename OSTREAM::char_type>>
std::basic_ostream< typename OSTREAM::char_type, TRAITS > & operator<< (std::basic_ostream< typename OSTREAM::char_type, TRAITS > &strm, const ts::IOManipulatorProxy< OSTREAM, PARAM, TRAITS > &proxy)
 An overload of operator "<<" on std::basic_ostream for ts::IOManipulatorProxy.
 
std::ostream & operator<< (std::ostream &strm, const ts::DisplayInterface &obj)
 Display operator for displayable objects.
 
bool ts::Or (bool arg1, bool arg2)
 BoolPredicate "or".
 
uint64_t ts::Power10 (size_t pow)
 Get a power of 10 using a fast lookup table.
 
UChar ts::Precombined (UChar letter, UChar mark)
 Build a precombined character from its base letter and non-spacing diacritical mark.
 
void ts::PutFloat32 (void *p, ieee_float32_t f)
 Function serializing a 32-bit IEEE float data in big endian representation.
 
void ts::PutFloat32BE (void *p, ieee_float32_t f)
 Function serializing a 32-bit IEEE float data in big endian representation.
 
void ts::PutFloat32LE (void *p, ieee_float32_t f)
 Function serializing a 32-bit IEEE float data in little endian representation.
 
void ts::PutFloat64 (void *p, ieee_float64_t f)
 Function serializing a 64-bit IEEE float data in big endian representation.
 
void ts::PutFloat64BE (void *p, ieee_float64_t f)
 Function serializing a 64-bit IEEE float data in big endian representation.
 
void ts::PutFloat64LE (void *p, ieee_float64_t f)
 Function serializing a 64-bit IEEE float data in little endian representation.
 
template<typename INT >
requires std::integral<INT>
void ts::PutInt (void *p, INT i)
 Template function serializing an integer data in big endian representation.
 
void ts::PutInt16 (void *p, int16_t i)
 Function serializing a 16-bit signed integer data in big endian representation.
 
void ts::PutInt16BE (void *p, int16_t i)
 Function serializing a 16-bit signed integer data in big endian representation.
 
void ts::PutInt16LE (void *p, int16_t i)
 Function serializing a 16-bit signed integer data in little endian representation.
 
void ts::PutInt24 (void *p, int32_t i)
 Function serializing a 24-bit signed integer data in big endian representation.
 
void ts::PutInt24BE (void *p, int32_t i)
 Function serializing a 24-bit signed integer data in big endian representation.
 
void ts::PutInt24LE (void *p, int32_t i)
 Function serializing a 24-bit signed integer data in little endian representation.
 
void ts::PutInt32 (void *p, int32_t i)
 Function serializing a 32-bit signed integer data in big endian representation.
 
void ts::PutInt32BE (void *p, int32_t i)
 Function serializing a 32-bit signed integer data in big endian representation.
 
void ts::PutInt32LE (void *p, int32_t i)
 Function serializing a 32-bit signed integer data in little endian representation.
 
void ts::PutInt40BE (void *p, int64_t i)
 Function serializing a 40-bit signed integer data in big endian representation.
 
void ts::PutInt40LE (void *p, int64_t i)
 Function serializing a 40-bit signed integer data in little endian representation.
 
void ts::PutInt48BE (void *p, int64_t i)
 Function serializing a 48-bit signed integer data in big endian representation.
 
void ts::PutInt48LE (void *p, int64_t i)
 Function serializing a 48-bit signed integer data in little endian representation.
 
void ts::PutInt64 (void *p, int64_t i)
 Function serializing a 64-bit signed integer data in big endian representation.
 
void ts::PutInt64BE (void *p, int64_t i)
 Function serializing a 64-bit signed integer data in big endian representation.
 
void ts::PutInt64LE (void *p, int64_t i)
 Function serializing a 64-bit signed integer data in little endian representation.
 
void ts::PutInt8 (void *p, int8_t i)
 Function serializing an 8-bit signed integer data.
 
template<typename INT >
requires std::integral<INT>
void ts::PutIntBE (void *p, INT i)
 Template function serializing an integer data in big endian representation.
 
template<typename INT >
requires std::integral<INT>
void ts::PutIntLE (void *p, INT i)
 Template function serializing an integer data in little endian representation.
 
template<typename INT >
requires std::integral<INT>
void ts::PutIntVar (void *p, size_t size, INT i)
 Template function serializing a variable-length integer data in big endian representation.
 
template<typename INT >
requires std::integral<INT>
void ts::PutIntVarBE (void *p, size_t size, INT i)
 Template function serializing a variable-length integer data in big endian representation.
 
template<typename INT >
requires std::integral<INT>
void ts::PutIntVarLE (void *p, size_t size, INT i)
 Template function serializing a variable-length integer data in little endian representation.
 
void ts::PutUInt16 (void *p, uint16_t i)
 Function serializing a 16-bit unsigned integer data in big endian representation.
 
void ts::PutUInt16BE (void *p, uint16_t i)
 Function serializing a 16-bit unsigned integer data in big endian representation.
 
void ts::PutUInt16LE (void *p, uint16_t i)
 Function serializing a 16-bit unsigned integer data in little endian representation.
 
void ts::PutUInt24 (void *p, uint32_t i)
 Function serializing a 24-bit unsigned integer data in big endian representation.
 
void ts::PutUInt24BE (void *p, uint32_t i)
 Function serializing a 24-bit unsigned integer data in big endian representation.
 
void ts::PutUInt24LE (void *p, uint32_t i)
 Function serializing a 24-bit unsigned integer data in little endian representation.
 
void ts::PutUInt32 (void *p, uint32_t i)
 Function serializing a 32-bit unsigned integer data in big endian representation.
 
void ts::PutUInt32BE (void *p, uint32_t i)
 Function serializing a 32-bit unsigned integer data in big endian representation.
 
void ts::PutUInt32LE (void *p, uint32_t i)
 Function serializing a 32-bit unsigned integer data in little endian representation.
 
void ts::PutUInt40 (void *p, uint64_t i)
 Function serializing a 40-bit unsigned integer data in big endian representation.
 
void ts::PutUInt40BE (void *p, uint64_t i)
 Function serializing a 40-bit unsigned integer data in big endian representation.
 
void ts::PutUInt40LE (void *p, uint64_t i)
 Function serializing a 40-bit unsigned integer data in little endian representation.
 
void ts::PutUInt48 (void *p, uint64_t i)
 Function serializing a 48-bit unsigned integer data in big endian representation.
 
void ts::PutUInt48BE (void *p, uint64_t i)
 Function serializing a 48-bit unsigned integer data in big endian representation.
 
void ts::PutUInt48LE (void *p, uint64_t i)
 Function serializing a 48-bit unsigned integer data in little endian representation.
 
void ts::PutUInt64 (void *p, uint64_t i)
 Function serializing a 64-bit unsigned integer data in big endian representation.
 
void ts::PutUInt64BE (void *p, uint64_t i)
 Function serializing a 64-bit unsigned integer data in big endian representation.
 
void ts::PutUInt64LE (void *p, uint64_t i)
 Function serializing a 64-bit unsigned integer data in little endian representation.
 
void ts::PutUInt8 (void *p, uint8_t i)
 Function serializing an 8-bit unsigned integer data.
 
template<typename INT >
requires std::integral<INT>
std::vector< INTts::Range (INT first, INT last)
 Build a vector of integers containing all values in a range.
 
UString ts::RemoveAccent (UChar c)
 Remove all forms of accent or composition from a character.
 
template<class CONTAINER >
void ts::RemoveDuplicates (CONTAINER &container)
 Remove duplicated elements in a container.
 
template<typename INT >
requires std::integral<INT>
INT ts::round_down (INT x, INT f)
 Round x down to previous multiple of a factor f.
 
template<typename INT >
requires std::integral<INT>
INT ts::round_up (INT x, INT f)
 Round x up to next multiple of a factor f.
 
template<typename INT >
requires std::integral<INT>
constexpr INT ts::rounded_div (INT a, INT b)
 Integer division with rounding to closest value (instead of truncating).
 
template<class T , class U >
void ts::set_default (std::optional< T > &opt, const U &value)
 Set a default value in a std::optional object, if there is none.
 
template<typename INT >
requires std::integral<INT>
constexpr void ts::sign_reduce (INT &num, INT &den)
 Reduce the sign of an integer fraction.
 
template<typename INT >
requires std::integral<INT>
constexpr const UCharts::SignedDescription ()
 Get the signed/unsigned qualifier of an integer type as a string.
 
template<typename INT >
requires std::signed_integral<INT>
INT ts::SignExtend (INT x, size_t bits)
 Perform a sign extension on any subset of a signed integer.
 
int32_t ts::SignExtend24 (int32_t x)
 Perform a sign extension on 24 bit integers.
 
int64_t ts::SignExtend40 (int64_t x)
 Perform a sign extension on 40 bit integers.
 
int64_t ts::SignExtend48 (int64_t x)
 Perform a sign extension on 48 bit integers.
 
template<class CONTAINER >
size_t ts::SmallestSize (const CONTAINER &container)
 Get the size of the smallest object in a container of objects having a size() method.
 
bool ts::StartsWith (const void *area, size_t area_size, const void *prefix, size_t prefix_size)
 Check if a memory area starts with the specified prefix.
 
template<typename INT >
requires std::integral<INT>
bool ts::sub_overflow (INT a, INT b) platform_specific
 Check if an integer substraction generates an overflow.
 
template<typename INT >
requires std::integral<INT>
bool ts::sub_overflow (INT a, INT b, INT res)
 Check if an integer substraction generates an overflow.
 
template<typename INT >
requires std::integral<INT>
void ts::thow_neg_overflow (INT a)
 Throw an exception if the negation (opposite sign) of an integer generates an overflow.
 
template<typename INT >
requires std::integral<INT>
void ts::throw_add_overflow (INT a, INT b, INT res)
 Throw an exception if an integer addition generates an overflow.
 
template<typename INT1 , typename INT2 >
requires std::integral<INT1> && std::integral<INT2>
void ts::throw_bound_check (INT2 x)
 Throw an exception if an integer value does not fall into the range of another integer type.
 
template<typename INT >
requires std::integral<INT>
void ts::throw_div_zero (INT den)
 Throw an exception if the denominator of an integer division is zero.
 
template<typename INT >
requires std::integral<INT>
void ts::throw_mul_overflow (INT a, INT b, INT res)
 Throw an exception if an integer multiplication generates an overflow.
 
template<typename INT >
requires std::integral<INT>
void ts::throw_sub_overflow (INT a, INT b, INT res)
 Throw an exception if an integer substraction generates an overflow.
 
int ts::ToDigit (UChar c, int base=10, int defaultValue=-1)
 Convert a character representing a multi-base integer digit into the corresponding integer value.
 
UString ts::ToHTML (UChar c)
 Convert a character into its corresponding HTML sequence.
 
UChar ts::ToLower (UChar c)
 Convert a character to lowercase.
 
template<typename INT >
requires std::integral<INT>
Tristate ts::ToTristate (INT i)
 Normalize any integer value in the range of a Tristate value.
 
UChar ts::ToUpper (UChar c)
 Convert a character to uppercase.
 
UChar ts::TrailingSurrogate (char32_t cp)
 Compute the second part of the surrogate pair of a 32-bit Unicode code point (which needs a surrogate pair).
 
uint32_t ts::UCharacteristics (UChar c)
 Get the characteristics of a character.
 
uint64_t ts::UID ()
 Generate a new 64-bit UID, unique integer.
 
bool ts::Xor (bool arg1, bool arg2)
 BoolPredicate "exclusive or".
 

Variables

template<typename T >
constexpr bool ts::dependent_false = std::false_type::value
 A "false" expression which is built from a template type T.
 
constexpr std::uintmax_t ts::FS_ERROR = static_cast<std::uintmax_t>(-1)
 This error code is returned by some functions in std::filesystem.
 
constexpr size_t ts::MAX_POWER_10 = 19
 Largest representable power of 10 in integer types.
 
constexpr size_t ts::NPOS = size_t(-1)
 Constant meaning "no size", "not found" or "do not resize".
 

Detailed Description

C++ language features and design patterns.

Macro Definition Documentation

◆ TS_MSC

#define TS_MSC

Defined when the compiler is Microsoft C/C++, the default compiler in the Microsoft Visual Studio environment.

Also used on command line and batch file as the cl command.

◆ TS_GCC_VERSION

#define TS_GCC_VERSION

GCC version, encoded as an integer.

Example: 40801 for GCC 4.8.1. Undefined when the compiler is not GCC or its version is unknown.

◆ TS_CPLUSPLUS

#define TS_CPLUSPLUS

Level of C++ language, same as predefined __cplusplus, but safe with MSVC.

Microsoft-specific ways of signaling the language level: With Visual Studio 2017, there are flags such as /std:c++14 to specify the level of language. However, __cplusplus is still set to 199711L. It is unclear if this is a bug or if __cplusplus is not set because the C++11/14/17 standards all not super-completely implemented. The Microsoft-specific symbol _MSVC_LANG is defined to describe a "good-enough" level of standard which is fine for us.

The current version of TSDuck requires C++20 at least (GCC 11, clang 5, Visual Studio 2017 15.8).

◆ TS_UNIX

#define TS_UNIX

Defined when compiled for any flavor of UNIX target platforms.

This symbol comes in addition to the specific symbol for the target platform (TS_LINUX, etc.)

◆ TS_ASM_ARM64

#define TS_ASM_ARM64

Defined when the target processor architecture is 64-bit ARM and inline assembler is allowed.

This is typically true with GCC and Clang but false with MSC.

◆ TSDUCK_STATIC_PLUGINS

#define TSDUCK_STATIC_PLUGINS

User-defined macro to enable static linking of plugins.

If TSDUCK_STATIC_PLUGINS is defined, typically on the compilation command line, all plugins are linked statically. Dynamic loading of plugins is disabled.

◆ TSDUCK_STATIC_LIBRARY

#define TSDUCK_STATIC_LIBRARY

Applications which link against the TSDuck static library.

Applications which link against the TSDuck static library should define TSDUCK_STATIC_LIBRARY. This symbol can be used to force external references.

TSDUCK_STATIC_LIBRARY enforces TSDUCK_STATIC_PLUGINS.

◆ TSDUCK_STATIC

#define TSDUCK_STATIC

User-defined macro to enable full static linking.

If TSDUCK_STATIC is defined, typically on the compilation command line, the code is compiled and linked statically, including system libraries. On Linux, this is not recommended since a few features such as IP address resolution are disabled.

TSDUCK_STATIC enforces TSDUCK_STATIC_LIBRARY and TSDUCK_STATIC_PLUGINS.

◆ TS_STRINGIFY

#define TS_STRINGIFY (   x)

This macro transforms the value of a macro parameter into the equivalent string literal.

This is a very specific macro. It is typically used only inside the definition of another macro. It is similar to the # token in the preprocessor but has a slightly different effect. The # token transforms the text of a macro parameter into a string while TS_STRINGIFY transforms the value of a macro parameter into a string, after all preprocessing substitutions.

The following example illustrates the difference between the # token and TS_STRINGIFY:

#define P1(v) printf("#parameter: %s = %d\n", #v, v)
#define P2(v) printf("TS_STRINGIFY: %s = %d\n", TS_STRINGIFY(v), v)
....
#define X 1
P1(X);
P2(X);

This will print:

#parameter: X = 1
#define TS_STRINGIFY(x)
This macro transforms the value of a macro parameter into the equivalent string literal.
Definition tsPlatform.h:532

◆ TS_USTRINGIFY

#define TS_USTRINGIFY (   x)

This macro transforms the value of a macro parameter into the equivalent 16-bit Unicode string literal.

This macro is equivalent to TS_STRINGIFY() except that the string literal is of the for u"..." instead of "..."

See also
TS_STRINGIFY()

◆ TS_UNIQUE_NAME

#define TS_UNIQUE_NAME (   prefix)

This macro generates a unique name based on the source line number.

It is typically used in more complex macro definitions. These complex macros should be defined on one single line. All invocations of TS_UNIQUE_NAME generate the same symbol when placed one the same source line.

Parameters
prefixPrefix for the symbol. Using different prefixes, several distinct unique identifiers can be used on the same line.

◆ TS_PRAGMA

#define TS_PRAGMA (   directive)

Helper macro for the C++11 keyword _Pragma.

With the C++11 standard, the keywork _Pragma uses a string literal. However, Visual C++ does not support it as of Visual Studio 2019. Instead, it uses the non-standard keyword __pragma with a plain directive (not a string).

Parameters
directiveThe directive for the pragma. Plain directive, not a string literal.

Examples (depending on compilers):

TS_PRAGMA(clang diagnostic push)
TS_PRAGMA(GCC diagnostic push)
TS_PRAGMA(warning(push))
#define TS_PRAGMA(directive)
Helper macro for the C++11 keyword _Pragma.
Definition tsPlatform.h:588

◆ TS_PUSH_WARNING

#define TS_PUSH_WARNING ( )

Save the compiler's warnings reporting.

See also
TS_POP_WARNING

◆ TS_POP_WARNING

#define TS_POP_WARNING ( )

Restore the compiler's warnings reporting from a previous TS_PUSH_WARNING().

See also
TS_PUSH_WARNING

◆ TS_LLVM_NOWARNING

#define TS_LLVM_NOWARNING (   name)

Disable a warning with the LLVM/clang compiler (does nothing on other compilers).

Parameters
nameWarning name, as used after command line option -W

◆ TS_GCC_NOWARNING

#define TS_GCC_NOWARNING (   name)

Disable a warning with the GCC compiler (does nothing on other compilers).

Parameters
nameWarning name, as used after command line option -W

◆ TS_MSC_NOWARNING

#define TS_MSC_NOWARNING (   num)

Disable a warning with the Microsoft Visual C++ compiler (does nothing on other compilers).

Parameters
numWarning number.

◆ TS_NO_OPTIMIZE

#define TS_NO_OPTIMIZE   platform_specific

Attribute to explicitly disable optimization in a function.

Example:

void f() TS_NO_OPTIMIZE;
#define TS_NO_OPTIMIZE
Attribute to explicitly disable optimization in a function.
Definition tsPlatform.h:787

◆ TS_FUNCTION

#define TS_FUNCTION

Definition of the name of the current function.

This is typically func but recent compilers have "pretty" names for C++.

◆ TS_NOCOPY

#define TS_NOCOPY (   classname)
Value:
private: \
classname(classname&&) = delete; \
classname(const classname&) = delete; \
classname& operator=(classname&&) = delete; \
classname& operator=(const classname&) = delete

A macro to disable object copy in the declaration of a class.

The copy and move constructors and assignments are explicitly deleted.

Parameters
classnameName of the enclosing class.

◆ TS_NOMOVE

#define TS_NOMOVE (   classname)
Value:
private: \
classname(classname&&) = delete; \
classname& operator=(classname&&) = delete

A macro to disable object move in the declaration of a class.

The move constructor and assignment are explicitly deleted.

Parameters
classnameName of the enclosing class.

◆ TS_NOBUILD_NOCOPY

#define TS_NOBUILD_NOCOPY (   classname)
Value:
private: \
classname() = delete; \
classname(classname&&) = delete; \
classname(const classname&) = delete; \
classname& operator=(classname&&) = delete; \
classname& operator=(const classname&) = delete

A macro to disable default constructor and object copy in the declaration of a class.

The default, copy and move constructors and assignments are explicitly deleted.

Parameters
classnameName of the enclosing class.

◆ TS_NO_DEFAULT_CONSTRUCTORS

#define TS_NO_DEFAULT_CONSTRUCTORS (   classname)
Value:
private: \
classname() = delete; \
classname(classname&&) = delete; \
classname(const classname&) = delete

A macro to disable default constructors in the declaration of a class.

The default, copy and move constructors are explicitly deleted.

Parameters
classnameName of the enclosing class.

◆ TS_DEFAULT_ASSIGMENTS

#define TS_DEFAULT_ASSIGMENTS (   classname)
Value:
public: \
\
classname& operator=(classname&&) = default; \
classname& operator=(const classname&) = default \

A macro to declare the default assignment operators in the declaration of a class.

Parameters
classnameName of the enclosing class.

◆ TS_DEFAULT_COPY_MOVE

#define TS_DEFAULT_COPY_MOVE (   classname)
Value:
public: \
\
classname(classname&&) = default; \
classname(const classname&) = default; \
classname& operator=(classname&&) = default; \
classname& operator=(const classname&) = default \

A macro to declare the default copy and move constructors and assignment operators in the declaration of a class.

Parameters
classnameName of the enclosing class.

◆ TS_RULE_OF_FIVE

#define TS_RULE_OF_FIVE (   classname,
  dtor_attributes 
)
Value:
public: \
\
classname(classname&&) = default; \
classname(const classname&) = default; \
classname& operator=(classname&&) = default; \
classname& operator=(const classname&) = default; \
virtual ~classname() dtor_attributes \

A macro to apply the C++ "rule of five" in the declaration of a class.

An explicit virtual destructor is declared. The copy and move constructors and assignments are defaulted.

Parameters
classnameName of the enclosing class.
dtor_attributesPost attributes for the destructor.

◆ TS_INTERFACE

#define TS_INTERFACE (   classname)
Value:
public: \
\
classname() = default; \
classname(classname&&) = default; \
classname(const classname&) = default; \
classname& operator=(classname&&) = default; \
classname& operator=(const classname&) = default; \
virtual ~classname(); \
auto operator<=>(const classname&) const = default \

A macro to declare the basic operators in the declaration of an interface class.

Parameters
classnameName of the enclosing class.

◆ TS_SINGLETON

#define TS_SINGLETON (   classname)

Singleton class declaration.

A singleton is a design pattern where a class can have only one instance. The macro TS_SINGLETON must be used inside the singleton class declaration.

Parameters
classnameName of the singleton class, without namespace or outer class name.

Example code:

// File: MySingle.h
namespace foo {
class MySingle {
TS_SINGLETON(MySingle);
....
#define TS_SINGLETON(classname)
Singleton class declaration.
Definition tsPlatform.h:1001
// File: MySingle.cpp
#include "MySingle.h"
TS_DEFINE_SINGLETON(foo::MySingle);
foo::MySingle::MySingle() : ... { ... }
....
#define TS_DEFINE_SINGLETON(fullclassname)
Singleton class definition.
Definition tsPlatform.h:1019

The class becomes a singleton. The default constructor is private. Use static Instance() method to get the instance of the singleton.

See also
TS_DEFINE_SINGLETON()

◆ TS_DEFINE_SINGLETON

#define TS_DEFINE_SINGLETON (   fullclassname)

Singleton class definition.

The macro TS_DEFINE_SINGLETON must be used in the implementation of a singleton class.

Parameters
fullclassnameFully qualified name of the singleton class.
See also
TS_SINGLETON()

◆ TS_STATIC_REFERENCE

#define TS_STATIC_REFERENCE (   suffix,
  addr 
)

This macro generates a reference to some address (string literal, external symbol, etc.) The reference is a unique static symbol which is otherwise unused.

The difficulty is to make sure that the compiler will not optimize away this data (it is local and unused).

Parameters
suffixSome unique suffix if the macro is invoked several times on the same line.
addrAn address to reference (string literal, external symbol, etc.)

◆ TS_ENABLE_BITMASK_OPERATORS

#define TS_ENABLE_BITMASK_OPERATORS (   T)

This macro enables bitmask operators on an enumeration type.

Parameters
TAn enumeration type or enumeration class.

Example:

enum E {A = 0x01, B = 0x02, C = 0x04};
E e = A | B | C;
e ^= B | C;
#define TS_ENABLE_BITMASK_OPERATORS(T)
This macro enables bitmask operators on an enumeration type.
Definition tsEnumUtils.h:50

◆ TS_DECLARE_EXCEPTION

#define TS_DECLARE_EXCEPTION (   name)

This macro declares an exception as a subclass of ts::Exception.

Parameters
[in]nameName of the exception class.

◆ TS_ZERO

#define TS_ZERO (   var)    ts::MemZero(&(var), sizeof(var))

Zeroing an plain memory variable.

Do not use with instances of C++ classes.

Parameters
[out]varName of a variable.

◆ TS_REGISTER_CHRONO_UNIT

#define TS_REGISTER_CHRONO_UNIT (   classname,
  ... 
)

Registration of a new std::chrono::duration unit name.

Parameters
classnameAn instance of std::chrono::duration.

Typedef Documentation

◆ deciseconds

using ts::deciseconds = typedef cn::duration<cn::milliseconds::rep, std::deci>

A derivative of std::chrono::duration for deciseconds (1/10 of a second).

See also
std::chrono::milliseconds
std::chrono::seconds

◆ ieee_float80_t

using ts::ieee_float80_t = typedef typename ieee_float<80, 15, 64>::type

80-bit IEEE floating point type.

Some systems cannot implement this. It is typically only available on Intel platforms. On other platforms, this type is void..

◆ ieee_float128_t

using ts::ieee_float128_t = typedef typename ieee_float<128, 15, 112>::type

128-bit IEEE floating point type.

Some systems cannot implement this. GCC and Clang on Intel use a 80-bit floating type for long double. In that case, this type is void.

◆ underlying_type_t

template<typename T >
using ts::underlying_type_t = typedef typename underlying_type<T>::type

Helper type for ts::underlying_type.

Template Parameters
TAn integral or enumeration type.

◆ make_signed_t

template<typename T >
using ts::make_signed_t = typedef typename make_signed<T>::type

Helper type for ts::make_signed.

Template Parameters
TAn integral or floating-point type.

◆ int_max_t

template<typename INT >
using ts::int_max_t = typedef typename int_max<INT>::type

Helper type for ts::int_max.

Template Parameters
INTAn integer type, any size, signed or unsigned.

Enumeration Type Documentation

◆ ShareMode

enum class ts::ShareMode
strong

Enumeration type used to indicate if the data referenced by a pointer shall be copied or shared.

Enumerator
COPY 

Data shall be copied.

SHARE 

Data shall be shared.

◆ Tristate

enum class ts::Tristate
strong

Tristate boolean.

More generally:

  • Zero means false.
  • Any positive value means true.
  • Any negative value means "maybe" or "dont't know".
Enumerator
Maybe 

Undefined value (and more generally all negative values).

False 

Built-in false.

True 

True value (and more generally all positive values).

◆ Replacement

enum class ts::Replacement : uint8_t
strong

Enumeration type used to indicate the replacement policy in containers of data structures.

Each data structure is supposed to have a unique "identifier" inside the container. The exact interpretation of each policy may depend on the service which uses it. Can be used as a bit mask.

Enumerator
NONE 

No known standard.

UPDATE 

Update data structures with similar "identifier".

REPLACE 

Replace data structures with similar "identifier".

ADD 

Add new data structures with "identifier" not present in the container.

REMOVE 

Remove from the container any data structure with unknown "identifier" for the service.

◆ CaseSensitivity

Case sensitivity used on string operations.

Enumerator
CASE_SENSITIVE 

The operation is case-sensitive.

CASE_INSENSITIVE 

The operation is not case-sensitive.

◆ anonymous enum

anonymous enum : uint32_t

Characteristics of a character.

Bitwise combinations are allowed.

Enumerator
CCHAR_LETTER 

The character is a letter.

CCHAR_DIGIT 

The character is a digit.

CCHAR_HEXA 

The character is an hexadecimal digit.

CCHAR_LATIN 

The character is latin.

CCHAR_GREEK 

The character is greek.

CCHAR_HEBREW 

The character is hebrew.

CCHAR_ARABIC 

The character is arabic.

CCHAR_THAI 

The character is thai.

CCHAR_CYRILLIC 

The character is cyrillic.

CCHAR_CDIACRIT 

The character is combining diacritical.

CCHAR_SPACE 

The character is space.

CCHAR_PRINT 

The character is printable.

◆ StringDirection

Direction used on string operations.

Enumerator
LEFT_TO_RIGHT 

From beginning of string.

RIGHT_TO_LEFT 

From end of string.

◆ StringComparison

enum ts::StringComparison : uint32_t

Options used on string comparisons.

Can be combined with or.

Enumerator
SCOMP_DEFAULT 

Default, strict comparison.

SCOMP_CASE_INSENSITIVE 

Case insensitive comparison.

SCOMP_IGNORE_BLANKS 

Skip blank characters in comparison.

SCOMP_NUMERIC 

Sort numeric fields according to numeric values.

Function Documentation

◆ EnumerateCombinations()

template<typename T , class UnaryPredicate >
bool ts::EnumerateCombinations ( const std::set< T > &  values,
const std::set< T > &  fixed,
size_t  size,
UnaryPredicate  predicate 
)

Enumerate all 'k'-elements combinations of a 'n'-elements set.

This function enumerates all possible sets of 'k' elements within a set of 'n' elements. For each combination, a user-supplied predicate is invoked. The signature of the predicate function should be equivalent to the following:

bool p (const std::set<T>& combination);

The signature does not need to have const, but the function must not modify the set which is passed to it. The function returns true when the search for more combinations shall continue and false when the search shall prematurely stops.

Template Parameters
TThe type of elements in the sets.
UnaryPredicateThe type of unary predicate returning true or false from one set of elements of type T.
Parameters
valuesThe set of all values from which the combinations are built. The size of values is the 'n' in the sentence "enumerate all 'k'-elements combinations of a 'n'-elements set".
fixedThe set of fixed values which must be present in all combinations. To enumerate all possible combinations in values, use an empty set for fixed. If fixed is not empty, the predicate will be invoked only with combinations of values which contains all elements in fixed.
sizeThe size (number of elements) of the combinations to enumerate. This is the 'k' in the sentence "enumerate all 'k'-elements combinations of a 'n'-elements set".
predicateThe unary predicate to invoke for each possible combination of size elements in values. If predicate returns true, the search for more combination continues. When predicate returns false, the search is interrupted immediately and no more combination is proposed. Example: When the application searches for a combination which matches specific properties, the application's predicate returns false when a matching combination is found to avoid looking for additional combinations.
Returns
True if all combinations were searched and false if the search was interrupted because predicate returned false at some point.

◆ AppendUnique()

template<typename ELEMENT , class CONTAINER >
bool ts::AppendUnique ( CONTAINER &  container,
const ELEMENT &  e 
)

Append an element into a container if not already present in the container.

If the element e is not already present in the container, e is appended at the end of the container. Otherwise, the container is left unmodified.

Template Parameters
ELEMENTAny type.
CONTAINERA container class of ELEMENT as defined by the C++ Standard Template Library (STL).
Parameters
[in,out]containerA container of ELEMENT.
[in]eAn element to conditionally append to container.
Returns
True if e was appended in the container, false if it was already present.

◆ RemoveDuplicates()

template<class CONTAINER >
void ts::RemoveDuplicates ( CONTAINER &  container)

Remove duplicated elements in a container.

When duplicates are found, this first occurence is kept, aothers are removed.

The predefined function std::unique() removes duplicated elements when they are consecutive only. This function removes all duplicates.

Template Parameters
CONTAINERA container class as defined by the C++ Standard Template Library (STL).
Parameters
[in,out]containerA container into which duplicates are removed.

◆ SmallestSize()

template<class CONTAINER >
size_t ts::SmallestSize ( const CONTAINER &  container)

Get the size of the smallest object in a container of objects having a size() method.

Template Parameters
CONTAINERA container class as defined by the C++ Standard Template Library (STL).
Parameters
[in]containerA container of objects.
Returns
The size of the smallest object in container.

◆ LargestSize()

template<class CONTAINER >
size_t ts::LargestSize ( const CONTAINER &  container)

Get the size of the largest object in a container of objects having a size() method.

Template Parameters
CONTAINERA container class as defined by the C++ Standard Template Library (STL).
Parameters
[in]containerA container of objects.
Returns
The size of the largest object in container.

◆ MapKeysList()

template<class MAP >
std::list< typename MAP::key_type > ts::MapKeysList ( const MAP &  container)

Get the list of all keys in a map.

Template Parameters
MAPA map container class as defined by the C++ Standard Template Library (STL).
Parameters
[in]containerA container of objects.
Returns
The list of all keys in container.

◆ MapKeysSet()

template<class MAP >
std::set< typename MAP::key_type > ts::MapKeysSet ( const MAP &  container)

Get the set of all keys in a map.

Template Parameters
MAPA map container class as defined by the C++ Standard Template Library (STL).
Parameters
[in]containerA container of objects.
Returns
The set of all keys in container.

◆ MapValuesList()

template<class MAP >
std::list< typename MAP::mapped_type > ts::MapValuesList ( const MAP &  container)

Get the list of all values in a map.

Template Parameters
MAPA map container class as defined by the C++ Standard Template Library (STL).
Parameters
[in]containerA container of objects.
Returns
The list of all values in container.

◆ Range()

template<typename INT >
requires std::integral<INT>
std::vector< INT > ts::Range ( INT  first,
INT  last 
)

Build a vector of integers containing all values in a range.

Template Parameters
INTAn integral type.
Parameters
[in]firstFirst value of the range.
[in]lastLast value of the range.
Returns
A vector of INT containing all values from min to max, inclusive.

◆ IOManipulator()

template<class OSTREAM , class TRAITS = std::char_traits<typename OSTREAM::char_type>>
std::basic_ostream< typename OSTREAM::char_type, TRAITS > & ts::IOManipulator ( std::basic_ostream< typename OSTREAM::char_type, TRAITS > &  strm,
OSTREAM &(OSTREAM::*)()  func 
)

I/O manipulator for subclasses of std::basic_ostream.

The standard C++ library contains support for I/O manipulators on std::basic_ios, std::basic_istream and std::basic_ostream but not for their subclasses. This template function is a support routine for I/O manipulators on subclasses.

Sample usage:

namespace ts {
// The class:
class TextFormatter : public std::basic_ostream<char>
{
public:
....
};
// The I/O manipulator:
std::ostream& margin(std::ostream& os)
{
}
}
// Usage:
out << ts::margin << "<foo>" << std::endl;
Format and print a text document using various output types and indentation.
Definition tsTextFormatter.h:29
TextFormatter & margin()
Insert all necessary new-lines and spaces to move to the current margin.
std::basic_ostream< typename OSTREAM::char_type, TRAITS > & IOManipulator(std::basic_ostream< typename OSTREAM::char_type, TRAITS > &strm, OSTREAM &(OSTREAM::*func)())
I/O manipulator for subclasses of std::basic_ostream.
Definition tsAlgorithm.h:207
TSDuck namespace, containing all TSDuck classes and functions.
Definition tsAbstractOutputStream.h:17
std::ostream & margin(std::ostream &os)
I/O manipulator for TextFormatter: move to the current margin.
Definition tsTextFormatter.h:252
Template Parameters
OSTREAMA subclass of std::basic_ostream.
Parameters
[in,out]strmThe stream of class OSTREAM to manipulate.
[in]funcA pointer to member function in OSTREAM. This method shall take no parameter and return a reference to the OSTREAM object.
Returns
A reference to the strm object.

◆ operator<<() [1/2]

template<class OSTREAM , class PARAM , class TRAITS = std::char_traits<typename OSTREAM::char_type>>
std::basic_ostream< typename OSTREAM::char_type, TRAITS > & operator<< ( std::basic_ostream< typename OSTREAM::char_type, TRAITS > &  strm,
const ts::IOManipulatorProxy< OSTREAM, PARAM, TRAITS > &  proxy 
)

An overload of operator "<<" on std::basic_ostream for ts::IOManipulatorProxy.

Template Parameters
OSTREAMA subclass of std::basic_ostream.
PARAMThe type of the parameter for the manipulator.
Parameters
[in,out]strmThe stream of class OSTREAM to manipulate.
[in]proxyThe ts::IOManipulatorProxy object.
Returns
A reference to the strm object.
See also
ts::IOManipulatorProxy

◆ Identity()

bool ts::Identity ( bool  arg)
inline

MonoBoolPredicate identity.

Parameters
[in]argA boolean argument.
Returns
The same as arg.

◆ Not()

bool ts::Not ( bool  arg)
inline

MonoBoolPredicate "not".

Parameters
[in]argA boolean argument.
Returns
Not arg.

◆ And()

bool ts::And ( bool  arg1,
bool  arg2 
)
inline

BoolPredicate "and".

Note this predicate does not allow the traditional "&&" short circuit. The two arguments are always evaluated.

Parameters
[in]arg1A boolean argument.
[in]arg2A boolean argument.
Returns
arg1 and arg2.

◆ Or()

bool ts::Or ( bool  arg1,
bool  arg2 
)
inline

BoolPredicate "or".

Note this predicate does not allow the traditional "||" short circuit. The two arguments are always evaluated.

Parameters
[in]arg1A boolean argument.
[in]arg2A boolean argument.
Returns
arg1 or arg2.

◆ Nand()

bool ts::Nand ( bool  arg1,
bool  arg2 
)
inline

BoolPredicate "nand".

Parameters
[in]arg1A boolean argument.
[in]arg2A boolean argument.
Returns
Not arg1 and arg2.

◆ Nor()

bool ts::Nor ( bool  arg1,
bool  arg2 
)
inline

BoolPredicate "nor".

Parameters
[in]arg1A boolean argument.
[in]arg2A boolean argument.
Returns
Notarg1 or arg2.

◆ Xor()

bool ts::Xor ( bool  arg1,
bool  arg2 
)
inline

BoolPredicate "exclusive or".

Parameters
[in]arg1A boolean argument.
[in]arg2A boolean argument.
Returns
arg1 xor arg2.

◆ MultiAnd()

bool ts::MultiAnd ( std::initializer_list< bool >  args)

MultiBoolPredicate "and".

Parameters
[in]argsA variable list of boolean arguments.
Returns
True if all boolean values in args are true, false otherwise.

◆ MultiOr()

bool ts::MultiOr ( std::initializer_list< bool >  args)

MultiBoolPredicate "or".

Parameters
[in]argsA variable list of boolean arguments.
Returns
True if any boolean values in args is true, false otherwise.

◆ MultiNand()

bool ts::MultiNand ( std::initializer_list< bool >  args)
inline

MultiBoolPredicate "nand".

Parameters
[in]argsA variable list of boolean arguments.
Returns
False if all boolean values in args are true, true otherwise.

◆ MultiNor()

bool ts::MultiNor ( std::initializer_list< bool >  args)
inline

MultiBoolPredicate "nor".

Parameters
[in]argsA variable list of boolean arguments.
Returns
False if any boolean values in args is true, true otherwise.

◆ UID()

uint64_t ts::UID ( )

Generate a new 64-bit UID, unique integer.

Returns
A new unique 64-bit value.

◆ ToTristate()

template<typename INT >
requires std::integral<INT>
Tristate ts::ToTristate ( INT  i)

Normalize any integer value in the range of a Tristate value.

Template Parameters
INTAn integer type.
Parameters
[in]iThe integer value.
Returns
The corresponding Tristate value.

◆ set_default()

template<class T , class U >
void ts::set_default ( std::optional< T > &  opt,
const U &  value 
)
inline

Set a default value in a std::optional object, if there is none.

Template Parameters
TThe type of the optional object.
UThe type of the default value to set.
Parameters
[in,out]optThe optinal object to set.
[in]valueThe value to set in obj if it is not initialized.

◆ ClassName() [1/2]

UString ts::ClassName ( const std::type_index  index)

Get the name of a class from the type_index of a class.

The result may be not portable.

Parameters
[in]indexThe type_index of a class.
Returns
An implementation-specific name of the class.

◆ ClassName() [2/2]

UString ts::ClassName ( const std::type_info &  info)
inline

Get the name of a class from the type_info of an object.

The result may be not portable.

Parameters
[in]infoThe type_info of an object.
Returns
An implementation-specific name of the object class.

◆ IsValidBCD()

bool ts::IsValidBCD ( uint8_t  b)
inline

Check if a byte is a valid Binary Coded Decimal (BCD) value.

Parameters
[in]bA byte containing a BCD-encoded value.
Returns
True if the value is valid BCDn false otherwise.

◆ DecodeBCD() [1/2]

int ts::DecodeBCD ( uint8_t  b)
inline

Return the decimal value of a Binary Coded Decimal (BCD) encoded byte.

Parameters
[in]bA byte containing a BCD-encoded value.
Returns
The decoded value in the range 0 to 99.

◆ EncodeBCD() [1/2]

uint8_t ts::EncodeBCD ( int  i)
inline

Return a one-byte Binary Coded Decimal (BCD) representation of an integer.

Parameters
[in]iThe integer to encode (must be in 0..99).
Returns
One byte containing the BCD-encoded value of i.

◆ DecodeBCD() [2/2]

uint32_t ts::DecodeBCD ( const uint8_t *  bcd,
size_t  bcd_count,
bool  left_justified = true 
)

Return the decimal value of a Binary Coded Decimal (BCD) encoded string.

Parameters
[in]bcdAddress of an array of bytes.
[in]bcd_countNumber of BCD digits (bcd_count / 2 bytes). Note that bcd_count can be even.
[in]left_justifiedWhen true (the default), the first BCD digit starts in the first half of the first byte. When false and bcd_count is odd, the first BCD digit starts in the second half of the first byte. Ignored when bcd_count is even.
Returns
The decoded integer value.

◆ EncodeBCD() [2/2]

void ts::EncodeBCD ( uint8_t *  bcd,
size_t  bcd_count,
uint32_t  value,
bool  left_justified = true,
uint8_t  pad_nibble = 0 
)

Encode a Binary Coded Decimal (BCD) string.

Parameters
[out]bcdAddress of an array of bytes. Its size must be at least (bcd_count + 1) / 2 bytes.
[in]bcd_countNumber of BCD digits. Note that bcd_count can be even.
[in]valueThe value to encode.
[in]left_justifiedWhen true (the default), the first BCD digit starts in the first half of the first byte. When false and bcd_count is odd, the first BCD digit starts in the second half of the first byte. This parameter is ignored when bcd_count is even.
[in]pad_nibbleA value in the range 0..15 to set in the unused nibble when bcd_count is odd. This is the first half of the first byte when left_justified is false. This is the second half of the last byte when left_justified is true. This parameter is ignored when bcd_count is even.

◆ BCDToString()

void ts::BCDToString ( std::string &  str,
const uint8_t *  bcd,
size_t  bcd_count,
int  decimal,
bool  left_justified = true 
)

Decode a string representation of a variable-length Binary Coded Decimal (BCD) encoded integer.

Parameters
[out]strReturned string representation.
[in]bcdAddress of an array of bytes.
[in]bcd_countNumber of BCD digits (bcd_count / 2 bytes). Note that bcd_count can be even.
[in]decimalIndicates the position of the virtual decimal point (-1: none, 0: before first digit, 1: after first digit, etc.)
[in]left_justifiedWhen true (the default), the first BCD digit starts in the first half of the first byte. When false and bcd_count is odd, the first BCD digit starts in the second half of the first byte. Ignored when bcd_count is even.

◆ SignExtend24()

int32_t ts::SignExtend24 ( int32_t  x)
inline

Perform a sign extension on 24 bit integers.

Parameters
[in]xA 32-bit integer containing a signed 24-bit value to extend.
Returns
A 32-bit signed integer containing the signed 24-bit value with proper sign extension on 32-bits.

◆ SignExtend40()

int64_t ts::SignExtend40 ( int64_t  x)
inline

Perform a sign extension on 40 bit integers.

Parameters
[in]xA 64-bit integer containing a signed 40-bit value to extend.
Returns
A 64-bit signed integer containing the signed 40-bit value with proper sign extension on 64-bits.

◆ SignExtend48()

int64_t ts::SignExtend48 ( int64_t  x)
inline

Perform a sign extension on 48 bit integers.

Parameters
[in]xA 64-bit integer containing a signed 48-bit value to extend.
Returns
A 64-bit signed integer containing the signed 48-bit value with proper sign extension on 64-bits.

◆ ByteSwap16()

uint16_t ts::ByteSwap16 ( uint16_t  x)
inline

Inlined function performing byte swap on 16-bit integer data.

This function unconditionally swaps bytes within an unsigned integer, regardless of the native endianness.

Parameters
[in]xA 16-bit unsigned integer to swap.
Returns
The value of x where bytes were swapped.

◆ ByteSwap24()

uint32_t ts::ByteSwap24 ( uint32_t  x)
inline

Inlined function performing byte swap on 24-bit integer data.

This function unconditionally swaps bytes within an unsigned integer, regardless of the native endianness.

Parameters
[in]xA 32-bit unsigned integer containing a 24-bit value to swap.
Returns
The value of x where the three least significant bytes were swapped.

◆ ByteSwap32()

uint32_t ts::ByteSwap32 ( uint32_t  x)
inline

Inlined function performing byte swap on 32-bit integer data.

This function unconditionally swaps bytes within an unsigned integer, regardless of the native endianness.

Parameters
[in]xA 32-bit unsigned integer to swap.
Returns
The value of x where bytes were swapped.

◆ ByteSwap64()

uint64_t ts::ByteSwap64 ( uint64_t  x)
inline

Inlined function performing byte swap on 64-bit integer data.

This function unconditionally swaps bytes within an unsigned integer, regardless of the native endianness.

Parameters
[in]xA 64-bit unsigned integer to swap.
Returns
The value of x where bytes were swapped.

◆ CondByteSwap16BE()

uint16_t ts::CondByteSwap16BE ( uint16_t  x)
inline

Inlined function performing conditional byte swap on 16-bit integer data to obtain the data in big endian representation.

Parameters
[in]xA 16-bit unsigned integer to conditionally swap.
Returns
On little-endian platforms, return the value of x where bytes were swapped. On big-endian platforms, return the value of x unmodified.

◆ CondByteSwap16()

uint16_t ts::CondByteSwap16 ( uint16_t  x)
inline

Inlined function performing conditional byte swap on 16-bit integer data to obtain the data in big endian representation.

Parameters
[in]xA 16-bit unsigned integer to conditionally swap.
Returns
On little-endian platforms, return the value of x where bytes were swapped. On big-endian platforms, return the value of x unmodified.

◆ CondByteSwap24BE()

uint32_t ts::CondByteSwap24BE ( uint32_t  x)
inline

Inlined function performing conditional byte swap on 24-bit integer data to obtain the data in big endian representation.

Parameters
[in]xA 32-bit unsigned integer containing a 24-bit value to conditionally swap.
Returns
On little-endian platforms, return the value of x where the three least significant bytes were swapped. On big-endian platforms, return the value of x unmodified.

◆ CondByteSwap24()

uint32_t ts::CondByteSwap24 ( uint32_t  x)
inline

Inlined function performing conditional byte swap on 24-bit integer data to obtain the data in big endian representation.

Parameters
[in]xA 32-bit unsigned integer containing a 24-bit value to conditionally swap.
Returns
On little-endian platforms, return the value of x where the three least significant bytes were swapped. On big-endian platforms, return the value of x unmodified.

◆ CondByteSwap32BE()

uint32_t ts::CondByteSwap32BE ( uint32_t  x)
inline

Inlined function performing conditional byte swap on 32-bit integer data to obtain the data in big endian representation.

Parameters
[in]xA 32-bit unsigned integer to conditionally swap.
Returns
On little-endian platforms, return the value of x where bytes were swapped. On big-endian platforms, return the value of x unmodified.

◆ CondByteSwap32()

uint32_t ts::CondByteSwap32 ( uint32_t  x)
inline

Inlined function performing conditional byte swap on 32-bit integer data to obtain the data in big endian representation.

Parameters
[in]xA 32-bit unsigned integer to conditionally swap.
Returns
On little-endian platforms, return the value of x where bytes were swapped. On big-endian platforms, return the value of x unmodified.

◆ CondByteSwap64BE()

uint64_t ts::CondByteSwap64BE ( uint64_t  x)
inline

Inlined function performing conditional byte swap on 64-bit integer data to obtain the data in big endian representation.

Parameters
[in]xA 64-bit unsigned integer to conditionally swap.
Returns
On little-endian platforms, return the value of x where bytes were swapped. On big-endian platforms, return the value of x unmodified.

◆ CondByteSwap64()

uint64_t ts::CondByteSwap64 ( uint64_t  x)
inline

Inlined function performing conditional byte swap on 64-bit integer data to obtain the data in big endian representation.

Parameters
[in]xA 64-bit unsigned integer to conditionally swap.
Returns
On little-endian platforms, return the value of x where bytes were swapped. On big-endian platforms, return the value of x unmodified.

◆ CondByteSwap16LE()

uint16_t ts::CondByteSwap16LE ( uint16_t  x)
inline

Inlined function performing conditional byte swap on 16-bit integer data to obtain the data in little endian representation.

Parameters
[in]xA 16-bit unsigned integer to conditionally swap.
Returns
On big-endian platforms, return the value of x where bytes were swapped. On little-endian platforms, return the value of x unmodified.

◆ CondByteSwap24LE()

uint32_t ts::CondByteSwap24LE ( uint32_t  x)
inline

Inlined function performing conditional byte swap on 24-bit integer data to obtain the data in little endian representation.

Parameters
[in]xA 32-bit unsigned integer containing a 24-bit value to conditionally swap.
Returns
On big-endian platforms, return the value of x where the three least significant bytes were swapped. On little-endian platforms, return the value of x unmodified.

◆ CondByteSwap32LE()

uint32_t ts::CondByteSwap32LE ( uint32_t  x)
inline

Inlined function performing conditional byte swap on 32-bit integer data to obtain the data in little endian representation.

Parameters
[in]xA 32-bit unsigned integer to conditionally swap.
Returns
On big-endian platforms, return the value of x where bytes were swapped. On little-endian platforms, return the value of x unmodified.

◆ CondByteSwap64LE()

uint64_t ts::CondByteSwap64LE ( uint64_t  x)
inline

Inlined function performing conditional byte swap on 64-bit integer data to obtain the data in little endian representation.

Parameters
[in]xA 64-bit unsigned integer to conditionally swap.
Returns
On big-endian platforms, return the value of x where bytes were swapped. On little-endian platforms, return the value of x unmodified.

◆ CondByteSwapBE()

template<typename INT >
requires std::integral<INT>
INT ts::CondByteSwapBE ( INT  x)
inline

Template function performing conditional byte swap on integer data to obtain the data in big endian representation.

Template Parameters
INTSome integer type.
Parameters
[in]xAn INT to conditionally swap.
Returns
On little-endian platforms, return the value of x where bytes were swapped. On big-endian platforms, return the value of x unmodified.

◆ CondByteSwapLE()

template<typename INT >
requires std::integral<INT>
INT ts::CondByteSwapLE ( INT  x)
inline

Template function performing conditional byte swap on integer data to obtain the data in little endian representation.

Template Parameters
INTSome integer type.
Parameters
[in]xAn INT to conditionally swap.
Returns
On big-endian platforms, return the value of x where bytes were swapped. On little-endian platforms, return the value of x unmodified.

◆ CondByteSwap()

template<typename INT >
requires std::integral<INT>
INT ts::CondByteSwap ( INT  x)
inline

Template function performing conditional byte swap on integer data to obtain the data in big endian representation.

Template Parameters
INTSome integer type.
Parameters
[in]xAn INT to conditionally swap.
Returns
On little-endian platforms, return the value of x where bytes were swapped. On big-endian platforms, return the value of x unmodified.

◆ operator<<() [2/2]

std::ostream & operator<< ( std::ostream &  strm,
const ts::DisplayInterface obj 
)
inline

Display operator for displayable objects.

Parameters
[in,out]strmWhere to output the content.
[in]objThe object to display.
Returns
A reference to strm.

◆ equal_float()

template<typename T >
requires std::floating_point<T>
bool ts::equal_float ( a,
b,
epsilon = 2 * std::numeric_limits<T>::epsilon() 
)
inline

This template function compares two floating point values for approximated equality.

Template Parameters
TA floating point type.
Parameters
aFirst value to test.
bSecond value to test.
epsilonThe approximation tolerance.
Returns
True if a and b are approximately equal, false otherwise.

◆ match_ieee_float()

template<typename T , int storage_bits, int exponent_bits, int mantissa_bits>
requires std::floating_point<T>
constexpr bool ts::match_ieee_float ( )
inlineconstexpr

This template function checks if a floating point type matches a given IEEE represenation.

Template Parameters
TAn floating point type, any size or representation.
storage_bitsExpected size in bits of the type.
exponent_bitsExpected number of bits in the exponent.
mantissa_bitsExpected number of bits in the mantissa.
Returns
True if T matches the expected sizes, false otherwise.

◆ GetFloat32BE()

ieee_float32_t ts::GetFloat32BE ( const void *  p)
inline

Function getting a 32-bit IEEE float from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 32-bit IEEE float in big endian representation.
Returns
The 32-bit IEEE float in native byte order, deserialized from p.

◆ GetFloat32LE()

ieee_float32_t ts::GetFloat32LE ( const void *  p)
inline

Function getting a 32-bit IEEE float from serialized data in little endian representation.

Parameters
[in]pAn address pointing to a 32-bit IEEE float in little endian representation.
Returns
The 32-bit IEEE float in native byte order, deserialized from p.

◆ GetFloat32()

ieee_float32_t ts::GetFloat32 ( const void *  p)
inline

Function getting a 32-bit IEEE float from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 32-bit IEEE float in big endian representation.
Returns
The 32-bit IEEE float in native byte order, deserialized from p.

◆ GetFloat64BE()

ieee_float64_t ts::GetFloat64BE ( const void *  p)
inline

Function getting a 64-bit IEEE float from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 64-bit IEEE float in big endian representation.
Returns
The 64-bit IEEE float in native byte order, deserialized from p.

◆ GetFloat64LE()

ieee_float64_t ts::GetFloat64LE ( const void *  p)
inline

Function getting a 64-bit IEEE float from serialized data in little endian representation.

Parameters
[in]pAn address pointing to a 64-bit IEEE float in little endian representation.
Returns
The 64-bit IEEE float in native byte order, deserialized from p.

◆ GetFloat64()

ieee_float64_t ts::GetFloat64 ( const void *  p)
inline

Function getting a 64-bit IEEE float from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 64-bit IEEE float in big endian representation.
Returns
The 64-bit IEEE float in native byte order, deserialized from p.

◆ PutFloat32BE()

void ts::PutFloat32BE ( void *  p,
ieee_float32_t  f 
)
inline

Function serializing a 32-bit IEEE float data in big endian representation.

Parameters
[out]pAn address where to serialize the 32-bit IEEE float.
[in]fThe 32-bit IEEE float in native byte order to serialize in big endian representation.

◆ PutFloat32LE()

void ts::PutFloat32LE ( void *  p,
ieee_float32_t  f 
)
inline

Function serializing a 32-bit IEEE float data in little endian representation.

Parameters
[out]pAn address where to serialize the 32-bit IEEE float.
[in]fThe 32-bit IEEE float in native byte order to serialize in little endian representation.

◆ PutFloat32()

void ts::PutFloat32 ( void *  p,
ieee_float32_t  f 
)
inline

Function serializing a 32-bit IEEE float data in big endian representation.

Parameters
[out]pAn address where to serialize the 32-bit IEEE float.
[in]fThe 32-bit IEEE float in native byte order to serialize in big endian representation.

◆ PutFloat64BE()

void ts::PutFloat64BE ( void *  p,
ieee_float64_t  f 
)
inline

Function serializing a 64-bit IEEE float data in big endian representation.

Parameters
[out]pAn address where to serialize the 64-bit IEEE float.
[in]fThe 64-bit IEEE float in native byte order to serialize in big endian representation.

◆ PutFloat64LE()

void ts::PutFloat64LE ( void *  p,
ieee_float64_t  f 
)
inline

Function serializing a 64-bit IEEE float data in little endian representation.

Parameters
[out]pAn address where to serialize the 64-bit IEEE float.
[in]fThe 64-bit IEEE float in native byte order to serialize in little endian representation.

◆ PutFloat64()

void ts::PutFloat64 ( void *  p,
ieee_float64_t  f 
)
inline

Function serializing a 64-bit IEEE float data in big endian representation.

Parameters
[out]pAn address where to serialize the 64-bit IEEE float.
[in]fThe 64-bit IEEE float in native byte order to serialize in big endian representation.

◆ is_negative()

template<typename T >
requires int_enum<T>
constexpr bool ts::is_negative ( x)
inlineconstexpr

Statically check if a integral or enum value is negative.

Template Parameters
TAn integral or enumeration type.
Parameters
[in]xA value of type T.
Returns
True if the underlying integral type of T is signed and x is negative. False otherwise.

◆ abs()

template<typename INT >
requires std::integral<INT>
constexpr INT ts::abs ( INT  a)
inlineconstexpr

Absolute value of integer types, also working on unsigned types.

Template Parameters
INTAn integer type, any size, signed or unsigned.
Parameters
[in]aAn integer value.
Returns
Ansolute value of a.

◆ bound_check()

template<typename INT1 , typename INT2 >
requires std::integral<INT1> && std::integral<INT2>
constexpr bool ts::bound_check ( INT2  x)
inlineconstexpr

Integer cross-type bound check.

Template Parameters
INT1An integer type.
INT2An integer type.
Parameters
[in]xAn integer value of type INT2.
Returns
True if the value of x is within the limits of type INT1.

◆ bounded_cast()

template<typename INT1 , typename INT2 >
requires std::integral<INT1> && std::integral<INT2>
constexpr INT1 ts::bounded_cast ( INT2  x)
inlineconstexpr

Bounded integer cast.

Template Parameters
INT1An integer type.
INT2An integer type.
Parameters
[in]xAn integer value of type INT2.
Returns
The value of x, within the limits of type INT1.

◆ throw_bound_check()

template<typename INT1 , typename INT2 >
requires std::integral<INT1> && std::integral<INT2>
void ts::throw_bound_check ( INT2  x)

Throw an exception if an integer value does not fall into the range of another integer type.

Template Parameters
INT1An integer type.
INT2An integer type.
Parameters
[in]xAn integer value of type INT2.
Exceptions
std::out_of_rangeWhen the value of x is ouside the limits of type INT1.

◆ debug_throw_bound_check()

template<typename INT1 , typename INT2 >
requires std::integral<INT1> && std::integral<INT2>
void ts::debug_throw_bound_check ( INT2  x)
inline

In debug mode, throw an exception if an integer value does not fall into the range of another integer type.

If the macro DEBUG is not defined, this function does nothing.

Template Parameters
INT1An integer type.
INT2An integer type.
Parameters
[in]xAn integer value of type INT2.
Exceptions
std::out_of_rangeWhen the value of x is ouside the limits of type INT1.

◆ add_overflow() [1/2]

template<typename INT >
requires std::integral<INT>
constexpr bool ts::add_overflow ( INT  a,
INT  b,
INT  res 
)
inlineconstexpr

Check if an integer addition generates an overflow.

Template Parameters
INTAn integer type, any size, signed or unsigned.
Parameters
[in]aFirst integer.
[in]bSecond integer.
[in]resThe result of a + b.
Returns
True if a + b generated an overflow.

◆ add_overflow() [2/2]

template<typename INT >
requires std::integral<INT>
bool ts::add_overflow ( INT  a,
INT  b 
)

Check if an integer addition generates an overflow.

Template Parameters
INTAn integer type, any size, signed or unsigned.
Parameters
[in]aFirst integer.
[in]bSecond integer.
Returns
True if a + b generated an overflow.

◆ sub_overflow() [1/2]

template<typename INT >
requires std::integral<INT>
bool ts::sub_overflow ( INT  a,
INT  b,
INT  res 
)
inline

Check if an integer substraction generates an overflow.

Template Parameters
INTAn integer type, any size, signed or unsigned.
Parameters
[in]aFirst integer.
[in]bSecond integer.
[in]resThe result of a - b.
Returns
True if a - b generated an overflow.

◆ sub_overflow() [2/2]

template<typename INT >
requires std::integral<INT>
bool ts::sub_overflow ( INT  a,
INT  b 
)

Check if an integer substraction generates an overflow.

Template Parameters
INTAn integer type, any size, signed or unsigned.
Parameters
[in]aFirst integer.
[in]bSecond integer.
Returns
True if a - b generated an overflow.

◆ neg_overflow()

template<typename INT >
requires std::integral<INT>
bool ts::neg_overflow ( INT  a)
inline

Check if the negation (opposite sign) of an integer generates an overflow.

Template Parameters
INTAn integer type, any size, signed or unsigned.
Parameters
[in]aAn integer value.
Returns
True if -a generates an overflow.

◆ mul_overflow() [1/2]

template<typename INT >
requires std::integral<INT>
constexpr bool ts::mul_overflow ( INT  a,
INT  b,
INT  res 
)
inlineconstexpr

Check if an integer multiplication generates an overflow.

Template Parameters
INTAn integer type, any size, signed or unsigned.
Parameters
[in]aFirst integer.
[in]bSecond integer.
[in]resThe result of a * b.
Returns
True if a * b generated an overflow.

◆ mul_overflow() [2/2]

template<typename INT >
requires std::integral<INT>
bool ts::mul_overflow ( INT  a,
INT  b 
)

Check if an integer multiplication generates an overflow.

Template Parameters
INTAn integer type, any size, signed or unsigned.
Parameters
[in]aFirst integer.
[in]bSecond integer.
Returns
True if a * b generated an overflow.

◆ throw_add_overflow()

template<typename INT >
requires std::integral<INT>
void ts::throw_add_overflow ( INT  a,
INT  b,
INT  res 
)
inline

Throw an exception if an integer addition generates an overflow.

Template Parameters
INTAn integer type, any size, signed or unsigned.
Parameters
[in]aFirst integer.
[in]bSecond integer.
[in]resThe result of a + b.
Exceptions
std::overflow_errorWhen a + b generated an overflow.

◆ throw_sub_overflow()

template<typename INT >
requires std::integral<INT>
void ts::throw_sub_overflow ( INT  a,
INT  b,
INT  res 
)
inline

Throw an exception if an integer substraction generates an overflow.

Template Parameters
INTAn integer type, any size, signed or unsigned.
Parameters
[in]aFirst integer.
[in]bSecond integer.
[in]resThe result of a - b.
Exceptions
std::overflow_errorWhen a - b generated an overflow.

◆ thow_neg_overflow()

template<typename INT >
requires std::integral<INT>
void ts::thow_neg_overflow ( INT  a)
inline

Throw an exception if the negation (opposite sign) of an integer generates an overflow.

Template Parameters
INTAn integer type, any size, signed or unsigned.
Parameters
[in]aAn integer value.
Exceptions
std::overflow_errorWhen -a generates an overflow.

◆ throw_mul_overflow()

template<typename INT >
requires std::integral<INT>
void ts::throw_mul_overflow ( INT  a,
INT  b,
INT  res 
)
inline

Throw an exception if an integer multiplication generates an overflow.

Template Parameters
INTAn integer type, any size, signed or unsigned.
Parameters
[in]aFirst integer.
[in]bSecond integer.
[in]resThe result of a * b.
Exceptions
std::overflow_errorWhen a * b generated an overflow.

◆ throw_div_zero()

template<typename INT >
requires std::integral<INT>
void ts::throw_div_zero ( INT  den)
inline

Throw an exception if the denominator of an integer division is zero.

Template Parameters
INTAn integer type, any size, signed or unsigned.
Parameters
[in]denThe denominator of an integer division.
Exceptions
std::underflow_errorWhen den is zero.

◆ debug_throw_add_overflow()

template<typename INT >
requires std::integral<INT>
void ts::debug_throw_add_overflow ( INT  a,
INT  b,
INT  res 
)
inline

In debug mode, throw an exception if an integer addition generates an overflow.

If the macro DEBUG is not defined, this function does nothing.

Template Parameters
INTAn integer type, any size, signed or unsigned.
Parameters
[in]aFirst integer.
[in]bSecond integer.
[in]resThe result of a + b.
Exceptions
std::overflow_errorWhen a + b generated an overflow.

◆ debug_throw_sub_overflow()

template<typename INT >
requires std::integral<INT>
void ts::debug_throw_sub_overflow ( INT  a,
INT  b,
INT  res 
)
inline

In debug mode, throw an exception if an integer substraction generates an overflow.

If the macro DEBUG is not defined, this function does nothing.

Template Parameters
INTAn integer type, any size, signed or unsigned.
Parameters
[in]aFirst integer.
[in]bSecond integer.
[in]resThe result of a - b.
Exceptions
std::overflow_errorWhen a - b generated an overflow.

◆ debug_thow_neg_overflow()

template<typename INT >
requires std::integral<INT>
void ts::debug_thow_neg_overflow ( INT  a)
inline

In debug mode, throw an exception if the negation (opposite sign) of an integer generates an overflow.

If the macro DEBUG is not defined, this function does nothing.

Template Parameters
INTAn integer type, any size, signed or unsigned.
Parameters
[in]aAn integer value.
Exceptions
std::overflow_errorWhen -a generates an overflow.

◆ debug_throw_mul_overflow()

template<typename INT >
requires std::integral<INT>
void ts::debug_throw_mul_overflow ( INT  a,
INT  b,
INT  res 
)
inline

In debug mode, throw an exception if an integer multiplication generates an overflow.

If the macro DEBUG is not defined, this function does nothing.

Template Parameters
INTAn integer type, any size, signed or unsigned.
Parameters
[in]aFirst integer.
[in]bSecond integer.
[in]resThe result of a * b.
Exceptions
std::overflow_errorWhen a * b generated an overflow.

◆ debug_throw_div_zero()

template<typename INT >
requires std::integral<INT>
void ts::debug_throw_div_zero ( INT  den)
inline

In debug mode, throw an exception if the denominator of an integer division is zero.

If the macro DEBUG is not defined, this function does nothing.

Template Parameters
INTAn integer type, any size, signed or unsigned.
Parameters
[in]denThe denominator of an integer division.
Exceptions
std::underflow_errorWhen den is zero.

◆ rounded_div()

template<typename INT >
requires std::integral<INT>
constexpr INT ts::rounded_div ( INT  a,
INT  b 
)
inlineconstexpr

Integer division with rounding to closest value (instead of truncating).

Template Parameters
INTAn integer type, any size, signed or unsigned.
Parameters
[in]aAn integer.
[in]bAn integer.
Returns
The value of a / b, rounded to closest value.

◆ bounded_add()

template<typename INT >
requires std::integral<INT>
INT ts::bounded_add ( INT  a,
INT  b 
)

Perform a bounded addition without overflow.

Template Parameters
INTAn integer type, any size, signed or unsigned.
Parameters
[in]aFirst integer.
[in]bSecond integer.
Returns
The value a + b. The value is bounded, in case of underflow or overflow, the result is the min or max value of the type, respectively.

◆ bounded_sub()

template<typename INT >
requires std::integral<INT>
INT ts::bounded_sub ( INT  a,
INT  b 
)

Perform a bounded subtraction without overflow.

Template Parameters
INTAn integer type, any size, signed or unsigned.
Parameters
[in]aFirst integer.
[in]bSecond integer.
Returns
The value a - b. The value is bounded, in case of underflow or overflow, the result is the min or max value of the type, respectively.

◆ round_down()

template<typename INT >
requires std::integral<INT>
INT ts::round_down ( INT  x,
INT  f 
)

Round x down to previous multiple of a factor f.

Template Parameters
INTAn integer type.
Parameters
[in]xAn integer value.
[in]fA factor (its absolute value is used if negative).
Returns
The value x rounded down to previous multiple of f.

◆ round_up()

template<typename INT >
requires std::integral<INT>
INT ts::round_up ( INT  x,
INT  f 
)

Round x up to next multiple of a factor f.

Template Parameters
INTAn integer type.
Parameters
[in]xAn integer value.
[in]fA factor (its absolute value is used if negative).
Returns
The value x rounded up to next multiple of f.

◆ sign_reduce()

template<typename INT >
requires std::integral<INT>
constexpr void ts::sign_reduce ( INT num,
INT den 
)
inlineconstexpr

Reduce the sign of an integer fraction.

Make sure that only the numerator carries the sign. The denominator must remain positive.

Template Parameters
INTAn integer type.
Parameters
[in,out]numFraction numerator.
[in,out]denFraction denominator.

◆ SignExtend()

template<typename INT >
requires std::signed_integral<INT>
INT ts::SignExtend ( INT  x,
size_t  bits 
)

Perform a sign extension on any subset of a signed integer.

Template Parameters
INTA signed integer type.
Parameters
[in]xAn integer containing a signed value in some number of LSB.
[in]bitsNumber of least significant bits containing a signed value.
Returns
A signed integer containing the same signed value with proper sign extension on the full size of INT.

◆ MaxDecimalWidth()

size_t ts::MaxDecimalWidth ( size_t  typeSize,
size_t  digitSeparatorSize = 0 
)

Compute the maximum width of the decimal representation of an integer type.

Parameters
[in]typeSizeSize of the integer type in bytes (result of sizeof).
[in]digitSeparatorSizeSize in characters of the digit-grouping separator.
Returns
The maximum width in characters.

◆ MaxHexaWidth()

size_t ts::MaxHexaWidth ( size_t  typeSize,
size_t  digitSeparatorSize = 0 
)

Compute the maximum width of the hexadecimal representation of an integer type.

Parameters
[in]typeSizeSize of the integer type in bytes (result of sizeof).
[in]digitSeparatorSizeSize in characters of the digit-grouping separator.
Returns
The maximum width in characters.

◆ BitSize()

template<typename INT >
requires std::integral<INT>
size_t ts::BitSize ( INT  x)

Get the size in bits of an integer value.

This is the minimum number of bits to represent the value up to its most-significant '1' bit.

Template Parameters
INTAn integer type.
Parameters
[in]xAn integer containing a signed value in some number of LSB.
Returns
The minimum number of bits to represent the value up to its most-significant '1' bit. This is never zero, at least one bit is needed to represent the value zero.

◆ LSBMask()

template<typename INT >
requires std::integral<INT>
INT ts::LSBMask ( size_t  bits)

Get the mask to select a given number of least significant bits in an integer value.

Template Parameters
INTAn integer type.
Parameters
[in]bitsNumber of least significant bits to select. Zero means all bits.
Returns
The corresponding mask.

◆ SignedDescription()

template<typename INT >
requires std::integral<INT>
constexpr const UChar * ts::SignedDescription ( )
inlineconstexpr

Get the signed/unsigned qualifier of an integer type as a string.

Template Parameters
INTAn integer type.
Returns
Either u"signed" or u"unsigned".

◆ GCD()

template<typename INT >
requires std::integral<INT>
INT ts::GCD ( INT  x,
INT  y 
)

Compute a greatest common denominator (GCD).

Template Parameters
INTAn integer type.
Parameters
[in]xAn integer.
[in]yAn integer.
Returns
The greatest common denominator (GCD) of x and y. Always positive.

◆ Power10()

uint64_t ts::Power10 ( size_t  pow)

Get a power of 10 using a fast lookup table.

Parameters
[in]powThe requested power of 10.
Returns
The requested power of 10. If the value is larger than the largest integer on this platform, the result is undefined.

◆ MemZero()

void ts::MemZero ( void *  addr,
size_t  size 
)
inline

Zeroing a memory area.

Parameters
[out]addrAddress of a memory area to fill with zeroes.
[in]sizeSize in bytes of the memory area.

◆ MemSet()

void ts::MemSet ( void *  addr,
uint8_t  value,
size_t  size 
)
inline

Setting a memory area.

Similar to std::memset() but explicitly does nothing on zero size.

Parameters
[out]addrAddress of a memory area to fill with value.
[in]valueByte value to set in all area.
[in]sizeSize in bytes of the memory area.

◆ MemCopy()

void ts::MemCopy ( void *  dest,
const void *  src,
size_t  size 
)
inline

Copying a memory area.

Similar to std::memcpy() and std::memmove() but explicitly does nothing on zero size. Overlapping source and destination are allowed, as with std::memmove().

Parameters
[out]destBase address of destination area.
[in]srcBase address of source area.
[in]sizeSize in bytes of the memory area.

◆ MemCompare()

int ts::MemCompare ( const void *  addr1,
const void *  addr2,
size_t  size 
)
inline

Comparing two memory areas.

Similar to std::memcmp() but explicitly does nothing on zero size.

Parameters
[in]addr1Base address of first area.
[in]addr2Base address of second area.
[in]sizeSize in bytes of the memory area.
Returns
Same as std::memcmp(). Zero when the twa areas are equal or size is zero.

◆ MemEqual()

bool ts::MemEqual ( const void *  addr1,
const void *  addr2,
size_t  size 
)
inline

Check if two memory areas are identical.

Parameters
[in]addr1Base address of first area.
[in]addr2Base address of second area.
[in]sizeSize in bytes of the memory area.
Returns
True if the twa areas are equal or size is zero, false otherwise.

◆ MemXor()

void ts::MemXor ( void *  dest,
const void *  src1,
const void *  src2,
size_t  size 
)

Compute an exclusive or over memory areas.

The input and output areas can overlap only if they start at the same address.

Parameters
[out]destDestination start address.
[in]src1Start address of the first area.
[in]src2Start address of the second area.
[in]sizeSize in bytes of the memory areas.

◆ StartsWith()

bool ts::StartsWith ( const void *  area,
size_t  area_size,
const void *  prefix,
size_t  prefix_size 
)

Check if a memory area starts with the specified prefix.

Parameters
[in]areaAddress of a memory area to check.
[in]area_sizeSize in bytes of the memory area.
[in]prefixAddress of the content of the prefix to check.
[in]prefix_sizeSize in bytes of the prefix.
Returns
True if area starts with prefix.

◆ LocatePattern()

const uint8_t * ts::LocatePattern ( const void *  area,
size_t  area_size,
const void *  pattern,
size_t  pattern_size 
)

Locate a pattern into a memory area.

Parameters
[in]areaAddress of a memory area to check.
[in]area_sizeSize in bytes of the memory area.
[in]patternAddress of the content of the pattern to check.
[in]pattern_sizeSize in bytes of the pattern.
Returns
Address of the first occurence of pattern in area or the null pointer if not found.

◆ LocateZeroZero()

const uint8_t * ts::LocateZeroZero ( const void *  area,
size_t  area_size,
uint8_t  third 
)

Locate a 3-byte pattern 00 00 XY into a memory area.

This is a specialized version of LocatePattern().

Parameters
[in]areaAddress of a memory area to check.
[in]area_sizeSize in bytes of the memory area.
[in]thirdThird byte of the pattern, after 00 00.
Returns
Address of the first occurence of the 3-byte pattern in area or the null pointer if not found.

◆ IdenticalBytes()

bool ts::IdenticalBytes ( const void *  area,
size_t  area_size 
)

Check if a memory area contains all identical byte values.

Parameters
[in]areaAddress of a memory area to check.
[in]area_sizeSize in bytes of the memory area.
Returns
True if area_size is greater than 1 and all bytes in area are identical.

◆ GetUInt16BE() [1/2]

uint16_t ts::GetUInt16BE ( const void *  p)
inline

Function getting a 16-bit unsigned integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 16-bit unsigned integer in big endian representation.
Returns
The 16-bit unsigned integer in native byte order, deserialized from p.

◆ GetUInt32BE() [1/2]

uint32_t ts::GetUInt32BE ( const void *  p)
inline

Function getting a 32-bit unsigned integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 32-bit unsigned integer in big endian representation.
Returns
The 32-bit unsigned integer in native byte order, deserialized from p.

◆ GetUInt24BE() [1/2]

uint32_t ts::GetUInt24BE ( const void *  p)

Function getting a 24-bit unsigned integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 24-bit unsigned integer in big endian representation.
Returns
The 24-bit unsigned integer in native byte order, deserialized from p.

◆ GetUInt64BE() [1/2]

uint64_t ts::GetUInt64BE ( const void *  p)
inline

Function getting a 64-bit unsigned integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 64-bit unsigned integer in big endian representation.
Returns
The 64-bit unsigned integer in native byte order, deserialized from p.

◆ GetUInt40BE()

uint64_t ts::GetUInt40BE ( const void *  p)

Function getting a 40-bit unsigned integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 40-bit unsigned integer in big endian representation.
Returns
The 40-bit unsigned integer in native byte order, deserialized from p.

◆ GetUInt48BE()

uint64_t ts::GetUInt48BE ( const void *  p)

Function getting a 48-bit unsigned integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 48-bit unsigned integer in big endian representation.
Returns
The 48-bit unsigned integer in native byte order, deserialized from p.

◆ GetUInt16LE() [1/2]

uint16_t ts::GetUInt16LE ( const void *  p)
inline

Function getting a 16-bit unsigned integer from serialized data in little endian representation.

Parameters
[in]pAn address pointing to a 16-bit unsigned integer in little endian representation.
Returns
The 16-bit unsigned integer in native byte order, deserialized from p.

◆ GetUInt32LE() [1/2]

uint32_t ts::GetUInt32LE ( const void *  p)
inline

Function getting a 32-bit unsigned integer from serialized data in little endian representation.

Parameters
[in]pAn address pointing to a 32-bit unsigned integer in little endian representation.
Returns
The 32-bit unsigned integer in native byte order, deserialized from p.

◆ GetUInt24LE() [1/2]

uint32_t ts::GetUInt24LE ( const void *  p)

Function getting a 24-bit unsigned integer from serialized data in little endian representation.

Parameters
[in]pAn address pointing to a 24-bit unsigned integer in little endian representation.
Returns
The 24-bit unsigned integer in native byte order, deserialized from p.

◆ GetUInt64LE() [1/2]

uint64_t ts::GetUInt64LE ( const void *  p)
inline

Function getting a 64-bit unsigned integer from serialized data in little endian representation.

Parameters
[in]pAn address pointing to a 64-bit unsigned integer in little endian representation.
Returns
The 64-bit unsigned integer in native byte order, deserialized from p.

◆ GetUInt40LE()

uint64_t ts::GetUInt40LE ( const void *  p)

Function getting a 40-bit unsigned integer from serialized data in little endian representation.

Parameters
[in]pAn address pointing to a 40-bit unsigned integer in little endian representation.
Returns
The 40-bit unsigned integer in native byte order, deserialized from p.

◆ GetUInt48LE()

uint64_t ts::GetUInt48LE ( const void *  p)

Function getting a 48-bit unsigned integer from serialized data in little endian representation.

Parameters
[in]pAn address pointing to a 48-bit unsigned integer in little endian representation.
Returns
The 48-bit unsigned integer in native byte order, deserialized from p.

◆ PutUInt16BE()

void ts::PutUInt16BE ( void *  p,
uint16_t  i 
)
inline

Function serializing a 16-bit unsigned integer data in big endian representation.

Parameters
[out]pAn address where to serialize the 16-bit unsigned integer.
[in]iThe 16-bit unsigned integer in native byte order to serialize in big endian representation.

◆ PutUInt32BE()

void ts::PutUInt32BE ( void *  p,
uint32_t  i 
)
inline

Function serializing a 32-bit unsigned integer data in big endian representation.

Parameters
[out]pAn address where to serialize the 32-bit unsigned integer.
[in]iThe 32-bit unsigned integer in native byte order to serialize in big endian representation.

◆ PutUInt64BE()

void ts::PutUInt64BE ( void *  p,
uint64_t  i 
)
inline

Function serializing a 64-bit unsigned integer data in big endian representation.

Parameters
[out]pAn address where to serialize the 64-bit unsigned integer.
[in]iThe 64-bit unsigned integer in native byte order to serialize in big endian representation.

◆ PutUInt16LE()

void ts::PutUInt16LE ( void *  p,
uint16_t  i 
)
inline

Function serializing a 16-bit unsigned integer data in little endian representation.

Parameters
[out]pAn address where to serialize the 16-bit unsigned integer.
[in]iThe 16-bit unsigned integer in native byte order to serialize in little endian representation.

◆ PutUInt32LE()

void ts::PutUInt32LE ( void *  p,
uint32_t  i 
)
inline

Function serializing a 32-bit unsigned integer data in little endian representation.

Parameters
[out]pAn address where to serialize the 32-bit unsigned integer.
[in]iThe 32-bit unsigned integer in native byte order to serialize in little endian representation.

◆ PutUInt64LE()

void ts::PutUInt64LE ( void *  p,
uint64_t  i 
)
inline

Function serializing a 64-bit unsigned integer data in little endian representation.

Parameters
[out]pAn address where to serialize the 64-bit unsigned integer.
[in]iThe 64-bit unsigned integer in native byte order to serialize in little endian representation.

◆ PutUInt24BE()

void ts::PutUInt24BE ( void *  p,
uint32_t  i 
)

Function serializing a 24-bit unsigned integer data in big endian representation.

Parameters
[out]pAn address where to serialize the 24-bit unsigned integer.
[in]iThe 24-bit unsigned integer in native byte order to serialize in big endian representation.

◆ PutUInt24LE()

void ts::PutUInt24LE ( void *  p,
uint32_t  i 
)

Function serializing a 24-bit unsigned integer data in little endian representation.

Parameters
[out]pAn address where to serialize the 24-bit unsigned integer.
[in]iThe 24-bit unsigned integer in native byte order to serialize in little endian representation.

◆ PutUInt40BE()

void ts::PutUInt40BE ( void *  p,
uint64_t  i 
)

Function serializing a 40-bit unsigned integer data in big endian representation.

Parameters
[out]pAn address where to serialize the 40-bit unsigned integer.
[in]iThe 40-bit unsigned integer in native byte order to serialize in big endian representation.

◆ PutUInt40LE()

void ts::PutUInt40LE ( void *  p,
uint64_t  i 
)

Function serializing a 40-bit unsigned integer data in little endian representation.

Parameters
[out]pAn address where to serialize the 40-bit unsigned integer.
[in]iThe 40-bit unsigned integer in native byte order to serialize in little endian representation.

◆ PutUInt48BE()

void ts::PutUInt48BE ( void *  p,
uint64_t  i 
)

Function serializing a 48-bit unsigned integer data in big endian representation.

Parameters
[out]pAn address where to serialize the 48-bit unsigned integer.
[in]iThe 48-bit unsigned integer in native byte order to serialize in big endian representation.

◆ PutUInt48LE()

void ts::PutUInt48LE ( void *  p,
uint64_t  i 
)

Function serializing a 48-bit unsigned integer data in little endian representation.

Parameters
[out]pAn address where to serialize the 48-bit unsigned integer.
[in]iThe 48-bit unsigned integer in native byte order to serialize in little endian representation.

◆ GetUInt8() [1/2]

uint8_t ts::GetUInt8 ( const void *  p)
inline

Function getting an 8-bit unsigned integer from serialized data.

Note: There is no byte-swapping in the serialization / deserialization of 8-bit integer data. But this function is provided for consistency.

Parameters
[in]pAn address pointing to an 8-bit unsigned integer.
Returns
The 8-bit unsigned integer at p.

◆ GetUInt16() [1/2]

uint16_t ts::GetUInt16 ( const void *  p)
inline

Function getting a 16-bit unsigned integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 16-bit unsigned integer in big endian representation.
Returns
The 16-bit unsigned integer in native byte order, deserialized from p.

◆ GetUInt24() [1/2]

uint32_t ts::GetUInt24 ( const void *  p)
inline

Function getting a 24-bit unsigned integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 24-bit unsigned integer in big endian representation.
Returns
The 24-bit unsigned integer in native byte order, deserialized from p.

◆ GetUInt32() [1/2]

uint32_t ts::GetUInt32 ( const void *  p)
inline

Function getting a 32-bit unsigned integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 32-bit unsigned integer in big endian representation.
Returns
The 32-bit unsigned integer in native byte order, deserialized from p.

◆ GetUInt40() [1/2]

uint64_t ts::GetUInt40 ( const void *  p)
inline

Function getting a 40-bit unsigned integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 40-bit unsigned integer in big endian representation.
Returns
The 40-bit unsigned integer in native byte order, deserialized from p.

◆ GetUInt48() [1/2]

uint64_t ts::GetUInt48 ( const void *  p)
inline

Function getting a 48-bit unsigned integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 48-bit unsigned integer in big endian representation.
Returns
The 48-bit unsigned integer in native byte order, deserialized from p.

◆ GetUInt64() [1/2]

uint64_t ts::GetUInt64 ( const void *  p)
inline

Function getting a 64-bit unsigned integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 64-bit unsigned integer in big endian representation.
Returns
The 64-bit unsigned integer in native byte order, deserialized from p.

◆ GetInt8() [1/2]

int8_t ts::GetInt8 ( const void *  p)
inline

Function getting an 8-bit signed integer from serialized data.

Note: There is no byte-swapping in the serialization / deserialization of 8-bit integer data. But this function is provided for consistency.

Parameters
[in]pAn address pointing to an 8-bit signed integer.
Returns
The 8-bit signed integer at p.

◆ GetInt16() [1/2]

int16_t ts::GetInt16 ( const void *  p)
inline

Function getting a 16-bit signed integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 16-bit signed integer in big endian representation.
Returns
The 16-bit signed integer in native byte order, deserialized from p.

◆ GetInt24() [1/2]

int32_t ts::GetInt24 ( const void *  p)
inline

Function getting a 24-bit signed integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 24-bit signed integer in big endian representation.
Returns
The 24-bit signed integer in native byte order, deserialized from p.

◆ GetInt32() [1/2]

int32_t ts::GetInt32 ( const void *  p)
inline

Function getting a 32-bit signed integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 32-bit signed integer in big endian representation.
Returns
The 32-bit signed integer in native byte order, deserialized from p.

◆ GetInt64() [1/2]

int64_t ts::GetInt64 ( const void *  p)
inline

Function getting a 64-bit signed integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 64-bit signed integer in big endian representation.
Returns
The 64-bit signed integer in native byte order, deserialized from p.

◆ GetInt16BE() [1/2]

int16_t ts::GetInt16BE ( const void *  p)
inline

Function getting a 16-bit signed integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 16-bit signed integer in big endian representation.
Returns
The 16-bit signed integer in native byte order, deserialized from p.

◆ GetInt24BE() [1/2]

int32_t ts::GetInt24BE ( const void *  p)
inline

Function getting a 24-bit signed integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 24-bit signed integer in big endian representation.
Returns
The 24-bit signed integer in native byte order, deserialized from p.

◆ GetInt32BE() [1/2]

int32_t ts::GetInt32BE ( const void *  p)
inline

Function getting a 32-bit signed integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 32-bit signed integer in big endian representation.
Returns
The 32-bit signed integer in native byte order, deserialized from p.

◆ GetInt40BE()

int64_t ts::GetInt40BE ( const void *  p)
inline

Function getting a 40-bit signed integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 40-bit signed integer in big endian representation.
Returns
The 64-bit signed integer in native byte order, deserialized from p.

◆ GetInt48BE()

int64_t ts::GetInt48BE ( const void *  p)
inline

Function getting a 48-bit signed integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 48-bit signed integer in big endian representation.
Returns
The 64-bit signed integer in native byte order, deserialized from p.

◆ GetInt64BE() [1/2]

int64_t ts::GetInt64BE ( const void *  p)
inline

Function getting a 64-bit signed integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 64-bit signed integer in big endian representation.
Returns
The 64-bit signed integer in native byte order, deserialized from p.

◆ GetInt16LE() [1/2]

int16_t ts::GetInt16LE ( const void *  p)
inline

Function getting a 16-bit signed integer from serialized data in little endian representation.

Parameters
[in]pAn address pointing to a 16-bit signed integer in little endian representation.
Returns
The 16-bit signed integer in native byte order, deserialized from p.

◆ GetInt24LE() [1/2]

int32_t ts::GetInt24LE ( const void *  p)
inline

Function getting a 24-bit signed integer from serialized data in little endian representation.

Parameters
[in]pAn address pointing to a 24-bit signed integer in little endian representation.
Returns
The 32-bit signed integer in native byte order, deserialized from p.

◆ GetInt32LE() [1/2]

int32_t ts::GetInt32LE ( const void *  p)
inline

Function getting a 32-bit signed integer from serialized data in little endian representation.

Parameters
[in]pAn address pointing to a 32-bit signed integer in little endian representation.
Returns
The 32-bit signed integer in native byte order, deserialized from p.

◆ GetInt40LE()

int64_t ts::GetInt40LE ( const void *  p)
inline

Function getting a 40-bit signed integer from serialized data in little endian representation.

Parameters
[in]pAn address pointing to a 40-bit signed integer in little endian representation.
Returns
The 64-bit signed integer in native byte order, deserialized from p.

◆ GetInt48LE()

int64_t ts::GetInt48LE ( const void *  p)
inline

Function getting a 48-bit signed integer from serialized data in little endian representation.

Parameters
[in]pAn address pointing to a 48-bit signed integer in little endian representation.
Returns
The 64-bit signed integer in native byte order, deserialized from p.

◆ GetInt64LE() [1/2]

int64_t ts::GetInt64LE ( const void *  p)
inline

Function getting a 64-bit signed integer from serialized data in little endian representation.

Parameters
[in]pAn address pointing to a 64-bit signed integer in little endian representation.
Returns
The 64-bit signed integer in native byte order, deserialized from p.

◆ GetUInt8() [2/2]

void ts::GetUInt8 ( const void *  p,
uint8_t &  i 
)
inline

Function getting an 8-bit unsigned integer from serialized data.

Note: There is no byte-swapping in the serialization / deserialization of 8-bit integer data. But this function is provided for consistency.

Parameters
[in]pAn address pointing to an 8-bit unsigned integer.
[out]iThe 8-bit unsigned integer at p.

◆ GetUInt16() [2/2]

void ts::GetUInt16 ( const void *  p,
uint16_t &  i 
)
inline

Function getting a 16-bit unsigned integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 16-bit unsigned integer in big endian representation.
[out]iThe 16-bit unsigned integer in native byte order, deserialized from p.

◆ GetUInt24() [2/2]

void ts::GetUInt24 ( const void *  p,
uint32_t &  i 
)
inline

Function getting a 24-bit unsigned integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 24-bit unsigned integer in big endian representation.
[out]iThe 32-bit unsigned integer in native byte order, deserialized from p.

◆ GetUInt32() [2/2]

void ts::GetUInt32 ( const void *  p,
uint32_t &  i 
)
inline

Function getting a 32-bit unsigned integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 32-bit unsigned integer in big endian representation.
[out]iThe 32-bit unsigned integer in native byte order, deserialized from p.

◆ GetUInt40() [2/2]

void ts::GetUInt40 ( const void *  p,
uint64_t &  i 
)
inline

Function getting a 40-bit unsigned integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 40-bit unsigned integer in big endian representation.
[out]iThe 64-bit unsigned integer in native byte order, deserialized from p.

◆ GetUInt48() [2/2]

void ts::GetUInt48 ( const void *  p,
uint64_t &  i 
)
inline

Function getting a 48-bit unsigned integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 48-bit unsigned integer in big endian representation.
[out]iThe 64-bit unsigned integer in native byte order, deserialized from p.

◆ GetUInt64() [2/2]

void ts::GetUInt64 ( const void *  p,
uint64_t &  i 
)
inline

Function getting a 64-bit unsigned integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 64-bit unsigned integer in big endian representation.
[out]iThe 64-bit unsigned integer in native byte order, deserialized from p.

◆ GetUInt16BE() [2/2]

void ts::GetUInt16BE ( const void *  p,
uint16_t &  i 
)
inline

Function getting a 16-bit unsigned integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 16-bit unsigned integer in big endian representation.
[out]iThe 16-bit unsigned integer in native byte order, deserialized from p.

◆ GetUInt24BE() [2/2]

void ts::GetUInt24BE ( const void *  p,
uint32_t &  i 
)
inline

Function getting a 24-bit unsigned integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 24-bit unsigned integer in big endian representation.
[out]iThe 32-bit unsigned integer in native byte order, deserialized from p.

◆ GetUInt32BE() [2/2]

void ts::GetUInt32BE ( const void *  p,
uint32_t &  i 
)
inline

Function getting a 32-bit unsigned integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 32-bit unsigned integer in big endian representation.
[out]iThe 32-bit unsigned integer in native byte order, deserialized from p.

◆ GetUInt64BE() [2/2]

void ts::GetUInt64BE ( const void *  p,
uint64_t &  i 
)
inline

Function getting a 64-bit unsigned integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 64-bit unsigned integer in big endian representation.
[out]iThe 64-bit unsigned integer in native byte order, deserialized from p.

◆ GetUInt16LE() [2/2]

void ts::GetUInt16LE ( const void *  p,
uint16_t &  i 
)
inline

Function getting a 16-bit unsigned integer from serialized data in little endian representation.

Parameters
[in]pAn address pointing to a 16-bit unsigned integer in little endian representation.
[out]iThe 16-bit unsigned integer in native byte order, deserialized from p.

◆ GetUInt24LE() [2/2]

void ts::GetUInt24LE ( const void *  p,
uint32_t &  i 
)
inline

Function getting a 24-bit unsigned integer from serialized data in little endian representation.

Parameters
[in]pAn address pointing to a 24-bit unsigned integer in little endian representation.
[out]iThe 24-bit unsigned integer in native byte order, deserialized from p.

◆ GetUInt32LE() [2/2]

void ts::GetUInt32LE ( const void *  p,
uint32_t &  i 
)
inline

Function getting a 32-bit unsigned integer from serialized data in little endian representation.

Parameters
[in]pAn address pointing to a 32-bit unsigned integer in little endian representation.
[out]iThe 32-bit unsigned integer in native byte order, deserialized from p.

◆ GetUInt64LE() [2/2]

void ts::GetUInt64LE ( const void *  p,
uint64_t &  i 
)
inline

Function getting a 64-bit unsigned integer from serialized data in little endian representation.

Parameters
[in]pAn address pointing to a 64-bit unsigned integer in little endian representation.
[out]iThe 64-bit unsigned integer in native byte order, deserialized from p.

◆ GetInt8() [2/2]

void ts::GetInt8 ( const void *  p,
int8_t &  i 
)
inline

Function getting an 8-bit signed integer from serialized data.

Note: There is no byte-swapping in the serialization / deserialization of 8-bit integer data. But this function is provided for consistency.

Parameters
[in]pAn address pointing to an 8-bit signed integer.
[out]iThe 8-bit signed integer at p.

◆ GetInt16() [2/2]

void ts::GetInt16 ( const void *  p,
int16_t &  i 
)
inline

Function getting a 16-bit signed integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 16-bit signed integer in big endian representation.
[out]iThe 16-bit signed integer in native byte order, deserialized from p.

◆ GetInt24() [2/2]

void ts::GetInt24 ( const void *  p,
int32_t &  i 
)
inline

Function getting a 24-bit signed integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 24-bit signed integer in big endian representation.
[out]iThe 24-bit signed integer in native byte order, deserialized from p.

◆ GetInt32() [2/2]

void ts::GetInt32 ( const void *  p,
int32_t &  i 
)
inline

Function getting a 32-bit signed integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 32-bit signed integer in big endian representation.
[out]iThe 32-bit signed integer in native byte order, deserialized from p.

◆ GetInt64() [2/2]

void ts::GetInt64 ( const void *  p,
int64_t &  i 
)
inline

Function getting a 64-bit signed integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 64-bit signed integer in big endian representation.
[out]iThe 64-bit signed integer in native byte order, deserialized from p.

◆ GetInt16BE() [2/2]

void ts::GetInt16BE ( const void *  p,
int16_t &  i 
)
inline

Function getting a 16-bit signed integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 16-bit signed integer in big endian representation.
[out]iThe 16-bit signed integer in native byte order, deserialized from p.

◆ GetInt24BE() [2/2]

void ts::GetInt24BE ( const void *  p,
int32_t &  i 
)
inline

Function getting a 24-bit signed integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 24-bit signed integer in big endian representation.
[out]iThe 24-bit signed integer in native byte order, deserialized from p.

◆ GetInt32BE() [2/2]

void ts::GetInt32BE ( const void *  p,
int32_t &  i 
)
inline

Function getting a 32-bit signed integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 32-bit signed integer in big endian representation.
[out]iThe 32-bit signed integer in native byte order, deserialized from p.

◆ GetInt64BE() [2/2]

void ts::GetInt64BE ( const void *  p,
int64_t &  i 
)
inline

Function getting a 64-bit signed integer from serialized data in big endian representation.

Parameters
[in]pAn address pointing to a 64-bit signed integer in big endian representation.
[out]iThe 64-bit signed integer in native byte order, deserialized from p.

◆ GetInt16LE() [2/2]

void ts::GetInt16LE ( const void *  p,
int16_t &  i 
)
inline

Function getting a 16-bit signed integer from serialized data in little endian representation.

Parameters
[in]pAn address pointing to a 16-bit signed integer in little endian representation.
[out]iThe 16-bit signed integer in native byte order, deserialized from p.

◆ GetInt24LE() [2/2]

void ts::GetInt24LE ( const void *  p,
int32_t &  i 
)
inline

Function getting a 24-bit signed integer from serialized data in little endian representation.

Parameters
[in]pAn address pointing to a 24-bit signed integer in little endian representation.
[out]iThe 32-bit signed integer in native byte order, deserialized from p.

◆ GetInt32LE() [2/2]

void ts::GetInt32LE ( const void *  p,
int32_t &  i 
)
inline

Function getting a 32-bit signed integer from serialized data in little endian representation.

Parameters
[in]pAn address pointing to a 32-bit signed integer in little endian representation.
[out]iThe 32-bit signed integer in native byte order, deserialized from p.

◆ GetInt64LE() [2/2]

void ts::GetInt64LE ( const void *  p,
int64_t &  i 
)
inline

Function getting a 64-bit signed integer from serialized data in little endian representation.

Parameters
[in]pAn address pointing to a 64-bit signed integer in little endian representation.
[out]iThe 64-bit signed integer in native byte order, deserialized from p.

◆ PutUInt8()

void ts::PutUInt8 ( void *  p,
uint8_t  i 
)
inline

Function serializing an 8-bit unsigned integer data.

Note: There is no byte-swapping in the serialization / deserialization of 8-bit integer data. But this function is provided for consistency.

Parameters
[out]pAn address where to serialize the 8-bit unsigned integer.
[in]iThe 8-bit unsigned integer to serialize.

◆ PutUInt16()

void ts::PutUInt16 ( void *  p,
uint16_t  i 
)
inline

Function serializing a 16-bit unsigned integer data in big endian representation.

Parameters
[out]pAn address where to serialize the 16-bit unsigned integer.
[in]iThe 16-bit unsigned integer in native byte order to serialize in big endian representation.

◆ PutUInt24()

void ts::PutUInt24 ( void *  p,
uint32_t  i 
)
inline

Function serializing a 24-bit unsigned integer data in big endian representation.

Parameters
[out]pAn address where to serialize the 24-bit unsigned integer.
[in]iThe 24-bit unsigned integer in native byte order to serialize in big endian representation.

◆ PutUInt32()

void ts::PutUInt32 ( void *  p,
uint32_t  i 
)
inline

Function serializing a 32-bit unsigned integer data in big endian representation.

Parameters
[out]pAn address where to serialize the 32-bit unsigned integer.
[in]iThe 32-bit unsigned integer in native byte order to serialize in big endian representation.

◆ PutUInt40()

void ts::PutUInt40 ( void *  p,
uint64_t  i 
)
inline

Function serializing a 40-bit unsigned integer data in big endian representation.

Parameters
[out]pAn address where to serialize the 40-bit unsigned integer.
[in]iThe 40-bit unsigned integer in native byte order to serialize in big endian representation.

◆ PutUInt48()

void ts::PutUInt48 ( void *  p,
uint64_t  i 
)
inline

Function serializing a 48-bit unsigned integer data in big endian representation.

Parameters
[out]pAn address where to serialize the 48-bit unsigned integer.
[in]iThe 48-bit unsigned integer in native byte order to serialize in big endian representation.

◆ PutUInt64()

void ts::PutUInt64 ( void *  p,
uint64_t  i 
)
inline

Function serializing a 64-bit unsigned integer data in big endian representation.

Parameters
[out]pAn address where to serialize the 64-bit unsigned integer.
[in]iThe 64-bit unsigned integer in native byte order to serialize in big endian representation.

◆ PutInt8()

void ts::PutInt8 ( void *  p,
int8_t  i 
)
inline

Function serializing an 8-bit signed integer data.

Note: There is no byte-swapping in the serialization / deserialization of 8-bit integer data. But this function is provided for consistency.

Parameters
[out]pAn address where to serialize the 8-bit signed integer.
[in]iThe 8-bit signed integer to serialize.

◆ PutInt16()

void ts::PutInt16 ( void *  p,
int16_t  i 
)
inline

Function serializing a 16-bit signed integer data in big endian representation.

Parameters
[out]pAn address where to serialize the 16-bit signed integer.
[in]iThe 16-bit signed integer in native byte order to serialize in big endian representation.

◆ PutInt24()

void ts::PutInt24 ( void *  p,
int32_t  i 
)
inline

Function serializing a 24-bit signed integer data in big endian representation.

Parameters
[out]pAn address where to serialize the 24-bit signed integer.
[in]iThe 32-bit signed integer in native byte order to serialize in big endian representation.

◆ PutInt32()

void ts::PutInt32 ( void *  p,
int32_t  i 
)
inline

Function serializing a 32-bit signed integer data in big endian representation.

Parameters
[out]pAn address where to serialize the 32-bit signed integer.
[in]iThe 32-bit signed integer in native byte order to serialize in big endian representation.

◆ PutInt64()

void ts::PutInt64 ( void *  p,
int64_t  i 
)
inline

Function serializing a 64-bit signed integer data in big endian representation.

Parameters
[out]pAn address where to serialize the 64-bit signed integer.
[in]iThe 64-bit signed integer in native byte order to serialize in big endian representation.

◆ PutInt16BE()

void ts::PutInt16BE ( void *  p,
int16_t  i 
)
inline

Function serializing a 16-bit signed integer data in big endian representation.

Parameters
[out]pAn address where to serialize the 16-bit signed integer.
[in]iThe 16-bit signed integer in native byte order to serialize in big endian representation.

◆ PutInt24BE()

void ts::PutInt24BE ( void *  p,
int32_t  i 
)
inline

Function serializing a 24-bit signed integer data in big endian representation.

Parameters
[out]pAn address where to serialize the 24-bit signed integer.
[in]iThe 32-bit signed integer in native byte order to serialize in big endian representation.

◆ PutInt32BE()

void ts::PutInt32BE ( void *  p,
int32_t  i 
)
inline

Function serializing a 32-bit signed integer data in big endian representation.

Parameters
[out]pAn address where to serialize the 32-bit signed integer.
[in]iThe 32-bit signed integer in native byte order to serialize in big endian representation.

◆ PutInt40BE()

void ts::PutInt40BE ( void *  p,
int64_t  i 
)
inline

Function serializing a 40-bit signed integer data in big endian representation.

Parameters
[out]pAn address where to serialize the 40-bit signed integer.
[in]iThe 64-bit signed integer in native byte order to serialize in big endian representation.

◆ PutInt48BE()

void ts::PutInt48BE ( void *  p,
int64_t  i 
)
inline

Function serializing a 48-bit signed integer data in big endian representation.

Parameters
[out]pAn address where to serialize the 48-bit signed integer.
[in]iThe 64-bit signed integer in native byte order to serialize in big endian representation.

◆ PutInt64BE()

void ts::PutInt64BE ( void *  p,
int64_t  i 
)
inline

Function serializing a 64-bit signed integer data in big endian representation.

Parameters
[out]pAn address where to serialize the 64-bit signed integer.
[in]iThe 64-bit signed integer in native byte order to serialize in big endian representation.

◆ PutInt16LE()

void ts::PutInt16LE ( void *  p,
int16_t  i 
)
inline

Function serializing a 16-bit signed integer data in little endian representation.

Parameters
[out]pAn address where to serialize the 16-bit signed integer.
[in]iThe 16-bit signed integer in native byte order to serialize in little endian representation.

◆ PutInt24LE()

void ts::PutInt24LE ( void *  p,
int32_t  i 
)
inline

Function serializing a 24-bit signed integer data in little endian representation.

Parameters
[out]pAn address where to serialize the 24-bit signed integer.
[in]iThe 32-bit signed integer in native byte order to serialize in little endian representation.

◆ PutInt32LE()

void ts::PutInt32LE ( void *  p,
int32_t  i 
)
inline

Function serializing a 32-bit signed integer data in little endian representation.

Parameters
[out]pAn address where to serialize the 32-bit signed integer.
[in]iThe 32-bit signed integer in native byte order to serialize in little endian representation.

◆ PutInt40LE()

void ts::PutInt40LE ( void *  p,
int64_t  i 
)
inline

Function serializing a 40-bit signed integer data in little endian representation.

Parameters
[out]pAn address where to serialize the 40-bit signed integer.
[in]iThe 64-bit signed integer in native byte order to serialize in little endian representation.

◆ PutInt48LE()

void ts::PutInt48LE ( void *  p,
int64_t  i 
)
inline

Function serializing a 48-bit signed integer data in little endian representation.

Parameters
[out]pAn address where to serialize the 48-bit signed integer.
[in]iThe 64-bit signed integer in native byte order to serialize in little endian representation.

◆ PutInt64LE()

void ts::PutInt64LE ( void *  p,
int64_t  i 
)
inline

Function serializing a 64-bit signed integer data in little endian representation.

Parameters
[out]pAn address where to serialize the 64-bit signed integer.
[in]iThe 64-bit signed integer in native byte order to serialize in little endian representation.

◆ GetIntBE() [1/2]

template<typename INT >
requires std::integral<INT>
INT ts::GetIntBE ( const void *  p)
inline

Template function getting an integer from serialized data in big endian representation.

Template Parameters
INTSome integer type.
Parameters
[in]pAn address pointing to an INT in big endian representation.
Returns
The INT value in native byte order, deserialized from p.

◆ GetIntLE() [1/2]

template<typename INT >
requires std::integral<INT>
INT ts::GetIntLE ( const void *  p)
inline

Template function getting an integer from serialized data in little endian representation.

Template Parameters
INTSome integer type.
Parameters
[in]pAn address pointing to an INT in little endian representation.
Returns
The INT value in native byte order, deserialized from p.

◆ GetIntBE() [2/2]

template<typename INT >
requires std::integral<INT>
void ts::GetIntBE ( const void *  p,
INT i 
)
inline

Template function getting an integer from serialized data in big endian representation.

Template Parameters
INTSome integer type.
Parameters
[in]pAn address pointing to an INT in big endian representation.
[out]iThe INT value in native byte order, deserialized from p.

◆ GetIntLE() [2/2]

template<typename INT >
requires std::integral<INT>
void ts::GetIntLE ( const void *  p,
INT i 
)
inline

Template function getting an integer from serialized data in little endian representation.

Template Parameters
INTSome integer type.
Parameters
[in]pAn address pointing to an INT in little endian representation.
[out]iThe INT value in native byte order, deserialized from p.

◆ PutIntBE()

template<typename INT >
requires std::integral<INT>
void ts::PutIntBE ( void *  p,
INT  i 
)
inline

Template function serializing an integer data in big endian representation.

Template Parameters
INTSome integer type.
Parameters
[out]pAn address where to serialize the integer.
[in]iThe INT in native byte order to serialize in big endian representation.

◆ PutIntLE()

template<typename INT >
requires std::integral<INT>
void ts::PutIntLE ( void *  p,
INT  i 
)
inline

Template function serializing an integer data in little endian representation.

Template Parameters
INTSome integer type.
Parameters
[out]pAn address where to serialize the integer.
[in]iThe INT in native byte order to serialize in little endian representation.

◆ GetInt() [1/2]

template<typename INT >
requires std::integral<INT>
INT ts::GetInt ( const void *  p)
inline

Template function getting an integer from serialized data in big endian representation.

Template Parameters
INTSome integer type.
Parameters
[in]pAn address pointing to an INT in big endian representation.
Returns
The INT value in native byte order, deserialized from p.

◆ GetInt() [2/2]

template<typename INT >
requires std::integral<INT>
void ts::GetInt ( const void *  p,
INT i 
)
inline

Template function getting an integer from serialized data in big endian representation.

Template Parameters
INTSome integer type.
Parameters
[in]pAn address pointing to an INT in big endian representation.
[out]iThe INT value in native byte order, deserialized from p.

◆ PutInt()

template<typename INT >
requires std::integral<INT>
void ts::PutInt ( void *  p,
INT  i 
)
inline

Template function serializing an integer data in big endian representation.

Template Parameters
INTSome integer type.
Parameters
[out]pAn address where to serialize the integer.
[in]iThe INT in native byte order to serialize in big endian representation.

◆ GetIntVarBE() [1/2]

template<typename INT >
requires std::integral<INT>
INT ts::GetIntVarBE ( const void *  p,
size_t  size 
)

Template function getting a variable-length integer from serialized data in big endian representation.

Template Parameters
INTSome integer type.
Parameters
[in]pAn address pointing to an INT in big endian representation.
[in]sizeSize in bytes of the integer. Must be 1 to 8.
Returns
The INT value in native byte order, deserialized from p.

◆ GetIntVarLE() [1/2]

template<typename INT >
requires std::integral<INT>
INT ts::GetIntVarLE ( const void *  p,
size_t  size 
)

Template function getting a variable-length integer from serialized data in little endian representation.

Template Parameters
INTSome integer type.
Parameters
[in]pAn address pointing to an INT in little endian representation.
[in]sizeSize in bytes of the integer. Must be 1 to 8.
Returns
The INT value in native byte order, deserialized from p.

◆ GetIntVarBE() [2/2]

template<typename INT >
requires std::integral<INT>
void ts::GetIntVarBE ( const void *  p,
size_t  size,
INT i 
)
inline

Template function getting a variable-length integer from serialized data in big endian representation.

Template Parameters
INTSome integer type.
Parameters
[in]pAn address pointing to an INT in big endian representation.
[in]sizeSize in bytes of the integer. Must be 1 to 8.
[out]iThe INT value in native byte order, deserialized from p.

◆ GetIntVarLE() [2/2]

template<typename INT >
requires std::integral<INT>
void ts::GetIntVarLE ( const void *  p,
size_t  size,
INT i 
)
inline

Template function getting a variable-length integer from serialized data in little endian representation.

Template Parameters
INTSome integer type.
Parameters
[in]pAn address pointing to an INT in little endian representation.
[in]sizeSize in bytes of the integer. Must be 1 to 8.
[out]iThe INT value in native byte order, deserialized from p.

◆ PutIntVarBE()

template<typename INT >
requires std::integral<INT>
void ts::PutIntVarBE ( void *  p,
size_t  size,
INT  i 
)
inline

Template function serializing a variable-length integer data in big endian representation.

Template Parameters
INTSome integer type.
Parameters
[out]pAn address where to serialize the integer.
[in]sizeSize in bytes of the integer. Must be 1 to 8.
[in]iThe INT in native byte order to serialize in big endian representation.

◆ PutIntVarLE()

template<typename INT >
requires std::integral<INT>
void ts::PutIntVarLE ( void *  p,
size_t  size,
INT  i 
)
inline

Template function serializing a variable-length integer data in little endian representation.

Template Parameters
INTSome integer type.
Parameters
[out]pAn address where to serialize the integer.
[in]sizeSize in bytes of the integer. Must be 1 to 8.
[in]iThe INT in native byte order to serialize in little endian representation.

◆ GetIntVar() [1/2]

template<typename INT >
requires std::integral<INT>
INT ts::GetIntVar ( const void *  p,
size_t  size 
)
inline

Template function getting a variable-length integer from serialized data in big endian representation.

Template Parameters
INTSome integer type.
Parameters
[in]pAn address pointing to an INT in big endian representation.
[in]sizeSize in bytes of the integer. Must be 1 to 8.
Returns
The INT value in native byte order, deserialized from p.

◆ GetIntVar() [2/2]

template<typename INT >
requires std::integral<INT>
void ts::GetIntVar ( const void *  p,
size_t  size,
INT i 
)
inline

Template function getting a variable-length integer from serialized data in big endian representation.

Template Parameters
INTSome integer type.
Parameters
[in]pAn address pointing to an INT in big endian representation.
[in]sizeSize in bytes of the integer. Must be 1 to 8.
[out]iThe INT value in native byte order, deserialized from p.

◆ PutIntVar()

template<typename INT >
requires std::integral<INT>
void ts::PutIntVar ( void *  p,
size_t  size,
INT  i 
)
inline

Template function serializing a variable-length integer data in big endian representation.

Template Parameters
INTSome integer type.
Parameters
[out]pAn address where to serialize the integer.
[in]sizeSize in bytes of the integer. Must be 1 to 8.
[in]iThe INT in native byte order to serialize in big endian representation.

◆ UCharacteristics()

uint32_t ts::UCharacteristics ( UChar  c)

Get the characteristics of a character.

Parameters
[in]cA character.
Returns
Bitmask of the characteristics of c.

◆ IsSpace()

bool ts::IsSpace ( UChar  c)
inline

Check if a character is a space.

Parameters
[in]cA character.
Returns
True if c is a space, tab, new line character.

◆ IsPrintable()

bool ts::IsPrintable ( UChar  c)
inline

Check if a character is printable according to the current C locale.

Parameters
[in]cA character.
Returns
True if c is a printable character.

◆ IsAlpha()

bool ts::IsAlpha ( UChar  c)
inline

Check if a character is a letter.

Parameters
[in]cA character.
Returns
True if c is a letter.

◆ IsDigit()

bool ts::IsDigit ( UChar  c)
inline

Check if a character is a decimal digit.

Parameters
[in]cA character.
Returns
True if c is a decimal digit.

◆ IsAlphaNum()

bool ts::IsAlphaNum ( UChar  c)
inline

Check if a character is alphanumerical.

Parameters
[in]cA character.
Returns
True if c is alphanumerical.

◆ IsHexa()

bool ts::IsHexa ( UChar  c)
inline

Check if a character is an hexadecimal digit.

Parameters
[in]cA character.
Returns
True if c is an hexadecimal digit.

◆ ToDigit()

int ts::ToDigit ( UChar  c,
int  base = 10,
int  defaultValue = -1 
)

Convert a character representing a multi-base integer digit into the corresponding integer value.

Characters '0'..'9' are converted to 0..9. Characters 'a'..'z' and 'A'..'Z' are converted to 10..35. This function can be used to convert decimal digits, hexadecimal and any other base up to base 36.

Parameters
[in]cA character to convert.
[in]baseThe base of the integer representation, must be in the range 2 to 36.
[in]defaultValueThe value to return on invalid character.
Returns
The corresponding integer value or the default value in case of error.

◆ IsLower()

bool ts::IsLower ( UChar  c)

Check if a character is a lower case letter.

Parameters
[in]cA character.
Returns
True if c is a lower case letter.

◆ IsUpper()

bool ts::IsUpper ( UChar  c)

Check if a character is an upper case letter.

Parameters
[in]cA character.
Returns
True if c is an upper case letter.

◆ ToLower()

UChar ts::ToLower ( UChar  c)

Convert a character to lowercase.

Parameters
[in]cA character to convert to lowercase.
Returns
c converted to lowercase.

◆ ToUpper()

UChar ts::ToUpper ( UChar  c)

Convert a character to uppercase.

Parameters
[in]cA character to convert to uppercase.
Returns
c converted to uppercase.

◆ Match()

bool ts::Match ( UChar  c1,
UChar  c2,
CaseSensitivity  cs 
)

Check two characters match, case sensitive or insensitive.

Parameters
[in]c1First character.
[in]c2Second character.
[in]csCase sensitivity of the comparision.
Returns
True if the two characters match.

◆ IsAccented()

bool ts::IsAccented ( UChar  c)

Check if a character contains an accent.

Parameters
[in]cA character.
Returns
True if c contains an accent.

◆ RemoveAccent()

UString ts::RemoveAccent ( UChar  c)

Remove all forms of accent or composition from a character.

Parameters
[in]cA character.
Returns
A string containing c without accent. This is a string and not a char since composed characters can be translated as two characters.

◆ IsCombiningDiacritical()

bool ts::IsCombiningDiacritical ( UChar  c)
inline

Check if a character is a combining diacritical character.

Such a character, when printed, is combined with the preceding character.

Parameters
[in]cA character.
Returns
True if c is a combining diacritical character.

◆ IsLeadingSurrogate()

bool ts::IsLeadingSurrogate ( UChar  c)
inline

Check if a character is a "leading surrogate" value.

In the most general form, a Unicode character needs 21 bits to be represented. However, most characters can be represented using 16 bits and are implemented as only one 16-bit value in UTF-16 or one single UChar. Any Unicode character which cannot be represented within 16 bits needs two consecutive UChar values in an UTF-16 string. These two values are called a "surrogate pair". The first ("leading") and second ("trailing") value of a surrogate pair are specially coded and can be identified as such.

Parameters
[in]cA character.
Returns
True if c is a "leading surrogate" value.
See also
IsTrailingSurrogate()

◆ IsTrailingSurrogate()

bool ts::IsTrailingSurrogate ( UChar  c)
inline

Check if a character is a "trailing surrogate" value.

Parameters
[in]cA character.
Returns
True if c is a "trailing surrogate" value.
See also
IsLeadingSurrogate()

◆ NeedSurrogate()

bool ts::NeedSurrogate ( char32_t  cp)
inline

Check if a 32-bit Unicode code point needs a surrogate pair in UTF-16 representation.

Parameters
[in]cpA 32-bit Unicode code point.
Returns
True if cp needs a surrogate pair.

◆ LeadingSurrogate()

UChar ts::LeadingSurrogate ( char32_t  cp)
inline

Compute the first part of the surrogate pair of a 32-bit Unicode code point (which needs a surrogate pair).

Parameters
[in]cpA 32-bit Unicode code point.
Returns
The first part of its surrogate pair.
See also
NeedSurrogate()

◆ TrailingSurrogate()

UChar ts::TrailingSurrogate ( char32_t  cp)
inline

Compute the second part of the surrogate pair of a 32-bit Unicode code point (which needs a surrogate pair).

Parameters
[in]cpA 32-bit Unicode code point.
Returns
The second part of its surrogate pair.
See also
NeedSurrogate()

◆ FromSurrogatePair()

char32_t ts::FromSurrogatePair ( UChar  lead,
UChar  trail 
)
inline

Build a 32-bit Unicode code point from a surrogate pair.

Parameters
[in]leadFirst part of the surrogate pair.
[in]trailSecond part of the surrogate pair.
Returns
A 32-bit Unicode code point.

◆ ToHTML()

UString ts::ToHTML ( UChar  c)

Convert a character into its corresponding HTML sequence.

Parameters
[in]cA character.
Returns
A string containing the html sequence for c.

◆ FromHTML()

UChar ts::FromHTML ( const UString entity)

Convert the body on an HTML entity into a character.

Parameters
[in]entityThe body on an HTML entity (e.g. "amp" for sequence "\&amp;").
Returns
The corresponding character or CHAR_NULL if not found.

◆ Precombined()

UChar ts::Precombined ( UChar  letter,
UChar  mark 
)

Build a precombined character from its base letter and non-spacing diacritical mark.

Parameters
[in]letterThe base letter.
[in]markThe non-spacing diacritical mark.
Returns
The precombined character or CHAR_NULL if the sequence does not have a precombined equivalent.

◆ DecomposePrecombined()

bool ts::DecomposePrecombined ( UChar  c,
UChar letter,
UChar mark 
)

Decompose a precombined character into its base letter and non-spacing diacritical mark.

Parameters
[in]cA character.
[out]letterThe base letter for c.
[out]markThe non-spacing diacritical mark for c.
Returns
True if c was successfully decomposed into letter and diac, false if c is not a precombined character.

Variable Documentation

◆ NPOS

constexpr size_t ts::NPOS = size_t(-1)
constexpr

Constant meaning "no size", "not found" or "do not resize".

An alternative value for the standard std::string::npos value. Required on Windows to avoid linking issue.

◆ dependent_false

template<typename T >
constexpr bool ts::dependent_false = std::false_type::value
constexpr

A "false" expression which is built from a template type T.

Template Parameters
TA type, any type but typically a template parameter.

With C++20, structures with a cascade of "if constexpr" are good replacements for conditional compilation or SFINAE templates. At the end such a cascade, it is common to trap unsupported cases using a "static_assert(false)". However, static_assert(false) is "ill-formed, no diagnostic required", meaning that it may compile, or not. It depends on the compiler. To avoid this, we build a non-literal expression which always evaluates to false but depends on a type, typically a template parameter type.

◆ MAX_POWER_10

constexpr size_t ts::MAX_POWER_10 = 19
constexpr

Largest representable power of 10 in integer types.

Assuming that no integer type is larger than 64 bits, 10^19 is the largest unsigned power of 10.