Botcraft 1.21.4
Loading...
Searching...
No Matches
BinaryReadWrite.hpp File Reference
#include "protocolCraft/Utilities/Templates.hpp"
#include <algorithm>
#include <array>
#include <cstring>
#include <functional>
#include <stdexcept>
#include <string>
#include <type_traits>

Go to the source code of this file.

Namespaces

namespace  ProtocolCraft
 
namespace  ProtocolCraft::Internal
 

Typedefs

using ProtocolCraft::ReadIterator = std::vector< unsigned char >::const_iterator
 
using ProtocolCraft::WriteContainer = std::vector< unsigned char >
 
using ProtocolCraft::UUID = std::array< unsigned char, 16 >
 
using ProtocolCraft::VarInt = VarType< int >
 
using ProtocolCraft::VarLong = VarType< long long int >
 

Functions

std::string ProtocolCraft::ReadRawString (ReadIterator &iter, size_t &length, const size_t size)
 
void ProtocolCraft::WriteRawString (const std::string &s, WriteContainer &container)
 
std::vector< unsigned char > ProtocolCraft::ReadByteArray (ReadIterator &iter, size_t &length, const size_t desired_length)
 
void ProtocolCraft::WriteByteArray (const std::vector< unsigned char > &my_array, WriteContainer &container)
 
void ProtocolCraft::WriteByteArray (const unsigned char *data, const size_t length, WriteContainer &container)
 
template<typename T >
ProtocolCraft::Internal::ChangeEndianness (const T &in)
 
template<typename StorageType , typename SerializationType >
StorageType ProtocolCraft::ReadData (ReadIterator &iter, size_t &length)
 
template<typename T >
Internal::SerializedType< T >::storage_type ProtocolCraft::ReadData (ReadIterator &iter, size_t &length)
 
template<typename StorageType , typename SerializationType >
void ProtocolCraft::WriteData (typename std::conditional_t< std::is_arithmetic_v< StorageType >||std::is_enum_v< StorageType >, StorageType, const StorageType & > value, WriteContainer &container)
 
template<typename T >
void ProtocolCraft::WriteData (std::conditional_t< std::is_arithmetic_v< typename Internal::SerializedType< T >::storage_type >||std::is_enum_v< typename Internal::SerializedType< T >::storage_type >, typename Internal::SerializedType< T >::storage_type, const typename Internal::SerializedType< T >::storage_type & > value, WriteContainer &container)