ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
FAppend< TChar, TAllocator > Struct Template Reference

Description:

template<typename TChar, typename TAllocator>
struct alib::boxing::FAppend< TChar, TAllocator >

Implementations of this box-function write the content of the data stored in the box to the given AString object.

A default implementation is registered. This writes out the raw value of the first uinteger field of the boxes' Placeholder in hexadecimal format. For pointer types, such raw value reflects the memory address of the boxable. In debug-compilations, in addition, the type name of the boxed value is written.

Templated static method Appendable can be used to avoid implementations for those mapped types that specialized type traits functor T_Append that makes values of the type usable with AString::Append already.

Note
This is a templated (!) function declaration that defines three different box-functions at once, namely FAppend<character>, FAppend<complementChar> and FAppend<strangeChar>.

This box-function is usually invoked only indirectly, by "appending" a box to an AString, as shown here:

 Box     box= 42;
 AString text;

 text << "The answer is: "; // appends a string literal
 text << box;               // translates to: box.Call<FAppend<character>>( text )
Availability
This box-function is available only if the module ALib Strings is included in the ALib Distribution.
See also
Template Parameters
TCharThe character type of the destination AString given with parameter target.
TAllocatorThe allocator type, as prototyped with Allocator.

Definition at line 409 of file functions.inl.

Public Type Index:

using Signature = void (*) ( const Box& self, strings::TAString<TChar, TAllocator>& target )
 

Public Static Method Index:

template<typename TAppendable >
static void Appendable (const Box &self, strings::TAString< TChar, TAllocator > &target)
 
template<typename TAppendable >
static void WrappedAppendable (const Box &self, strings::TAString< TChar, TAllocator > &target)
 

Type Definition Details:

◆ Signature

template<typename TChar , typename TAllocator >
using Signature = void (*) ( const Box& self, strings::TAString<TChar, TAllocator>& target )

Signature of the invokable function.

Parameters
selfThe box that the function was invoked on.
targetThe target AString of character type TChar.

Definition at line 415 of file functions.inl.

Method Details:

◆ Appendable()

template<typename TChar , typename TAllocator >
template<typename TAppendable >
static void Appendable ( const Box & self,
strings::TAString< TChar, TAllocator > & target )
inlinestatic

Static templated implementation of FAppend for boxed types which are appendable.

Once a type is made appendable by specializing type traits functor T_Append, then this static templated function can be used "as is" and registered with the corresponding mapped type.

Note
This method interally is provide twice, once for types boxed as pointers and one for types boxed as values, and selected using TMP.
If a type is boxed as pointer, then TComparable has to be given as such pointer type. For comparison, the unboxed pointers will be dereferenced. This means, that it is believed that T_Append is specialized for the non-pointer type. If this is not the case, then two options exists:
  1. Specialize functor T_Append for the non-pointer type in parallel.
  2. Do not use this inlined implementation, but rather provide a custom one that does not dereference unboxed pointers.
See also
Macros
Template Parameters
TAppendableThe "appendable" mapped box type that the function is to be implemented for.
Parameters
selfThe box that the function was invoked on.
targetThe target AString of character type TChar.

◆ WrappedAppendable()

template<typename TChar , typename TAllocator >
template<typename TAppendable >
static void WrappedAppendable ( const Box & self,
strings::TAString< TChar, TAllocator > & target )
inlinestatic

Implementation template for box-function FAppend for appendable types wrapped in std::reference_wrapper to bypass custom boxing.

This static function template can be used for any type TAppendable that has a specialization of functor T_Append defined and that becomes boxed in the wrapper type.

Template Parameters
TAppendableThe "appendable" wrapped mapped box type that the function is to be implemented for.
Parameters
selfThe box that the function was invoked on.
targetThe target BoxedAs<AString> object.

The documentation for this struct was generated from the following file: