Botcraft 1.21.5
Loading...
Searching...
No Matches
ProtocolCraft::Internal Namespace Reference

Classes

struct  Conditioned
 A type wrapper to conditionally serialize a type. More...
 
struct  CustomType
 
struct  DiffType
 Just a simple type wrapper that will store with T1 and serialize as T2 (can be used for Enum/VarInt for example) More...
 
struct  GetClassFromConditionPtr
 
struct  GetClassFromConditionPtr< bool(C::*)() const >
 
class  PluginLoader
 
class  RecursiveWrapper
 Template magic to have a full type instead of an incomplete one as required for example by std::variant. More...
 
struct  SerializedType
 
struct  SerializedType< Conditioned< T, F, false > >
 
struct  SerializedType< Conditioned< T, F, true > >
 
struct  SerializedType< CustomType< T, R, W, S > >
 
struct  SerializedType< DiffType< T1, T2 > >
 
struct  SerializedType< NBT::UnnamedValue >
 
struct  SerializedType< std::array< T, N > >
 
struct  SerializedType< std::map< K, V > >
 
struct  SerializedType< std::optional< T > >
 
struct  SerializedType< std::pair< T1, T2 > >
 
struct  SerializedType< std::vector< T > >
 
struct  SerializedType< VarType< T > >
 
struct  SerializedType< Vector< T, U > >
 
struct  SerializedType< Vector< T, void, 0 > >
 
struct  SerializedType< Vector< T, void, N > >
 
struct  Vector
 

Typedefs

template<typename ... input_t>
using tuple_cat_t = decltype(std::tuple_cat(std::declval< input_t >()...))
 Concat multiple tuples in one big tuple.
 

Functions

template<typename T >
ChangeEndianness (const T &in)
 
constexpr size_t GetSnakeCaseSize (std::string_view str)
 Get the size of a string_view once converted to snake_case.
 
template<size_t N>
constexpr std::array< char, N > ToSnakeCase (std::string_view str)
 Get a snake_case char array from a string_view.
 
template<size_t N>
constexpr std::string_view ToStringView (const std::array< char, N > &a)
 Convert a std::array of char to string_view.
 
template<std::size_t... indices, class LoopBody >
void loop_impl (std::index_sequence< indices... >, LoopBody &&loop_body)
 
template<std::size_t N, class LoopBody >
void loop (LoopBody &&loop_body)
 
template<typename F >
GetKnownProcAddressImpl (void *hmod, const char *module_name, const char *name, F)
 

Variables

template<size_t N, typename T , template< size_t, typename > typename U, typename = void>
static constexpr size_t field_index = 0
 Default case, see field_index specialization for implementation details.
 
template<typename T , typename Tuple >
constexpr bool tuple_contains_type = false
 
template<typename T , typename Tuple >
constexpr int get_tuple_index = 0
 
template<typename T >
constexpr bool IsArray = false
 
template<typename T >
constexpr bool IsVector = false
 
template<typename T >
constexpr bool IsGenericVector = false
 
template<typename T , typename U , size_t N>
constexpr bool IsGenericVector< Vector< T, U, N > > = true
 
template<typename T >
constexpr bool IsMap = false
 
template<typename T >
constexpr bool IsVarType = false
 
template<typename T >
constexpr bool IsVarType< VarType< T > > = true
 
template<typename T >
constexpr bool IsOptional = false
 
template<typename T >
constexpr bool IsPair = false
 
template<typename T >
constexpr bool IsBitset = false
 
template<typename T >
constexpr bool IsConditioned = false
 
template<typename T , auto C, bool b>
constexpr bool IsConditioned< Conditioned< T, C, b > > = true
 
template<typename T >
constexpr bool IsCustomType = false
 
template<typename T , auto R, auto W, auto S>
constexpr bool IsCustomType< CustomType< T, R, W, S > > = true
 
template<typename T >
constexpr bool IsSharedPtr = false
 
template<typename T >
constexpr bool dependant_false = false
 To be used in constexpr else to fail compilation in a C++ compliant way.
 
constexpr std::string_view plugins_folder = "protocolcraft_plugins"
 Folder in which the protocolCraft plugins will be searched for.
 
PluginObject *(* GetPluginObject )(const char *identifier)=0
 
void(* DestroyPluginObject )(PluginObject *object)=0
 

Typedef Documentation

◆ tuple_cat_t

template<typename ... input_t>
using ProtocolCraft::Internal::tuple_cat_t = typedef decltype(std::tuple_cat( std::declval<input_t>()... ))

Concat multiple tuples in one big tuple.

Template Parameters
...input_tMultiple std::tuple types to concat

Definition at line 45 of file Templates.hpp.

Function Documentation

◆ ChangeEndianness()

template<typename T >
T ProtocolCraft::Internal::ChangeEndianness ( const T &  in)

Definition at line 35 of file BinaryReadWrite.hpp.

Referenced by ProtocolCraft::ReadData(), and ProtocolCraft::WriteData().

◆ GetKnownProcAddressImpl()

template<typename F >
F ProtocolCraft::Internal::GetKnownProcAddressImpl ( void *  hmod,
const char *  module_name,
const char *  name,
 
)

Definition at line 33 of file PluginLoader.cpp.

◆ GetSnakeCaseSize()

constexpr size_t ProtocolCraft::Internal::GetSnakeCaseSize ( std::string_view  str)
constexpr

Get the size of a string_view once converted to snake_case.

Parameters
strstring to convert to snake_case
Returns
Number of characters in the snake_case string

Definition at line 14 of file ConstexprStrProcessing.hpp.

Referenced by ToSnakeCase().

◆ loop()

template<std::size_t N, class LoopBody >
void ProtocolCraft::Internal::loop ( LoopBody &&  loop_body)

Definition at line 64 of file Templates.hpp.

References loop_impl().

◆ loop_impl()

template<std::size_t... indices, class LoopBody >
void ProtocolCraft::Internal::loop_impl ( std::index_sequence< indices... >  ,
LoopBody &&  loop_body 
)

Definition at line 59 of file Templates.hpp.

Referenced by loop().

◆ ToSnakeCase()

template<size_t N>
constexpr std::array< char, N > ProtocolCraft::Internal::ToSnakeCase ( std::string_view  str)
constexpr

Get a snake_case char array from a string_view.

Template Parameters
NSize of the output array, should match GetSnakeCaseSize(str)
Parameters
strString to convert to snake_case
Returns
std::array of the converted string

Definition at line 39 of file ConstexprStrProcessing.hpp.

References GetSnakeCaseSize().

◆ ToStringView()

template<size_t N>
constexpr std::string_view ProtocolCraft::Internal::ToStringView ( const std::array< char, N > &  a)
constexpr

Convert a std::array of char to string_view.

Template Parameters
NSize of the array
Parameters
aarray to convert to string_view
Returns
std::string_view wrapping around a chars

Definition at line 76 of file ConstexprStrProcessing.hpp.

Variable Documentation

◆ dependant_false

template<typename T >
constexpr bool ProtocolCraft::Internal::dependant_false = false
constexpr

To be used in constexpr else to fail compilation in a C++ compliant way.

Template Parameters
TAny type

Definition at line 150 of file Templates.hpp.

◆ DestroyPluginObject

void(* ProtocolCraft::Internal::DestroyPluginObject) (PluginObject *object)=0 ( PluginObject object)

◆ field_index

template<size_t N, typename T , template< size_t, typename > typename U, typename = void>
constexpr size_t ProtocolCraft::Internal::field_index = 0
staticconstexpr

Default case, see field_index specialization for implementation details.

Definition at line 33 of file Templates.hpp.

◆ get_tuple_index

template<typename T , typename Tuple >
constexpr int ProtocolCraft::Internal::get_tuple_index< T, std::tuple< T, Rest... > > = 0
constexpr

Definition at line 53 of file Templates.hpp.

◆ GetPluginObject

PluginObject *(* ProtocolCraft::Internal::GetPluginObject) (const char *identifier)=0 ( const char *  identifier)

◆ IsArray

template<typename T >
constexpr bool ProtocolCraft::Internal::IsArray = false
constexpr

Definition at line 108 of file Templates.hpp.

◆ IsBitset

template<typename T >
constexpr bool ProtocolCraft::Internal::IsBitset< std::bitset< N > > = false
constexpr

Definition at line 122 of file Templates.hpp.

◆ IsConditioned

template<typename T >
constexpr bool ProtocolCraft::Internal::IsConditioned = false
constexpr

Definition at line 124 of file Templates.hpp.

◆ IsConditioned< Conditioned< T, C, b > >

template<typename T , auto C, bool b>
constexpr bool ProtocolCraft::Internal::IsConditioned< Conditioned< T, C, b > > = true
constexpr

Definition at line 125 of file Templates.hpp.

◆ IsCustomType

template<typename T >
constexpr bool ProtocolCraft::Internal::IsCustomType = false
constexpr

Definition at line 126 of file Templates.hpp.

◆ IsCustomType< CustomType< T, R, W, S > >

template<typename T , auto R, auto W, auto S>
constexpr bool ProtocolCraft::Internal::IsCustomType< CustomType< T, R, W, S > > = true
constexpr

Definition at line 127 of file Templates.hpp.

◆ IsGenericVector

template<typename T >
constexpr bool ProtocolCraft::Internal::IsGenericVector = false
constexpr

Definition at line 112 of file Templates.hpp.

◆ IsGenericVector< Vector< T, U, N > >

template<typename T , typename U , size_t N>
constexpr bool ProtocolCraft::Internal::IsGenericVector< Vector< T, U, N > > = true
constexpr

Definition at line 113 of file Templates.hpp.

◆ IsMap

template<typename T >
constexpr bool ProtocolCraft::Internal::IsMap = false
constexpr

Definition at line 114 of file Templates.hpp.

◆ IsOptional

template<typename T >
constexpr bool ProtocolCraft::Internal::IsOptional< std::optional< T > > = false
constexpr

Definition at line 118 of file Templates.hpp.

◆ IsPair

template<typename T >
constexpr bool ProtocolCraft::Internal::IsPair = false
constexpr

Definition at line 120 of file Templates.hpp.

◆ IsSharedPtr

template<typename T >
constexpr bool ProtocolCraft::Internal::IsSharedPtr< std::shared_ptr< T > > = false
constexpr

Definition at line 128 of file Templates.hpp.

◆ IsVarType

template<typename T >
constexpr bool ProtocolCraft::Internal::IsVarType = false
constexpr

Definition at line 116 of file Templates.hpp.

◆ IsVarType< VarType< T > >

template<typename T >
constexpr bool ProtocolCraft::Internal::IsVarType< VarType< T > > = true
constexpr

Definition at line 117 of file Templates.hpp.

◆ IsVector

template<typename T >
constexpr bool ProtocolCraft::Internal::IsVector< std::vector< T > > = false
constexpr

Definition at line 110 of file Templates.hpp.

◆ plugins_folder

constexpr std::string_view ProtocolCraft::Internal::plugins_folder = "protocolcraft_plugins"
constexpr

Folder in which the protocolCraft plugins will be searched for.

Definition at line 22 of file PluginLoader.cpp.

Referenced by ProtocolCraft::Internal::PluginLoader::PluginLoader().

◆ tuple_contains_type

template<typename T , typename Tuple >
constexpr bool ProtocolCraft::Internal::tuple_contains_type< T, std::tuple< Ts... > > = false
constexpr

Definition at line 50 of file Templates.hpp.