QtBase  v6.3.1
Classes | Typedefs | Functions
qendian.h File Reference
#include <QtCore/qfloat16.h>
#include <QtCore/qglobal.h>
#include <limits>
#include <stdlib.h>
#include <string.h>
Include dependency graph for qendian.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  QSpecialInteger< S >
 
class  QLittleEndianStorageType< T >
 
class  QBigEndianStorageType< T >
 
class  QTypeInfo< QLEInteger< T > >
 
class  QTypeInfo< QBEInteger< T > >
 

Typedefs

template<typename T >
using QLEInteger = QSpecialInteger< QLittleEndianStorageType< T > >
 
template<typename T >
using QBEInteger = QSpecialInteger< QBigEndianStorageType< T > >
 
typedef QLEInteger< qint16qint16_le
 
typedef QLEInteger< qint32qint32_le
 
typedef QLEInteger< qint64qint64_le
 
typedef QLEInteger< quint16quint16_le
 
typedef QLEInteger< quint32quint32_le
 
typedef QLEInteger< quint64quint64_le
 
typedef QBEInteger< qint16qint16_be
 
typedef QBEInteger< qint32qint32_be
 
typedef QBEInteger< qint64qint64_be
 
typedef QBEInteger< quint16quint16_be
 
typedef QBEInteger< quint32quint32_be
 
typedef QBEInteger< quint64quint64_be
 

Functions

template<typename T >
QT_BEGIN_NAMESPACE Q_ALWAYS_INLINE void qToUnaligned (const T src, void *dest)
 
template<typename T >
Q_ALWAYS_INLINE T qFromUnaligned (const void *src)
 The <QtEndian> header provides functions to convert between little and big endian representations of numbers. More...
 
constexpr quint64 qbswap_helper (quint64 source)
 
constexpr quint32 qbswap_helper (quint32 source)
 
constexpr quint16 qbswap_helper (quint16 source)
 
constexpr quint8 qbswap_helper (quint8 source)
 
template<typename T , typename = std::enable_if_t<std::is_integral_v<T>>>
constexpr T qbswap (T source)
 
template<typename Float >
Float qbswapFloatHelper (Float source)
 
qfloat16 qbswap (qfloat16 source)
 
float qbswap (float source)
 
double qbswap (double source)
 
template<typename T >
void qbswap (const T src, void *dest)
 
template<int Size>
voidqbswap (const void *source, qsizetype count, void *dest) noexcept
 
template<>
voidqbswap< 1 > (const void *source, qsizetype count, void *dest) noexcept
 
template<>
Q_CORE_EXPORT voidqbswap< 2 > (const void *source, qsizetype count, void *dest) noexcept
 
template<>
Q_CORE_EXPORT voidqbswap< 4 > (const void *source, qsizetype count, void *dest) noexcept
 
template<>
Q_CORE_EXPORT voidqbswap< 8 > (const void *source, qsizetype count, void *dest) noexcept
 
template<typename T >
constexpr T qToBigEndian (T source)
 
template<typename T >
constexpr T qFromBigEndian (T source)
 
template<typename T >
constexpr T qToLittleEndian (T source)
 
template<typename T >
constexpr T qFromLittleEndian (T source)
 
template<typename T >
void qToBigEndian (T src, void *dest)
 
template<typename T >
void qToLittleEndian (T src, void *dest)
 
template<typename T >
void qToBigEndian (const void *source, qsizetype count, void *dest)
 
template<typename T >
void qToLittleEndian (const void *source, qsizetype count, void *dest)
 
template<typename T >
void qFromBigEndian (const void *source, qsizetype count, void *dest)
 
template<typename T >
void qFromLittleEndian (const void *source, qsizetype count, void *dest)
 
template<typename T >
T qFromLittleEndian (const void *src)
 
template<>
quint8 qFromLittleEndian< quint8 > (const void *src)
 
template<>
qint8 qFromLittleEndian< qint8 > (const void *src)
 
template<class T >
T qFromBigEndian (const void *src)
 
template<>
quint8 qFromBigEndian< quint8 > (const void *src)
 
template<>
qint8 qFromBigEndian< qint8 > (const void *src)
 

Typedef Documentation

◆ QBEInteger

template<typename T >
template< typename T > QBEInteger::QBEInteger

Constructs a QBEInteger with the given value.

Definition at line 397 of file qendian.h.

◆ qint16_be

Definition at line 414 of file qendian.h.

◆ qint16_le

Definition at line 407 of file qendian.h.

◆ qint32_be

Definition at line 415 of file qendian.h.

◆ qint32_le

Definition at line 408 of file qendian.h.

◆ qint64_be

Definition at line 416 of file qendian.h.

◆ qint64_le

Definition at line 409 of file qendian.h.

◆ QLEInteger

template<typename T >
template< typename T > QLEInteger::QLEInteger

Constructs a QLEInteger with the given value.

Definition at line 394 of file qendian.h.

◆ quint16_be

Definition at line 417 of file qendian.h.

◆ quint16_le

Definition at line 410 of file qendian.h.

◆ quint32_be

Definition at line 418 of file qendian.h.

◆ quint32_le

Definition at line 411 of file qendian.h.

◆ quint64_be

Definition at line 419 of file qendian.h.

◆ quint64_le

Definition at line 412 of file qendian.h.

Function Documentation

◆ qbswap() [1/6]

template<typename T >
void qbswap ( const T  src,
void dest 
)
inline

Definition at line 171 of file qendian.h.

Here is the call graph for this function:

◆ qbswap() [2/6]

template<int Size>
void* qbswap ( const void source,
qsizetype  count,
void dest 
)
noexcept

◆ qbswap() [3/6]

double qbswap ( double  source)
inline

Definition at line 160 of file qendian.h.

Here is the call graph for this function:

◆ qbswap() [4/6]

float qbswap ( float  source)
inline

Definition at line 155 of file qendian.h.

Here is the call graph for this function:

◆ qbswap() [5/6]

qfloat16 qbswap ( qfloat16  source)
inline

Definition at line 150 of file qendian.h.

Here is the call graph for this function:

◆ qbswap() [6/6]

template<typename T , typename = std::enable_if_t<std::is_integral_v<T>>>
constexpr T qbswap ( T  source)
inlineconstexpr

Definition at line 135 of file qendian.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ qbswap< 1 >()

template<>
void* qbswap< 1 > ( const void source,
qsizetype  count,
void dest 
)
inlinenoexcept

Definition at line 177 of file qendian.h.

◆ qbswap< 2 >()

template<>
Q_CORE_EXPORT void* qbswap< 2 > ( const void source,
qsizetype  count,
void dest 
)
noexcept

Definition at line 896 of file qendian.cpp.

◆ qbswap< 4 >()

template<>
Q_CORE_EXPORT void* qbswap< 4 > ( const void source,
qsizetype  count,
void dest 
)
noexcept

Definition at line 905 of file qendian.cpp.

◆ qbswap< 8 >()

template<>
Q_CORE_EXPORT void* qbswap< 8 > ( const void source,
qsizetype  count,
void dest 
)
noexcept

Definition at line 914 of file qendian.cpp.

◆ qbswap_helper() [1/4]

constexpr quint16 qbswap_helper ( quint16  source)
inlineconstexpr

Definition at line 116 of file qendian.h.

◆ qbswap_helper() [2/4]

constexpr quint32 qbswap_helper ( quint32  source)
inlineconstexpr

Definition at line 107 of file qendian.h.

◆ qbswap_helper() [3/4]

constexpr quint64 qbswap_helper ( quint64  source)
inlineconstexpr

Definition at line 94 of file qendian.h.

Here is the caller graph for this function:

◆ qbswap_helper() [4/4]

constexpr quint8 qbswap_helper ( quint8  source)
inlineconstexpr

Definition at line 123 of file qendian.h.

◆ qbswapFloatHelper()

template<typename Float >
Float qbswapFloatHelper ( Float  source)

Definition at line 142 of file qendian.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ qFromBigEndian() [1/3]

template<typename T >
void qFromBigEndian ( const void source,
qsizetype  count,
void dest 
)
inline

Definition at line 204 of file qendian.h.

◆ qFromBigEndian() [2/3]

template<class T >
T qFromBigEndian ( const void src)
inline

Definition at line 253 of file qendian.h.

Here is the call graph for this function:

◆ qFromBigEndian() [3/3]

template<typename T >
constexpr T qFromBigEndian ( T  source)
inlineconstexpr

Definition at line 189 of file qendian.h.

Here is the caller graph for this function:

◆ qFromBigEndian< qint8 >()

template<>
qint8 qFromBigEndian< qint8 > ( const void src)
inline

Definition at line 260 of file qendian.h.

◆ qFromBigEndian< quint8 >()

template<>
quint8 qFromBigEndian< quint8 > ( const void src)
inline

Definition at line 258 of file qendian.h.

◆ qFromLittleEndian() [1/3]

template<typename T >
void qFromLittleEndian ( const void source,
qsizetype  count,
void dest 
)
inline

Definition at line 206 of file qendian.h.

◆ qFromLittleEndian() [2/3]

template<typename T >
T qFromLittleEndian ( const void src)
inline

Definition at line 239 of file qendian.h.

Here is the call graph for this function:

◆ qFromLittleEndian() [3/3]

template<typename T >
constexpr T qFromLittleEndian ( T  source)
inlineconstexpr

Definition at line 193 of file qendian.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ qFromLittleEndian< qint8 >()

template<>
qint8 qFromLittleEndian< qint8 > ( const void src)
inline

Definition at line 246 of file qendian.h.

◆ qFromLittleEndian< quint8 >()

template<>
quint8 qFromLittleEndian< quint8 > ( const void src)
inline

Definition at line 244 of file qendian.h.

◆ qFromUnaligned()

template<typename T >
QT_BEGIN_NAMESPACEtemplate< typename T > T qFromUnaligned ( const void ptr)

The <QtEndian> header provides functions to convert between little and big endian representations of numbers.

\inmodule QtCore \title Endian Conversion Functions

Definition at line 79 of file qendian.h.

◆ qToBigEndian() [1/3]

template<typename T >
void qToBigEndian ( const void source,
qsizetype  count,
void dest 
)
inline

Definition at line 200 of file qendian.h.

◆ qToBigEndian() [2/3]

template<typename T >
constexpr T qToBigEndian ( T  source)
inlineconstexpr

Definition at line 187 of file qendian.h.

Here is the caller graph for this function:

◆ qToBigEndian() [3/3]

template<typename T >
void qToBigEndian ( T  src,
void dest 
)
inline

Definition at line 195 of file qendian.h.

◆ qToLittleEndian() [1/3]

template<typename T >
void qToLittleEndian ( const void source,
qsizetype  count,
void dest 
)
inline

Definition at line 202 of file qendian.h.

◆ qToLittleEndian() [2/3]

template<typename T >
constexpr T qToLittleEndian ( T  source)
inlineconstexpr

Definition at line 191 of file qendian.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ qToLittleEndian() [3/3]

template<typename T >
void qToLittleEndian ( T  src,
void dest 
)
inline

Definition at line 197 of file qendian.h.

◆ qToUnaligned()

template<typename T >
template< typename T > void qToUnaligned ( const T  src,
void dest 
)

Definition at line 66 of file qendian.h.