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() ); }
43namespace alib {
namespace boxing {
44template<
typename TEnum>
struct T_Boxer<TEnum,
ATMP_VOID_IF( std::is_enum<TEnum>::value )>
46 using Mapping= TMappedTo<TEnum>;
48 static constexpr Placeholder
Write( TEnum
const & enumElement )
50 return Placeholder(
static_cast<integer>( enumElement ) );
53 static TEnum
Read(
const Placeholder& src)
55 return TEnum(
static_cast<typename std::underlying_type<TEnum>::type
>( src.GetInteger(0)) );
64DOX_MARKER([DOX_BOXING_OPTIMIZE_DECLARE_1])
66DOX_MARKER([DOX_BOXING_OPTIMIZE_DECLARE_1])
74#if !ALIB_FEAT_BOXING_BIJECTIVE_INTEGRALS
89 #if ALIB_SIZEOF_INTEGER == 8
95DOX_MARKER([DOX_BOXING_CUSTOM_MANUAL])
96namespace alib {
namespace boxing {
98template<>
struct T_Boxer<int16_t>
100 using Mapping= TMappedTo<integer>;
103 Placeholder
Write( int16_t
const & value )
105 return Placeholder(
static_cast<integer>( value ) );
108 static void Read(
const Placeholder& src);
112DOX_MARKER([DOX_BOXING_CUSTOM_MANUAL])
125 #if ALIB_SIZEOF_INTEGER == 8
139 #if ALIB_SIZEOF_INTEGER == 8
151#if !ALIB_FEAT_BOXING_BIJECTIVE_FLOATS
161#if ALIB_SIZEOF_LONGDOUBLE_REPORTED <= 2 * ALIB_SIZEOF_INTEGER
166template<>
struct T_Boxer<long double>
168 using Mapping= TMappedTo<long double>;
169 static Placeholder
Write(
long double const & value )
173 const char* src =
reinterpret_cast<const char*
>( &value );
174 char* dest=
reinterpret_cast< char*
>( &target );
181 static long double Read (
const Placeholder& placeholder)
185 const char* src =
reinterpret_cast<const char*
>( &placeholder );
186 char* dest=
reinterpret_cast< char*
>( &target );
201#if !ALIB_FEAT_BOXING_BIJECTIVE_CHARACTERS
206 #if ALIB_CHARACTERS_NATIVE_WCHAR
212 # if ALIB_CHARACTERS_SIZEOF_WCHAR == 4
238DOX_MARKER([DOX_BOXING_OPTIMIZE_DECLARE_2])
240DOX_MARKER([DOX_BOXING_OPTIMIZE_DECLARE_2])
247namespace alib {
namespace boxing {
262namespace alib {
namespace boxing {
265#define ALIBTMP_BOXER_WITHOUT_UNBOXING(TC) \
266template<typename TStringLike> struct T_Boxer<TStringLike, \
268 !T_SuppressCharArrayBoxing<TStringLike>::value \
269&& characters::T_CharArray<TStringLike ALIB_COMMA TC>::Access \
270 == characters::AccessType ::Implicit \
271&& characters::T_CharArray<TStringLike ALIB_COMMA TC>::Construction \
272 != characters::ConstructionType::Implicit ) > \
274 using Mapping= TMappedToArrayOf<TC>; \
275 static constexpr Placeholder Write( TStringLike const & value ) \
277 return Placeholder( characters::T_CharArray<TStringLike, TC>::Buffer( value ), \
278 characters::T_CharArray<TStringLike, TC>::Length( value ) ); \
280 static void Read( const Placeholder& src); }; \
283#define ALIBTMP_BOXER_WITH_UNBOXING(TC) \
284template<typename TStringLike> struct T_Boxer<TStringLike, \
286 !T_SuppressCharArrayBoxing<TStringLike>::value \
287&& characters::T_CharArray<TStringLike ALIB_COMMA TC>::Access \
288 == characters::AccessType ::Implicit \
289&& characters::T_CharArray<TStringLike ALIB_COMMA TC>::Construction \
290 == characters::ConstructionType::Implicit ) > \
292 using Mapping= TMappedToArrayOf<TC>; \
293 static constexpr Placeholder Write( TStringLike const & value ) \
295 return Placeholder( characters::T_CharArray<TStringLike, TC>::Buffer( value ), \
296 characters::T_CharArray<TStringLike, TC>::Length( value ) ); \
298 static TStringLike Read( const Placeholder& src) \
300 return characters::T_CharArray<TStringLike, TC>::Construct( src.Pointer<TC>(), \
305ALIBTMP_BOXER_WITHOUT_UNBOXING(
nchar) ALIBTMP_BOXER_WITH_UNBOXING(
nchar)
306ALIBTMP_BOXER_WITHOUT_UNBOXING(
wchar) ALIBTMP_BOXER_WITH_UNBOXING(
wchar)
307ALIBTMP_BOXER_WITHOUT_UNBOXING(
xchar) ALIBTMP_BOXER_WITH_UNBOXING(
xchar)
309#undef ALIBTMP_BOXER_WITHOUT_UNBOXING
310#undef ALIBTMP_BOXER_WITH_UNBOXING
#define ALIB_BOXING_VTABLE_DECLARE_ARRAYTYPE(TMapped, Identifier)
#define ATMP_VOID_IF(Cond)
#define ALIB_WARNINGS_RESTORE
#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)
#define ALIB_WARNINGS_ALLOW_UNSAFE_BUFFER_USAGE
#define ALIB_SIZEOF_LONGDOUBLE_WRITTEN
Recursive
Denotes whether recursion is performed/allowed or not.
Inclusion
Denotes how members of a set something should be taken into account.
ValueReference
Denotes if a value is interpreted as an absolute or relative number.
Whitespaces
Denotes whether a string is trimmed or not.
CreateDefaults
Denotes whether default entities should be created or not.
Caching
Denotes if a cache mechanism is enabled or disabled.
Side
Denotes if something is left or right.
Propagation
Denotes whether a e.g a setting should be propagated.
Switch
Denotes if sth. is switched on or off.
Initialization
Used for example with constructors that allow to suppress initialization of members.
Safeness
Denotes whether something should be performed in a safe or unsafe fashion.
SortOrder
Denotes sort order.
Reach
Denotes the reach of something.
SourceData
Denotes if the source data should be moved or copied.
Timezone
Denotes whether a time value represents local time or UTC.
Case
Denotes upper and lower case character treatment.
Alignment
Denotes Alignments.
Timing
Denotes if asynchronous tasks become synchronized.
CreateIfNotExists
Denotes whether something should be created if it does not exist.
Phase
Denotes a phase, e.g.,of a transaction.
ContainerOp
Denotes standard container operations.
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