8#ifndef HPP_ALIB_BOXING_CUSTOMIZATIONS
9#define HPP_ALIB_BOXING_CUSTOMIZATIONS 1
11#if !defined(HPP_ALIB_BOXING_BOXING)
12# error "ALib sources with ending '.inl' must not be included from outside."
24namespace alib {
namespace boxing {
25template<>
struct T_Boxer<void*>
27 using Mapping= TMappedTo<void*>;
28 static constexpr Placeholder Write(
const void* value ) {
return Placeholder( value ); }
29 static void* Read (
const Placeholder& src) {
return const_cast<void*
>( src.VoidPointer() ); }
40namespace alib {
namespace boxing {
41template<
typename TEnum>
struct T_Boxer<TEnum,
ATMP_VOID_IF( std::is_enum<TEnum>::value )>
43 using Mapping= TMappedTo<TEnum>;
45 static constexpr Placeholder
Write( TEnum
const & enumElement )
47 return Placeholder(
static_cast<integer>( enumElement ) );
50 static TEnum
Read(
const Placeholder& src)
52 return TEnum(
static_cast<typename std::underlying_type<TEnum>::type
>( src.GetInteger(0)) );
61DOX_MARKER([DOX_ALIB_BOXING_OPTIMIZE_DECLARE_1])
63DOX_MARKER([DOX_ALIB_BOXING_OPTIMIZE_DECLARE_1])
71#if !ALIB_FEAT_BOXING_BIJECTIVE_INTEGRALS
86 #if ALIB_SIZEOF_INTEGER == 8
92DOX_MARKER([DOX_ALIB_BOXING_CUSTOM_MANUAL])
93namespace alib {
namespace boxing {
95template<>
struct T_Boxer<int16_t>
97 using Mapping= TMappedTo<integer>;
100 Placeholder
Write( int16_t
const & value )
102 return Placeholder(
static_cast<integer>( value ) );
105 static void Read(
const Placeholder& src);
109DOX_MARKER([DOX_ALIB_BOXING_CUSTOM_MANUAL])
122 #if ALIB_SIZEOF_INTEGER == 8
136 #if ALIB_SIZEOF_INTEGER == 8
148#if !ALIB_FEAT_BOXING_BIJECTIVE_FLOATS
158#if ALIB_SIZEOF_LONGDOUBLE_REPORTED <= 2 * ALIB_SIZEOF_INTEGER
168#if !ALIB_FEAT_BOXING_BIJECTIVE_CHARACTERS
173 #if ALIB_CHARACTERS_NATIVE_WCHAR
179 # if ALIB_CHARACTERS_SIZEOF_WCHAR == 4
205DOX_MARKER([DOX_ALIB_BOXING_OPTIMIZE_DECLARE_2])
207DOX_MARKER([DOX_ALIB_BOXING_OPTIMIZE_DECLARE_2])
214namespace alib {
namespace boxing {
230#if !defined(ALIB_DOX)
231namespace alib {
namespace boxing {
234#define ALIBTMP_BOXER_WITHOUT_UNBOXING(TC) \
235template<typename TStringLike> struct T_Boxer<TStringLike, \
237 !T_SuppressCharArrayBoxing<TStringLike>::value \
238&& characters::T_CharArray<TStringLike ALIB_COMMA TC>::Access \
239 == characters::AccessType ::Implicit \
240&& characters::T_CharArray<TStringLike ALIB_COMMA TC>::Construction \
241 != characters::ConstructionType::Implicit ) > \
243 using Mapping= TMappedToArrayOf<TC>; \
244 static constexpr Placeholder Write( TStringLike const & value ) \
246 return Placeholder( characters::T_CharArray<TStringLike, TC>::Buffer( value ), \
247 characters::T_CharArray<TStringLike, TC>::Length( value ) ); \
249 static void Read( const Placeholder& src); }; \
252#define ALIBTMP_BOXER_WITH_UNBOXING(TC) \
253template<typename TStringLike> struct T_Boxer<TStringLike, \
255 !T_SuppressCharArrayBoxing<TStringLike>::value \
256&& characters::T_CharArray<TStringLike ALIB_COMMA TC>::Access \
257 == characters::AccessType ::Implicit \
258&& characters::T_CharArray<TStringLike ALIB_COMMA TC>::Construction \
259 == characters::ConstructionType::Implicit ) > \
261 using Mapping= TMappedToArrayOf<TC>; \
262 static constexpr Placeholder Write( TStringLike const & value ) \
264 return Placeholder( characters::T_CharArray<TStringLike, TC>::Buffer( value ), \
265 characters::T_CharArray<TStringLike, TC>::Length( value ) ); \
267 static TStringLike Read( const Placeholder& src) \
269 return characters::T_CharArray<TStringLike, TC>::Construct( src.Pointer<TC>(), \
274ALIBTMP_BOXER_WITHOUT_UNBOXING(
nchar) ALIBTMP_BOXER_WITH_UNBOXING(
nchar)
275ALIBTMP_BOXER_WITHOUT_UNBOXING(
wchar) ALIBTMP_BOXER_WITH_UNBOXING(
wchar)
276ALIBTMP_BOXER_WITHOUT_UNBOXING(
xchar) ALIBTMP_BOXER_WITH_UNBOXING(
xchar)
278#undef ALIBTMP_BOXER_WITHOUT_UNBOXING
279#undef ALIBTMP_BOXER_WITH_UNBOXING
#define ALIB_BOXING_VTABLE_DECLARE_ARRAYTYPE(TMapped, Identifier)
#define ATMP_VOID_IF(Cond)
#define ALIB_BOXING_CUSTOMIZE_TYPE_MAPPING_CONSTEXPR(TSource, TTarget)
#define ALIB_BOXING_VTABLE_DECLARE(TMapped, Identifier)
#define ALIB_BOXING_CUSTOMIZE_NOT_UNBOXABLE_CONSTEXPR(TSource, TTarget)
characters::wchar wchar
Type alias in namespace alib.
characters::xchar xchar
Type alias in namespace alib.
characters::nchar nchar
Type alias in namespace alib.
lang::integer integer
Type alias in namespace alib.
static Read(const Placeholder &src)
static void Write(Placeholder &target, const TBoxable &value)
TMappedTo< detail::TDefaultBoxing > Mapping