C++ Utilities  4.17.0
Useful C++ classes and routines such as argument parser, IO and conversion utilities
Namespaces | Macros | Typedefs | Functions
binaryconversion.h File Reference
#include "./types.h"
#include "../global.h"
#include "./binaryconversionprivate.h"
Include dependency graph for binaryconversion.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 ConversionUtilities
 Contains several functions providing conversions between different data types.
 
 ConversionUtilities::BE
 Encapsulates binary conversion functions using the big endian byte order.
 
 ConversionUtilities::LE
 Encapsulates binary conversion functions using the little endian byte order.
 

Macros

#define CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL   0
 
#define CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL   1
 

Typedefs

typedef std::int8_t ConversionUtilities::BE::sbyte
 signed byte More...
 
typedef std::uint8_t ConversionUtilities::BE::byte
 unsigned byte More...
 
typedef std::int16_t ConversionUtilities::BE::int16
 signed 16-bit integer More...
 
typedef std::int32_t ConversionUtilities::BE::int32
 signed 32-bit integer More...
 
typedef std::int64_t ConversionUtilities::BE::int64
 signed 64-bit integer More...
 
typedef std::intptr_t ConversionUtilities::BE::intptr
 signed pointer More...
 
typedef std::uint16_t ConversionUtilities::BE::uint16
 unsigned 16-bit integer More...
 
typedef std::uint32_t ConversionUtilities::BE::uint32
 unsigned 32-bit integer More...
 
typedef std::uint64_t ConversionUtilities::BE::uint64
 unsigned 64-bit integer More...
 
typedef std::uintptr_t ConversionUtilities::BE::uintptr
 unsigned pointer More...
 

Functions

CPP_UTILITIES_EXPORT constexpr int16 ConversionUtilities::BE::toInt16 (const char *value)
 Returns a 16-bit signed integer converted from two bytes at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT constexpr uint16 ConversionUtilities::BE::toUInt16 (const char *value)
 Returns a 16-bit unsigned integer converted from two bytes at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT constexpr int32 ConversionUtilities::BE::toInt32 (const char *value)
 Returns a 32-bit signed integer converted from four bytes at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT constexpr uint32 ConversionUtilities::BE::toUInt24 (const char *value)
 Returns a 32-bit unsigned integer converted from three bytes at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT constexpr uint32 ConversionUtilities::BE::toUInt32 (const char *value)
 Returns a 32-bit unsigned integer converted from four bytes at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT constexpr int64 ConversionUtilities::BE::toInt64 (const char *value)
 Returns a 64-bit signed integer converted from eight bytes at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT constexpr uint64 ConversionUtilities::BE::toUInt64 (const char *value)
 Returns a 64-bit unsigned integer converted from eight bytes at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT float32 ConversionUtilities::BE::toFloat32 (const char *value)
 Returns a 32-bit floating point number converted from four bytes at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT float64 ConversionUtilities::BE::toFloat64 (const char *value)
 Returns a 64-bit floating point number converted from eight bytes at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT void ConversionUtilities::BE::getBytes (int16 value, char *outputbuffer)
 Stores the specified 16-bit signed integer value at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT void ConversionUtilities::BE::getBytes (uint16 value, char *outputbuffer)
 Stores the specified 16-bit unsigned integer value at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT void ConversionUtilities::BE::getBytes24 (uint32 value, char *outputbuffer)
 Stores the specified 24-bit unsigned integer value at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT void ConversionUtilities::BE::getBytes (int32 value, char *outputbuffer)
 Stores the specified 32-bit signed integer value at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT void ConversionUtilities::BE::getBytes (uint32 value, char *outputbuffer)
 Stores the specified 32-bit signed integer value at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT void ConversionUtilities::BE::getBytes (int64 value, char *outputbuffer)
 Stores the specified 64-bit signed integer value at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT void ConversionUtilities::BE::getBytes (uint64 value, char *outputbuffer)
 Stores the specified 64-bit unsigned integer value at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT void ConversionUtilities::BE::getBytes (float32 value, char *outputbuffer)
 Stores the specified 32-bit floating point value at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT void ConversionUtilities::BE::getBytes (float64 value, char *outputbuffer)
 Stores the specified 64-bit floating point value at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT constexpr int16 ConversionUtilities::LE::toInt16 (const char *value)
 Returns a 16-bit signed integer converted from two bytes at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT constexpr uint16 ConversionUtilities::LE::toUInt16 (const char *value)
 Returns a 16-bit unsigned integer converted from two bytes at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT constexpr int32 ConversionUtilities::LE::toInt32 (const char *value)
 Returns a 32-bit signed integer converted from four bytes at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT constexpr uint32 ConversionUtilities::LE::toUInt24 (const char *value)
 Returns a 32-bit unsigned integer converted from three bytes at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT constexpr uint32 ConversionUtilities::LE::toUInt32 (const char *value)
 Returns a 32-bit unsigned integer converted from four bytes at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT constexpr int64 ConversionUtilities::LE::toInt64 (const char *value)
 Returns a 64-bit signed integer converted from eight bytes at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT constexpr uint64 ConversionUtilities::LE::toUInt64 (const char *value)
 Returns a 64-bit unsigned integer converted from eight bytes at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT float32 ConversionUtilities::LE::toFloat32 (const char *value)
 Returns a 32-bit floating point number converted from four bytes at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT float64 ConversionUtilities::LE::toFloat64 (const char *value)
 Returns a 64-bit floating point number converted from eight bytes at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT void ConversionUtilities::LE::getBytes (int16 value, char *outputbuffer)
 Stores the specified 16-bit signed integer value at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT void ConversionUtilities::LE::getBytes (uint16 value, char *outputbuffer)
 Stores the specified 16-bit unsigned integer value at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT void ConversionUtilities::LE::getBytes24 (uint32 value, char *outputbuffer)
 Stores the specified 24-bit unsigned integer value at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT void ConversionUtilities::LE::getBytes (int32 value, char *outputbuffer)
 Stores the specified 32-bit signed integer value at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT void ConversionUtilities::LE::getBytes (uint32 value, char *outputbuffer)
 Stores the specified 32-bit signed integer value at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT void ConversionUtilities::LE::getBytes (int64 value, char *outputbuffer)
 Stores the specified 64-bit signed integer value at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT void ConversionUtilities::LE::getBytes (uint64 value, char *outputbuffer)
 Stores the specified 64-bit unsigned integer value at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT void ConversionUtilities::LE::getBytes (float32 value, char *outputbuffer)
 Stores the specified 32-bit floating point value at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT void ConversionUtilities::LE::getBytes (float64 value, char *outputbuffer)
 Stores the specified 64-bit floating point value at a specified position in a char array. More...
 
CPP_UTILITIES_EXPORT constexpr uint16 ConversionUtilities::toFixed8 (float32 float32value)
 Returns the 8.8 fixed point representation converted from the specified 32-bit floating point number. More...
 
CPP_UTILITIES_EXPORT constexpr float32 ConversionUtilities::toFloat32 (uint16 fixed8value)
 Returns a 32-bit floating point number converted from the specified 8.8 fixed point representation. More...
 
CPP_UTILITIES_EXPORT constexpr uint32 ConversionUtilities::toFixed16 (float32 float32value)
 Returns the 16.16 fixed point representation converted from the specified 32-bit floating point number. More...
 
CPP_UTILITIES_EXPORT constexpr float32 ConversionUtilities::toFloat32 (uint32 fixed16value)
 Returns a 32-bit floating point number converted from the specified 16.16 fixed point representation. More...
 
CPP_UTILITIES_EXPORT constexpr uint32 ConversionUtilities::toSynchsafeInt (uint32 normalInt)
 Returns a 32-bit synchsafe integer converted from a normal 32-bit integer. More...
 
CPP_UTILITIES_EXPORT constexpr uint32 ConversionUtilities::toNormalInt (uint32 synchsafeInt)
 Returns a normal 32-bit integer converted from a 32-bit synchsafe integer. More...
 
CPP_UTILITIES_EXPORT constexpr uint16 ConversionUtilities::swapOrder (uint16 value)
 Swaps the byte order of the specified 16-bit unsigned integer. More...
 
CPP_UTILITIES_EXPORT constexpr uint32 ConversionUtilities::swapOrder (uint32 value)
 Swaps the byte order of the specified 32-bit unsigned integer. More...
 
CPP_UTILITIES_EXPORT constexpr uint64 ConversionUtilities::swapOrder (uint64 value)
 Swaps the byte order of the specified 64-bit unsigned integer. More...
 

Macro Definition Documentation

◆ CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL [1/2]

#define CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL   0

Definition at line 93 of file binaryconversion.h.

◆ CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL [2/2]

#define CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL   1

Definition at line 93 of file binaryconversion.h.