![]() |
TSDuck v3.40-4163
MPEG Transport Stream Toolkit
|
C++ language features and design patterns. More...
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< INT > | ts::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 UChar * | ts::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". | |
C++ language features and design patterns.
#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.
#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.
#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).
#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.)
#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.
#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.
#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.
#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.
#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:
This will print:
#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 "..."
#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.
prefix | Prefix for the symbol. Using different prefixes, several distinct unique identifiers can be used on the same line. |
#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).
directive | The directive for the pragma. Plain directive, not a string literal. |
Examples (depending on compilers):
#define TS_PUSH_WARNING | ( | ) |
Save the compiler's warnings reporting.
#define TS_POP_WARNING | ( | ) |
Restore the compiler's warnings reporting from a previous TS_PUSH_WARNING().
#define TS_LLVM_NOWARNING | ( | name | ) |
Disable a warning with the LLVM/clang compiler (does nothing on other compilers).
name | Warning name, as used after command line option -W |
#define TS_GCC_NOWARNING | ( | name | ) |
Disable a warning with the GCC compiler (does nothing on other compilers).
name | Warning name, as used after command line option -W |
#define TS_MSC_NOWARNING | ( | num | ) |
Disable a warning with the Microsoft Visual C++ compiler (does nothing on other compilers).
num | Warning number. |
#define TS_NO_OPTIMIZE platform_specific |
Attribute to explicitly disable optimization in a function.
Example:
#define TS_FUNCTION |
Definition of the name of the current function.
This is typically func but recent compilers have "pretty" names for C++.
#define TS_NOCOPY | ( | classname | ) |
A macro to disable object copy in the declaration of a class.
The copy and move constructors and assignments are explicitly deleted.
classname | Name of the enclosing class. |
#define TS_NOMOVE | ( | classname | ) |
A macro to disable object move in the declaration of a class.
The move constructor and assignment are explicitly deleted.
classname | Name of the enclosing class. |
#define TS_NOBUILD_NOCOPY | ( | classname | ) |
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.
classname | Name of the enclosing class. |
#define TS_NO_DEFAULT_CONSTRUCTORS | ( | classname | ) |
A macro to disable default constructors in the declaration of a class.
The default, copy and move constructors are explicitly deleted.
classname | Name of the enclosing class. |
#define TS_DEFAULT_ASSIGMENTS | ( | classname | ) |
A macro to declare the default assignment operators in the declaration of a class.
classname | Name of the enclosing 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.
classname | Name of the enclosing class. |
#define TS_RULE_OF_FIVE | ( | 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.
classname | Name of the enclosing class. |
dtor_attributes | Post attributes for the destructor. |
#define TS_INTERFACE | ( | classname | ) |
A macro to declare the basic operators in the declaration of an interface class.
classname | Name of the enclosing class. |
#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.
classname | Name of the singleton class, without namespace or outer class name. |
Example code:
The class becomes a singleton. The default constructor is private. Use static Instance() method to get the instance of the singleton.
#define TS_DEFINE_SINGLETON | ( | fullclassname | ) |
Singleton class definition.
The macro TS_DEFINE_SINGLETON must be used in the implementation of a singleton class.
fullclassname | Fully qualified name of the singleton class. |
#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).
suffix | Some unique suffix if the macro is invoked several times on the same line. |
addr | An address to reference (string literal, external symbol, etc.) |
#define TS_ENABLE_BITMASK_OPERATORS | ( | T | ) |
This macro enables bitmask operators on an enumeration type.
T | An enumeration type or enumeration class. |
Example:
#define TS_DECLARE_EXCEPTION | ( | name | ) |
This macro declares an exception as a subclass of ts::Exception.
[in] | name | Name of the exception class. |
#define TS_ZERO | ( | var | ) | ts::MemZero(&(var), sizeof(var)) |
Zeroing an plain memory variable.
Do not use with instances of C++ classes.
[out] | var | Name of a variable. |
#define TS_REGISTER_CHRONO_UNIT | ( | classname, | |
... | |||
) |
Registration of a new std::chrono::duration unit name.
classname | An instance of std::chrono::duration. |
using ts::deciseconds = typedef cn::duration<cn::milliseconds::rep, std::deci> |
A derivative of std::chrono::duration for deciseconds (1/10 of a second).
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..
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.
using ts::underlying_type_t = typedef typename underlying_type<T>::type |
Helper type for ts::underlying_type.
T | An integral or enumeration type. |
using ts::make_signed_t = typedef typename make_signed<T>::type |
Helper type for ts::make_signed.
T | An integral or floating-point type. |
using ts::int_max_t = typedef typename int_max<INT>::type |
Helper type for ts::int_max.
INT | An integer type, any size, signed or unsigned. |
|
strong |
|
strong |
|
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.
enum ts::CaseSensitivity |
anonymous enum : uint32_t |
Characteristics of a character.
Bitwise combinations are allowed.
enum ts::StringDirection |
enum ts::StringComparison : uint32_t |
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:
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.
T | The type of elements in the sets. |
UnaryPredicate | The type of unary predicate returning true or false from one set of elements of type T. |
values | The 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". |
fixed | The 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. |
size | The 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". |
predicate | The 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. |
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.
ELEMENT | Any type. |
CONTAINER | A container class of ELEMENT as defined by the C++ Standard Template Library (STL). |
[in,out] | container | A container of ELEMENT . |
[in] | e | An element to conditionally append to 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.
CONTAINER | A container class as defined by the C++ Standard Template Library (STL). |
[in,out] | container | A container into which duplicates are removed. |
size_t ts::SmallestSize | ( | const CONTAINER & | container | ) |
Get the size of the smallest object in a container of objects having a size()
method.
CONTAINER | A container class as defined by the C++ Standard Template Library (STL). |
[in] | container | A container of objects. |
size_t ts::LargestSize | ( | const CONTAINER & | container | ) |
Get the size of the largest object in a container of objects having a size()
method.
CONTAINER | A container class as defined by the C++ Standard Template Library (STL). |
[in] | container | A container of objects. |
std::list< typename MAP::key_type > ts::MapKeysList | ( | const MAP & | container | ) |
Get the list of all keys in a map.
MAP | A map container class as defined by the C++ Standard Template Library (STL). |
[in] | container | A container of objects. |
std::set< typename MAP::key_type > ts::MapKeysSet | ( | const MAP & | container | ) |
Get the set of all keys in a map.
MAP | A map container class as defined by the C++ Standard Template Library (STL). |
[in] | container | A container of objects. |
std::list< typename MAP::mapped_type > ts::MapValuesList | ( | const MAP & | container | ) |
Get the list of all values in a map.
MAP | A map container class as defined by the C++ Standard Template Library (STL). |
[in] | container | A container of objects. |
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:
OSTREAM | A subclass of std::basic_ostream . |
[in,out] | strm | The stream of class OSTREAM to manipulate. |
[in] | func | A pointer to member function in OSTREAM. This method shall take no parameter and return a reference to the OSTREAM object. |
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.
OSTREAM | A subclass of std::basic_ostream . |
PARAM | The type of the parameter for the manipulator. |
[in,out] | strm | The stream of class OSTREAM to manipulate. |
[in] | proxy | The ts::IOManipulatorProxy object. |
|
inline |
MonoBoolPredicate identity.
[in] | arg | A boolean argument. |
|
inline |
MonoBoolPredicate "not".
[in] | arg | A boolean argument. |
|
inline |
BoolPredicate "and".
Note this predicate does not allow the traditional "&&" short circuit. The two arguments are always evaluated.
[in] | arg1 | A boolean argument. |
[in] | arg2 | A boolean argument. |
|
inline |
BoolPredicate "or".
Note this predicate does not allow the traditional "||" short circuit. The two arguments are always evaluated.
[in] | arg1 | A boolean argument. |
[in] | arg2 | A boolean argument. |
|
inline |
BoolPredicate "nand".
[in] | arg1 | A boolean argument. |
[in] | arg2 | A boolean argument. |
|
inline |
BoolPredicate "nor".
[in] | arg1 | A boolean argument. |
[in] | arg2 | A boolean argument. |
|
inline |
BoolPredicate "exclusive or".
[in] | arg1 | A boolean argument. |
[in] | arg2 | A boolean argument. |
bool ts::MultiAnd | ( | std::initializer_list< bool > | args | ) |
MultiBoolPredicate "and".
[in] | args | A variable list of boolean arguments. |
bool ts::MultiOr | ( | std::initializer_list< bool > | args | ) |
MultiBoolPredicate "or".
[in] | args | A variable list of boolean arguments. |
|
inline |
MultiBoolPredicate "nand".
[in] | args | A variable list of boolean arguments. |
|
inline |
MultiBoolPredicate "nor".
[in] | args | A variable list of boolean arguments. |
uint64_t ts::UID | ( | ) |
Generate a new 64-bit UID, unique integer.
Normalize any integer value in the range of a Tristate value.
INT | An integer type. |
[in] | i | The integer value. |
|
inline |
Set a default value in a std::optional object, if there is none.
T | The type of the optional object. |
U | The type of the default value to set. |
[in,out] | opt | The optinal object to set. |
[in] | value | The value to set in obj if it is not initialized. |
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.
[in] | index | The type_index of a class. |
|
inline |
Get the name of a class from the type_info
of an object.
The result may be not portable.
[in] | info | The type_info of an object. |
|
inline |
Check if a byte is a valid Binary Coded Decimal (BCD) value.
[in] | b | A byte containing a BCD-encoded value. |
|
inline |
Return the decimal value of a Binary Coded Decimal (BCD) encoded byte.
[in] | b | A byte containing a BCD-encoded value. |
|
inline |
Return a one-byte Binary Coded Decimal (BCD) representation of an integer.
[in] | i | The integer to encode (must be in 0..99). |
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.
[in] | bcd | Address of an array of bytes. |
[in] | bcd_count | Number of BCD digits (bcd_count / 2 bytes). Note that bcd_count can be even. |
[in] | left_justified | When 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. |
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.
[out] | bcd | Address of an array of bytes. Its size must be at least (bcd_count + 1) / 2 bytes. |
[in] | bcd_count | Number of BCD digits. Note that bcd_count can be even. |
[in] | value | The value to encode. |
[in] | left_justified | When 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_nibble | A 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. |
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.
[out] | str | Returned string representation. |
[in] | bcd | Address of an array of bytes. |
[in] | bcd_count | Number of BCD digits (bcd_count / 2 bytes). Note that bcd_count can be even. |
[in] | decimal | Indicates the position of the virtual decimal point (-1: none, 0: before first digit, 1: after first digit, etc.) |
[in] | left_justified | When 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. |
|
inline |
Perform a sign extension on 24 bit integers.
[in] | x | A 32-bit integer containing a signed 24-bit value to extend. |
|
inline |
Perform a sign extension on 40 bit integers.
[in] | x | A 64-bit integer containing a signed 40-bit value to extend. |
|
inline |
Perform a sign extension on 48 bit integers.
[in] | x | A 64-bit integer containing a signed 48-bit value to extend. |
|
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.
[in] | x | A 16-bit unsigned integer to swap. |
|
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.
[in] | x | A 32-bit unsigned integer containing a 24-bit value to swap. |
|
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.
[in] | x | A 32-bit unsigned integer to swap. |
|
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.
[in] | x | A 64-bit unsigned integer to swap. |
|
inline |
Inlined function performing conditional byte swap on 16-bit integer data to obtain the data in big endian representation.
[in] | x | A 16-bit unsigned integer to conditionally swap. |
|
inline |
Inlined function performing conditional byte swap on 16-bit integer data to obtain the data in big endian representation.
[in] | x | A 16-bit unsigned integer to conditionally swap. |
|
inline |
Inlined function performing conditional byte swap on 24-bit integer data to obtain the data in big endian representation.
[in] | x | A 32-bit unsigned integer containing a 24-bit value to conditionally swap. |
|
inline |
Inlined function performing conditional byte swap on 24-bit integer data to obtain the data in big endian representation.
[in] | x | A 32-bit unsigned integer containing a 24-bit value to conditionally swap. |
|
inline |
Inlined function performing conditional byte swap on 32-bit integer data to obtain the data in big endian representation.
[in] | x | A 32-bit unsigned integer to conditionally swap. |
|
inline |
Inlined function performing conditional byte swap on 32-bit integer data to obtain the data in big endian representation.
[in] | x | A 32-bit unsigned integer to conditionally swap. |
|
inline |
Inlined function performing conditional byte swap on 64-bit integer data to obtain the data in big endian representation.
[in] | x | A 64-bit unsigned integer to conditionally swap. |
|
inline |
Inlined function performing conditional byte swap on 64-bit integer data to obtain the data in big endian representation.
[in] | x | A 64-bit unsigned integer to conditionally swap. |
|
inline |
Inlined function performing conditional byte swap on 16-bit integer data to obtain the data in little endian representation.
[in] | x | A 16-bit unsigned integer to conditionally swap. |
|
inline |
Inlined function performing conditional byte swap on 24-bit integer data to obtain the data in little endian representation.
[in] | x | A 32-bit unsigned integer containing a 24-bit value to conditionally swap. |
|
inline |
Inlined function performing conditional byte swap on 32-bit integer data to obtain the data in little endian representation.
[in] | x | A 32-bit unsigned integer to conditionally swap. |
|
inline |
Inlined function performing conditional byte swap on 64-bit integer data to obtain the data in little endian representation.
[in] | x | A 64-bit unsigned integer to conditionally swap. |
Template function performing conditional byte swap on integer data to obtain the data in big endian representation.
INT | Some integer type. |
[in] | x | An INT to conditionally swap. |
Template function performing conditional byte swap on integer data to obtain the data in little endian representation.
INT | Some integer type. |
[in] | x | An INT to conditionally swap. |
Template function performing conditional byte swap on integer data to obtain the data in big endian representation.
INT | Some integer type. |
[in] | x | An INT to conditionally swap. |
|
inline |
Display operator for displayable objects.
[in,out] | strm | Where to output the content. |
[in] | obj | The object to display. |
|
inline |
This template function compares two floating point values for approximated equality.
T | A floating point type. |
a | First value to test. |
b | Second value to test. |
epsilon | The approximation tolerance. |
|
inlineconstexpr |
This template function checks if a floating point type matches a given IEEE represenation.
T | An floating point type, any size or representation. |
storage_bits | Expected size in bits of the type. |
exponent_bits | Expected number of bits in the exponent. |
mantissa_bits | Expected number of bits in the mantissa. |
|
inline |
Function getting a 32-bit IEEE float from serialized data in big endian representation.
[in] | p | An address pointing to a 32-bit IEEE float in big endian representation. |
|
inline |
Function getting a 32-bit IEEE float from serialized data in little endian representation.
[in] | p | An address pointing to a 32-bit IEEE float in little endian representation. |
|
inline |
Function getting a 32-bit IEEE float from serialized data in big endian representation.
[in] | p | An address pointing to a 32-bit IEEE float in big endian representation. |
|
inline |
Function getting a 64-bit IEEE float from serialized data in big endian representation.
[in] | p | An address pointing to a 64-bit IEEE float in big endian representation. |
|
inline |
Function getting a 64-bit IEEE float from serialized data in little endian representation.
[in] | p | An address pointing to a 64-bit IEEE float in little endian representation. |
|
inline |
Function getting a 64-bit IEEE float from serialized data in big endian representation.
[in] | p | An address pointing to a 64-bit IEEE float in big endian representation. |
|
inline |
Function serializing a 32-bit IEEE float data in big endian representation.
[out] | p | An address where to serialize the 32-bit IEEE float. |
[in] | f | The 32-bit IEEE float in native byte order to serialize in big endian representation. |
|
inline |
Function serializing a 32-bit IEEE float data in little endian representation.
[out] | p | An address where to serialize the 32-bit IEEE float. |
[in] | f | The 32-bit IEEE float in native byte order to serialize in little endian representation. |
|
inline |
Function serializing a 32-bit IEEE float data in big endian representation.
[out] | p | An address where to serialize the 32-bit IEEE float. |
[in] | f | The 32-bit IEEE float in native byte order to serialize in big endian representation. |
|
inline |
Function serializing a 64-bit IEEE float data in big endian representation.
[out] | p | An address where to serialize the 64-bit IEEE float. |
[in] | f | The 64-bit IEEE float in native byte order to serialize in big endian representation. |
|
inline |
Function serializing a 64-bit IEEE float data in little endian representation.
[out] | p | An address where to serialize the 64-bit IEEE float. |
[in] | f | The 64-bit IEEE float in native byte order to serialize in little endian representation. |
|
inline |
Function serializing a 64-bit IEEE float data in big endian representation.
[out] | p | An address where to serialize the 64-bit IEEE float. |
[in] | f | The 64-bit IEEE float in native byte order to serialize in big endian representation. |
|
inlineconstexpr |
Statically check if a integral or enum value is negative.
T | An integral or enumeration type. |
[in] | x | A value of type T. |
Absolute value of integer types, also working on unsigned types.
INT | An integer type, any size, signed or unsigned. |
[in] | a | An integer value. |
|
inlineconstexpr |
Integer cross-type bound check.
INT1 | An integer type. |
INT2 | An integer type. |
[in] | x | An integer value of type INT2. |
|
inlineconstexpr |
Bounded integer cast.
INT1 | An integer type. |
INT2 | An integer type. |
[in] | x | An integer value of type 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.
INT1 | An integer type. |
INT2 | An integer type. |
[in] | x | An integer value of type INT2. |
std::out_of_range | When the value of x is ouside the limits of type INT1. |
|
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.
INT1 | An integer type. |
INT2 | An integer type. |
[in] | x | An integer value of type INT2. |
std::out_of_range | When the value of x is ouside the limits of type INT1. |
Check if an integer addition generates an overflow.
INT | An integer type, any size, signed or unsigned. |
[in] | a | First integer. |
[in] | b | Second integer. |
[in] | res | The result of a + b. |
Check if an integer addition generates an overflow.
INT | An integer type, any size, signed or unsigned. |
[in] | a | First integer. |
[in] | b | Second integer. |
Check if an integer substraction generates an overflow.
INT | An integer type, any size, signed or unsigned. |
[in] | a | First integer. |
[in] | b | Second integer. |
[in] | res | The result of a - b. |
Check if an integer substraction generates an overflow.
INT | An integer type, any size, signed or unsigned. |
[in] | a | First integer. |
[in] | b | Second integer. |
Check if the negation (opposite sign) of an integer generates an overflow.
INT | An integer type, any size, signed or unsigned. |
[in] | a | An integer value. |
Check if an integer multiplication generates an overflow.
INT | An integer type, any size, signed or unsigned. |
[in] | a | First integer. |
[in] | b | Second integer. |
[in] | res | The result of a * b. |
Check if an integer multiplication generates an overflow.
INT | An integer type, any size, signed or unsigned. |
[in] | a | First integer. |
[in] | b | Second integer. |
Throw an exception if an integer addition generates an overflow.
INT | An integer type, any size, signed or unsigned. |
[in] | a | First integer. |
[in] | b | Second integer. |
[in] | res | The result of a + b. |
std::overflow_error | When a + b generated an overflow. |
Throw an exception if an integer substraction generates an overflow.
INT | An integer type, any size, signed or unsigned. |
[in] | a | First integer. |
[in] | b | Second integer. |
[in] | res | The result of a - b. |
std::overflow_error | When a - b generated an overflow. |
Throw an exception if the negation (opposite sign) of an integer generates an overflow.
INT | An integer type, any size, signed or unsigned. |
[in] | a | An integer value. |
std::overflow_error | When -a generates an overflow. |
Throw an exception if an integer multiplication generates an overflow.
INT | An integer type, any size, signed or unsigned. |
[in] | a | First integer. |
[in] | b | Second integer. |
[in] | res | The result of a * b. |
std::overflow_error | When a * b generated an overflow. |
Throw an exception if the denominator of an integer division is zero.
INT | An integer type, any size, signed or unsigned. |
[in] | den | The denominator of an integer division. |
std::underflow_error | When den is zero. |
In debug mode, throw an exception if an integer addition generates an overflow.
If the macro DEBUG
is not defined, this function does nothing.
INT | An integer type, any size, signed or unsigned. |
[in] | a | First integer. |
[in] | b | Second integer. |
[in] | res | The result of a + b. |
std::overflow_error | When a + b generated an overflow. |
In debug mode, throw an exception if an integer substraction generates an overflow.
If the macro DEBUG
is not defined, this function does nothing.
INT | An integer type, any size, signed or unsigned. |
[in] | a | First integer. |
[in] | b | Second integer. |
[in] | res | The result of a - b. |
std::overflow_error | When a - b generated an overflow. |
|
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.
INT | An integer type, any size, signed or unsigned. |
[in] | a | An integer value. |
std::overflow_error | When -a generates an overflow. |
In debug mode, throw an exception if an integer multiplication generates an overflow.
If the macro DEBUG
is not defined, this function does nothing.
INT | An integer type, any size, signed or unsigned. |
[in] | a | First integer. |
[in] | b | Second integer. |
[in] | res | The result of a * b. |
std::overflow_error | When a * b generated an overflow. |
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.
INT | An integer type, any size, signed or unsigned. |
[in] | den | The denominator of an integer division. |
std::underflow_error | When den is zero. |
Perform a bounded addition without overflow.
INT | An integer type, any size, signed or unsigned. |
[in] | a | First integer. |
[in] | b | Second integer. |
Perform a bounded subtraction without overflow.
INT | An integer type, any size, signed or unsigned. |
[in] | a | First integer. |
[in] | b | Second integer. |
Round x down to previous multiple of a factor f.
INT | An integer type. |
[in] | x | An integer value. |
[in] | f | A factor (its absolute value is used if negative). |
Round x up to next multiple of a factor f.
INT | An integer type. |
[in] | x | An integer value. |
[in] | f | A factor (its absolute value is used if negative). |
Perform a sign extension on any subset of a signed integer.
INT | A signed integer type. |
[in] | x | An integer containing a signed value in some number of LSB. |
[in] | bits | Number of least significant bits containing a signed value. |
size_t ts::MaxDecimalWidth | ( | size_t | typeSize, |
size_t | digitSeparatorSize = 0 |
||
) |
Compute the maximum width of the decimal representation of an integer type.
[in] | typeSize | Size of the integer type in bytes (result of sizeof ). |
[in] | digitSeparatorSize | Size in characters of the digit-grouping separator. |
size_t ts::MaxHexaWidth | ( | size_t | typeSize, |
size_t | digitSeparatorSize = 0 |
||
) |
Compute the maximum width of the hexadecimal representation of an integer type.
[in] | typeSize | Size of the integer type in bytes (result of sizeof ). |
[in] | digitSeparatorSize | Size in characters of the digit-grouping separator. |
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.
INT | An integer type. |
[in] | x | An integer containing a signed value in some number of LSB. |
Get the mask to select a given number of least significant bits in an integer value.
INT | An integer type. |
[in] | bits | Number of least significant bits to select. Zero means all bits. |
|
inlineconstexpr |
Get the signed/unsigned qualifier of an integer type as a string.
INT | An integer type. |
Compute a greatest common denominator (GCD).
INT | An integer type. |
[in] | x | An integer. |
[in] | y | An integer. |
uint64_t ts::Power10 | ( | size_t | pow | ) |
Get a power of 10 using a fast lookup table.
[in] | pow | The requested power of 10. |
|
inline |
Zeroing a memory area.
[out] | addr | Address of a memory area to fill with zeroes. |
[in] | size | Size in bytes of the memory area. |
|
inline |
Setting a memory area.
Similar to std::memset() but explicitly does nothing on zero size.
[out] | addr | Address of a memory area to fill with value. |
[in] | value | Byte value to set in all area. |
[in] | size | Size in bytes of the memory area. |
|
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().
[out] | dest | Base address of destination area. |
[in] | src | Base address of source area. |
[in] | size | Size in bytes of the memory area. |
|
inline |
Comparing two memory areas.
Similar to std::memcmp() but explicitly does nothing on zero size.
[in] | addr1 | Base address of first area. |
[in] | addr2 | Base address of second area. |
[in] | size | Size in bytes of the memory area. |
|
inline |
Check if two memory areas are identical.
[in] | addr1 | Base address of first area. |
[in] | addr2 | Base address of second area. |
[in] | size | Size in bytes of the memory area. |
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.
[out] | dest | Destination start address. |
[in] | src1 | Start address of the first area. |
[in] | src2 | Start address of the second area. |
[in] | size | Size in bytes of the memory areas. |
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.
[in] | area | Address of a memory area to check. |
[in] | area_size | Size in bytes of the memory area. |
[in] | prefix | Address of the content of the prefix to check. |
[in] | prefix_size | Size in bytes of the prefix. |
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.
[in] | area | Address of a memory area to check. |
[in] | area_size | Size in bytes of the memory area. |
[in] | pattern | Address of the content of the pattern to check. |
[in] | pattern_size | Size in bytes of the pattern. |
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().
[in] | area | Address of a memory area to check. |
[in] | area_size | Size in bytes of the memory area. |
[in] | third | Third byte of the pattern, after 00 00. |
bool ts::IdenticalBytes | ( | const void * | area, |
size_t | area_size | ||
) |
Check if a memory area contains all identical byte values.
[in] | area | Address of a memory area to check. |
[in] | area_size | Size in bytes of the memory area. |
|
inline |
Function getting a 16-bit unsigned integer from serialized data in big endian representation.
[in] | p | An address pointing to a 16-bit unsigned integer in big endian representation. |
|
inline |
Function getting a 32-bit unsigned integer from serialized data in big endian representation.
[in] | p | An address pointing to a 32-bit unsigned integer 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.
[in] | p | An address pointing to a 24-bit unsigned integer in big endian representation. |
|
inline |
Function getting a 64-bit unsigned integer from serialized data in big endian representation.
[in] | p | An address pointing to a 64-bit unsigned integer 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.
[in] | p | An address pointing to a 40-bit unsigned integer 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.
[in] | p | An address pointing to a 48-bit unsigned integer in big endian representation. |
|
inline |
Function getting a 16-bit unsigned integer from serialized data in little endian representation.
[in] | p | An address pointing to a 16-bit unsigned integer in little endian representation. |
|
inline |
Function getting a 32-bit unsigned integer from serialized data in little endian representation.
[in] | p | An address pointing to a 32-bit unsigned integer in little endian representation. |
uint32_t ts::GetUInt24LE | ( | const void * | p | ) |
Function getting a 24-bit unsigned integer from serialized data in little endian representation.
[in] | p | An address pointing to a 24-bit unsigned integer in little endian representation. |
|
inline |
Function getting a 64-bit unsigned integer from serialized data in little endian representation.
[in] | p | An address pointing to a 64-bit unsigned integer in little endian representation. |
uint64_t ts::GetUInt40LE | ( | const void * | p | ) |
Function getting a 40-bit unsigned integer from serialized data in little endian representation.
[in] | p | An address pointing to a 40-bit unsigned integer in little endian representation. |
uint64_t ts::GetUInt48LE | ( | const void * | p | ) |
Function getting a 48-bit unsigned integer from serialized data in little endian representation.
[in] | p | An address pointing to a 48-bit unsigned integer in little endian representation. |
|
inline |
Function serializing a 16-bit unsigned integer data in big endian representation.
[out] | p | An address where to serialize the 16-bit unsigned integer. |
[in] | i | The 16-bit unsigned integer in native byte order to serialize in big endian representation. |
|
inline |
Function serializing a 32-bit unsigned integer data in big endian representation.
[out] | p | An address where to serialize the 32-bit unsigned integer. |
[in] | i | The 32-bit unsigned integer in native byte order to serialize in big endian representation. |
|
inline |
Function serializing a 64-bit unsigned integer data in big endian representation.
[out] | p | An address where to serialize the 64-bit unsigned integer. |
[in] | i | The 64-bit unsigned integer in native byte order to serialize in big endian representation. |
|
inline |
Function serializing a 16-bit unsigned integer data in little endian representation.
[out] | p | An address where to serialize the 16-bit unsigned integer. |
[in] | i | The 16-bit unsigned integer in native byte order to serialize in little endian representation. |
|
inline |
Function serializing a 32-bit unsigned integer data in little endian representation.
[out] | p | An address where to serialize the 32-bit unsigned integer. |
[in] | i | The 32-bit unsigned integer in native byte order to serialize in little endian representation. |
|
inline |
Function serializing a 64-bit unsigned integer data in little endian representation.
[out] | p | An address where to serialize the 64-bit unsigned integer. |
[in] | i | The 64-bit unsigned integer in native byte order to serialize in little endian representation. |
void ts::PutUInt24BE | ( | void * | p, |
uint32_t | i | ||
) |
Function serializing a 24-bit unsigned integer data in big endian representation.
[out] | p | An address where to serialize the 24-bit unsigned integer. |
[in] | i | The 24-bit unsigned integer in native byte order to serialize in big endian representation. |
void ts::PutUInt24LE | ( | void * | p, |
uint32_t | i | ||
) |
Function serializing a 24-bit unsigned integer data in little endian representation.
[out] | p | An address where to serialize the 24-bit unsigned integer. |
[in] | i | The 24-bit unsigned integer in native byte order to serialize in little endian representation. |
void ts::PutUInt40BE | ( | void * | p, |
uint64_t | i | ||
) |
Function serializing a 40-bit unsigned integer data in big endian representation.
[out] | p | An address where to serialize the 40-bit unsigned integer. |
[in] | i | The 40-bit unsigned integer in native byte order to serialize in big endian representation. |
void ts::PutUInt40LE | ( | void * | p, |
uint64_t | i | ||
) |
Function serializing a 40-bit unsigned integer data in little endian representation.
[out] | p | An address where to serialize the 40-bit unsigned integer. |
[in] | i | The 40-bit unsigned integer in native byte order to serialize in little endian representation. |
void ts::PutUInt48BE | ( | void * | p, |
uint64_t | i | ||
) |
Function serializing a 48-bit unsigned integer data in big endian representation.
[out] | p | An address where to serialize the 48-bit unsigned integer. |
[in] | i | The 48-bit unsigned integer in native byte order to serialize in big endian representation. |
void ts::PutUInt48LE | ( | void * | p, |
uint64_t | i | ||
) |
Function serializing a 48-bit unsigned integer data in little endian representation.
[out] | p | An address where to serialize the 48-bit unsigned integer. |
[in] | i | The 48-bit unsigned integer in native byte order to serialize in little endian representation. |
|
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.
[in] | p | An address pointing to an 8-bit unsigned integer. |
|
inline |
Function getting a 16-bit unsigned integer from serialized data in big endian representation.
[in] | p | An address pointing to a 16-bit unsigned integer in big endian representation. |
|
inline |
Function getting a 24-bit unsigned integer from serialized data in big endian representation.
[in] | p | An address pointing to a 24-bit unsigned integer in big endian representation. |
|
inline |
Function getting a 32-bit unsigned integer from serialized data in big endian representation.
[in] | p | An address pointing to a 32-bit unsigned integer in big endian representation. |
|
inline |
Function getting a 40-bit unsigned integer from serialized data in big endian representation.
[in] | p | An address pointing to a 40-bit unsigned integer in big endian representation. |
|
inline |
Function getting a 48-bit unsigned integer from serialized data in big endian representation.
[in] | p | An address pointing to a 48-bit unsigned integer in big endian representation. |
|
inline |
Function getting a 64-bit unsigned integer from serialized data in big endian representation.
[in] | p | An address pointing to a 64-bit unsigned integer in big endian representation. |
|
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.
[in] | p | An address pointing to an 8-bit signed integer. |
|
inline |
Function getting a 16-bit signed integer from serialized data in big endian representation.
[in] | p | An address pointing to a 16-bit signed integer in big endian representation. |
|
inline |
Function getting a 24-bit signed integer from serialized data in big endian representation.
[in] | p | An address pointing to a 24-bit signed integer in big endian representation. |
|
inline |
Function getting a 32-bit signed integer from serialized data in big endian representation.
[in] | p | An address pointing to a 32-bit signed integer in big endian representation. |
|
inline |
Function getting a 64-bit signed integer from serialized data in big endian representation.
[in] | p | An address pointing to a 64-bit signed integer in big endian representation. |
|
inline |
Function getting a 16-bit signed integer from serialized data in big endian representation.
[in] | p | An address pointing to a 16-bit signed integer in big endian representation. |
|
inline |
Function getting a 24-bit signed integer from serialized data in big endian representation.
[in] | p | An address pointing to a 24-bit signed integer in big endian representation. |
|
inline |
Function getting a 32-bit signed integer from serialized data in big endian representation.
[in] | p | An address pointing to a 32-bit signed integer in big endian representation. |
|
inline |
Function getting a 40-bit signed integer from serialized data in big endian representation.
[in] | p | An address pointing to a 40-bit signed integer in big endian representation. |
|
inline |
Function getting a 48-bit signed integer from serialized data in big endian representation.
[in] | p | An address pointing to a 48-bit signed integer in big endian representation. |
|
inline |
Function getting a 64-bit signed integer from serialized data in big endian representation.
[in] | p | An address pointing to a 64-bit signed integer in big endian representation. |
|
inline |
Function getting a 16-bit signed integer from serialized data in little endian representation.
[in] | p | An address pointing to a 16-bit signed integer in little endian representation. |
|
inline |
Function getting a 24-bit signed integer from serialized data in little endian representation.
[in] | p | An address pointing to a 24-bit signed integer in little endian representation. |
|
inline |
Function getting a 32-bit signed integer from serialized data in little endian representation.
[in] | p | An address pointing to a 32-bit signed integer in little endian representation. |
|
inline |
Function getting a 40-bit signed integer from serialized data in little endian representation.
[in] | p | An address pointing to a 40-bit signed integer in little endian representation. |
|
inline |
Function getting a 48-bit signed integer from serialized data in little endian representation.
[in] | p | An address pointing to a 48-bit signed integer in little endian representation. |
|
inline |
Function getting a 64-bit signed integer from serialized data in little endian representation.
[in] | p | An address pointing to a 64-bit signed integer in little endian representation. |
|
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.
[in] | p | An address pointing to an 8-bit unsigned integer. |
[out] | i | The 8-bit unsigned integer at p. |
|
inline |
Function getting a 16-bit unsigned integer from serialized data in big endian representation.
[in] | p | An address pointing to a 16-bit unsigned integer in big endian representation. |
[out] | i | The 16-bit unsigned integer in native byte order, deserialized from p. |
|
inline |
Function getting a 24-bit unsigned integer from serialized data in big endian representation.
[in] | p | An address pointing to a 24-bit unsigned integer in big endian representation. |
[out] | i | The 32-bit unsigned integer in native byte order, deserialized from p. |
|
inline |
Function getting a 32-bit unsigned integer from serialized data in big endian representation.
[in] | p | An address pointing to a 32-bit unsigned integer in big endian representation. |
[out] | i | The 32-bit unsigned integer in native byte order, deserialized from p. |
|
inline |
Function getting a 40-bit unsigned integer from serialized data in big endian representation.
[in] | p | An address pointing to a 40-bit unsigned integer in big endian representation. |
[out] | i | The 64-bit unsigned integer in native byte order, deserialized from p. |
|
inline |
Function getting a 48-bit unsigned integer from serialized data in big endian representation.
[in] | p | An address pointing to a 48-bit unsigned integer in big endian representation. |
[out] | i | The 64-bit unsigned integer in native byte order, deserialized from p. |
|
inline |
Function getting a 64-bit unsigned integer from serialized data in big endian representation.
[in] | p | An address pointing to a 64-bit unsigned integer in big endian representation. |
[out] | i | The 64-bit unsigned integer in native byte order, deserialized from p. |
|
inline |
Function getting a 16-bit unsigned integer from serialized data in big endian representation.
[in] | p | An address pointing to a 16-bit unsigned integer in big endian representation. |
[out] | i | The 16-bit unsigned integer in native byte order, deserialized from p. |
|
inline |
Function getting a 24-bit unsigned integer from serialized data in big endian representation.
[in] | p | An address pointing to a 24-bit unsigned integer in big endian representation. |
[out] | i | The 32-bit unsigned integer in native byte order, deserialized from p. |
|
inline |
Function getting a 32-bit unsigned integer from serialized data in big endian representation.
[in] | p | An address pointing to a 32-bit unsigned integer in big endian representation. |
[out] | i | The 32-bit unsigned integer in native byte order, deserialized from p. |
|
inline |
Function getting a 64-bit unsigned integer from serialized data in big endian representation.
[in] | p | An address pointing to a 64-bit unsigned integer in big endian representation. |
[out] | i | The 64-bit unsigned integer in native byte order, deserialized from p. |
|
inline |
Function getting a 16-bit unsigned integer from serialized data in little endian representation.
[in] | p | An address pointing to a 16-bit unsigned integer in little endian representation. |
[out] | i | The 16-bit unsigned integer in native byte order, deserialized from p. |
|
inline |
Function getting a 24-bit unsigned integer from serialized data in little endian representation.
[in] | p | An address pointing to a 24-bit unsigned integer in little endian representation. |
[out] | i | The 24-bit unsigned integer in native byte order, deserialized from p. |
|
inline |
Function getting a 32-bit unsigned integer from serialized data in little endian representation.
[in] | p | An address pointing to a 32-bit unsigned integer in little endian representation. |
[out] | i | The 32-bit unsigned integer in native byte order, deserialized from p. |
|
inline |
Function getting a 64-bit unsigned integer from serialized data in little endian representation.
[in] | p | An address pointing to a 64-bit unsigned integer in little endian representation. |
[out] | i | The 64-bit unsigned integer in native byte order, deserialized from 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.
[in] | p | An address pointing to an 8-bit signed integer. |
[out] | i | The 8-bit signed integer at p. |
|
inline |
Function getting a 16-bit signed integer from serialized data in big endian representation.
[in] | p | An address pointing to a 16-bit signed integer in big endian representation. |
[out] | i | The 16-bit signed integer in native byte order, deserialized from p. |
|
inline |
Function getting a 24-bit signed integer from serialized data in big endian representation.
[in] | p | An address pointing to a 24-bit signed integer in big endian representation. |
[out] | i | The 24-bit signed integer in native byte order, deserialized from p. |
|
inline |
Function getting a 32-bit signed integer from serialized data in big endian representation.
[in] | p | An address pointing to a 32-bit signed integer in big endian representation. |
[out] | i | The 32-bit signed integer in native byte order, deserialized from p. |
|
inline |
Function getting a 64-bit signed integer from serialized data in big endian representation.
[in] | p | An address pointing to a 64-bit signed integer in big endian representation. |
[out] | i | The 64-bit signed integer in native byte order, deserialized from p. |
|
inline |
Function getting a 16-bit signed integer from serialized data in big endian representation.
[in] | p | An address pointing to a 16-bit signed integer in big endian representation. |
[out] | i | The 16-bit signed integer in native byte order, deserialized from p. |
|
inline |
Function getting a 24-bit signed integer from serialized data in big endian representation.
[in] | p | An address pointing to a 24-bit signed integer in big endian representation. |
[out] | i | The 24-bit signed integer in native byte order, deserialized from p. |
|
inline |
Function getting a 32-bit signed integer from serialized data in big endian representation.
[in] | p | An address pointing to a 32-bit signed integer in big endian representation. |
[out] | i | The 32-bit signed integer in native byte order, deserialized from p. |
|
inline |
Function getting a 64-bit signed integer from serialized data in big endian representation.
[in] | p | An address pointing to a 64-bit signed integer in big endian representation. |
[out] | i | The 64-bit signed integer in native byte order, deserialized from p. |
|
inline |
Function getting a 16-bit signed integer from serialized data in little endian representation.
[in] | p | An address pointing to a 16-bit signed integer in little endian representation. |
[out] | i | The 16-bit signed integer in native byte order, deserialized from p. |
|
inline |
Function getting a 24-bit signed integer from serialized data in little endian representation.
[in] | p | An address pointing to a 24-bit signed integer in little endian representation. |
[out] | i | The 32-bit signed integer in native byte order, deserialized from p. |
|
inline |
Function getting a 32-bit signed integer from serialized data in little endian representation.
[in] | p | An address pointing to a 32-bit signed integer in little endian representation. |
[out] | i | The 32-bit signed integer in native byte order, deserialized from p. |
|
inline |
Function getting a 64-bit signed integer from serialized data in little endian representation.
[in] | p | An address pointing to a 64-bit signed integer in little endian representation. |
[out] | i | The 64-bit signed integer in native byte order, deserialized from p. |
|
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.
[out] | p | An address where to serialize the 8-bit unsigned integer. |
[in] | i | The 8-bit unsigned integer to serialize. |
|
inline |
Function serializing a 16-bit unsigned integer data in big endian representation.
[out] | p | An address where to serialize the 16-bit unsigned integer. |
[in] | i | The 16-bit unsigned integer in native byte order to serialize in big endian representation. |
|
inline |
Function serializing a 24-bit unsigned integer data in big endian representation.
[out] | p | An address where to serialize the 24-bit unsigned integer. |
[in] | i | The 24-bit unsigned integer in native byte order to serialize in big endian representation. |
|
inline |
Function serializing a 32-bit unsigned integer data in big endian representation.
[out] | p | An address where to serialize the 32-bit unsigned integer. |
[in] | i | The 32-bit unsigned integer in native byte order to serialize in big endian representation. |
|
inline |
Function serializing a 40-bit unsigned integer data in big endian representation.
[out] | p | An address where to serialize the 40-bit unsigned integer. |
[in] | i | The 40-bit unsigned integer in native byte order to serialize in big endian representation. |
|
inline |
Function serializing a 48-bit unsigned integer data in big endian representation.
[out] | p | An address where to serialize the 48-bit unsigned integer. |
[in] | i | The 48-bit unsigned integer in native byte order to serialize in big endian representation. |
|
inline |
Function serializing a 64-bit unsigned integer data in big endian representation.
[out] | p | An address where to serialize the 64-bit unsigned integer. |
[in] | i | The 64-bit unsigned integer in native byte order to serialize in big endian representation. |
|
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.
[out] | p | An address where to serialize the 8-bit signed integer. |
[in] | i | The 8-bit signed integer to serialize. |
|
inline |
Function serializing a 16-bit signed integer data in big endian representation.
[out] | p | An address where to serialize the 16-bit signed integer. |
[in] | i | The 16-bit signed integer in native byte order to serialize in big endian representation. |
|
inline |
Function serializing a 24-bit signed integer data in big endian representation.
[out] | p | An address where to serialize the 24-bit signed integer. |
[in] | i | The 32-bit signed integer in native byte order to serialize in big endian representation. |
|
inline |
Function serializing a 32-bit signed integer data in big endian representation.
[out] | p | An address where to serialize the 32-bit signed integer. |
[in] | i | The 32-bit signed integer in native byte order to serialize in big endian representation. |
|
inline |
Function serializing a 64-bit signed integer data in big endian representation.
[out] | p | An address where to serialize the 64-bit signed integer. |
[in] | i | The 64-bit signed integer in native byte order to serialize in big endian representation. |
|
inline |
Function serializing a 16-bit signed integer data in big endian representation.
[out] | p | An address where to serialize the 16-bit signed integer. |
[in] | i | The 16-bit signed integer in native byte order to serialize in big endian representation. |
|
inline |
Function serializing a 24-bit signed integer data in big endian representation.
[out] | p | An address where to serialize the 24-bit signed integer. |
[in] | i | The 32-bit signed integer in native byte order to serialize in big endian representation. |
|
inline |
Function serializing a 32-bit signed integer data in big endian representation.
[out] | p | An address where to serialize the 32-bit signed integer. |
[in] | i | The 32-bit signed integer in native byte order to serialize in big endian representation. |
|
inline |
Function serializing a 40-bit signed integer data in big endian representation.
[out] | p | An address where to serialize the 40-bit signed integer. |
[in] | i | The 64-bit signed integer in native byte order to serialize in big endian representation. |
|
inline |
Function serializing a 48-bit signed integer data in big endian representation.
[out] | p | An address where to serialize the 48-bit signed integer. |
[in] | i | The 64-bit signed integer in native byte order to serialize in big endian representation. |
|
inline |
Function serializing a 64-bit signed integer data in big endian representation.
[out] | p | An address where to serialize the 64-bit signed integer. |
[in] | i | The 64-bit signed integer in native byte order to serialize in big endian representation. |
|
inline |
Function serializing a 16-bit signed integer data in little endian representation.
[out] | p | An address where to serialize the 16-bit signed integer. |
[in] | i | The 16-bit signed integer in native byte order to serialize in little endian representation. |
|
inline |
Function serializing a 24-bit signed integer data in little endian representation.
[out] | p | An address where to serialize the 24-bit signed integer. |
[in] | i | The 32-bit signed integer in native byte order to serialize in little endian representation. |
|
inline |
Function serializing a 32-bit signed integer data in little endian representation.
[out] | p | An address where to serialize the 32-bit signed integer. |
[in] | i | The 32-bit signed integer in native byte order to serialize in little endian representation. |
|
inline |
Function serializing a 40-bit signed integer data in little endian representation.
[out] | p | An address where to serialize the 40-bit signed integer. |
[in] | i | The 64-bit signed integer in native byte order to serialize in little endian representation. |
|
inline |
Function serializing a 48-bit signed integer data in little endian representation.
[out] | p | An address where to serialize the 48-bit signed integer. |
[in] | i | The 64-bit signed integer in native byte order to serialize in little endian representation. |
|
inline |
Function serializing a 64-bit signed integer data in little endian representation.
[out] | p | An address where to serialize the 64-bit signed integer. |
[in] | i | The 64-bit signed integer in native byte order to serialize in little endian representation. |
|
inline |
|
inline |
|
inline |
INT ts::GetIntVarBE | ( | const void * | p, |
size_t | size | ||
) |
Template function getting a variable-length integer from serialized data in big endian representation.
INT | Some integer type. |
[in] | p | An address pointing to an INT in big endian representation. |
[in] | size | Size in bytes of the integer. Must be 1 to 8. |
INT ts::GetIntVarLE | ( | const void * | p, |
size_t | size | ||
) |
Template function getting a variable-length integer from serialized data in little endian representation.
INT | Some integer type. |
[in] | p | An address pointing to an INT in little endian representation. |
[in] | size | Size in bytes of the integer. Must be 1 to 8. |
|
inline |
Template function getting a variable-length integer from serialized data in big endian representation.
INT | Some integer type. |
|
inline |
Template function getting a variable-length integer from serialized data in little endian representation.
INT | Some integer type. |
|
inline |
Template function serializing a variable-length integer data in big endian representation.
INT | Some integer type. |
[out] | p | An address where to serialize the integer. |
[in] | size | Size in bytes of the integer. Must be 1 to 8. |
[in] | i | The INT in native byte order to serialize in big endian representation. |
|
inline |
Template function serializing a variable-length integer data in little endian representation.
INT | Some integer type. |
[out] | p | An address where to serialize the integer. |
[in] | size | Size in bytes of the integer. Must be 1 to 8. |
[in] | i | The INT in native byte order to serialize in little endian representation. |
|
inline |
Template function getting a variable-length integer from serialized data in big endian representation.
INT | Some integer type. |
[in] | p | An address pointing to an INT in big endian representation. |
[in] | size | Size in bytes of the integer. Must be 1 to 8. |
|
inline |
Template function getting a variable-length integer from serialized data in big endian representation.
INT | Some integer type. |
|
inline |
Template function serializing a variable-length integer data in big endian representation.
INT | Some integer type. |
[out] | p | An address where to serialize the integer. |
[in] | size | Size in bytes of the integer. Must be 1 to 8. |
[in] | i | The INT in native byte order to serialize in big endian representation. |
uint32_t ts::UCharacteristics | ( | UChar | c | ) |
Get the characteristics of a character.
[in] | c | A character. |
|
inline |
Check if a character is a space.
[in] | c | A character. |
|
inline |
Check if a character is printable according to the current C locale.
[in] | c | A character. |
|
inline |
Check if a character is a letter.
[in] | c | A character. |
|
inline |
Check if a character is a decimal digit.
[in] | c | A character. |
|
inline |
Check if a character is alphanumerical.
[in] | c | A character. |
|
inline |
Check if a character is an hexadecimal digit.
[in] | c | A character. |
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.
[in] | c | A character to convert. |
[in] | base | The base of the integer representation, must be in the range 2 to 36. |
[in] | defaultValue | The value to return on invalid character. |
bool ts::IsLower | ( | UChar | c | ) |
Check if a character is a lower case letter.
[in] | c | A character. |
bool ts::IsUpper | ( | UChar | c | ) |
Check if a character is an upper case letter.
[in] | c | A character. |
Convert a character to lowercase.
[in] | c | A character to convert to lowercase. |
Convert a character to uppercase.
[in] | c | A character to convert to uppercase. |
bool ts::Match | ( | UChar | c1, |
UChar | c2, | ||
CaseSensitivity | cs | ||
) |
Check two characters match, case sensitive or insensitive.
[in] | c1 | First character. |
[in] | c2 | Second character. |
[in] | cs | Case sensitivity of the comparision. |
bool ts::IsAccented | ( | UChar | c | ) |
Check if a character contains an accent.
[in] | c | A character. |
Remove all forms of accent or composition from a character.
[in] | c | A character. |
|
inline |
Check if a character is a combining diacritical character.
Such a character, when printed, is combined with the preceding character.
[in] | c | A character. |
|
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.
[in] | c | A character. |
|
inline |
Check if a character is a "trailing surrogate" value.
[in] | c | A character. |
|
inline |
Check if a 32-bit Unicode code point needs a surrogate pair in UTF-16 representation.
[in] | cp | A 32-bit Unicode code point. |
|
inline |
Compute the first part of the surrogate pair of a 32-bit Unicode code point (which needs a surrogate pair).
[in] | cp | A 32-bit Unicode code point. |
|
inline |
Compute the second part of the surrogate pair of a 32-bit Unicode code point (which needs a surrogate pair).
[in] | cp | A 32-bit Unicode code point. |
Build a 32-bit Unicode code point from a surrogate pair.
[in] | lead | First part of the surrogate pair. |
[in] | trail | Second part of the surrogate pair. |
Convert a character into its corresponding HTML sequence.
[in] | c | A character. |
Convert the body on an HTML entity into a character.
[in] | entity | The body on an HTML entity (e.g. "amp" for sequence "\&"). |
Build a precombined character from its base letter and non-spacing diacritical mark.
[in] | letter | The base letter. |
[in] | mark | The non-spacing diacritical mark. |
Decompose a precombined character into its base letter and non-spacing diacritical mark.
[in] | c | A character. |
[out] | letter | The base letter for c. |
[out] | mark | The non-spacing diacritical mark for c. |
|
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.
|
constexpr |
A "false" expression which is built from a template type T.
T | A 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.
|
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.