ALib C++ Library
Library Version: 2402 R1
Documentation generated by doxygen
Loading...
Searching...
No Matches
FAppend< TChar > Struct Template Reference

Description:

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

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 boxe's Placeholder in hexadecimal format. For pointer types, such raw value reflect 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 module ALib Strings is included in the ALib Distribution .
See also
Template Parameters
TCharThe character type of the destination AString given with parameter target .

Definition at line 427 of file functions.inl.

Public Type Index:

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

Public Static Method Index:

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

Type Definition Details:

◆ Signature

template<typename TChar >
using Signature = void (*) ( const Box& self, strings::TAString<TChar>& 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 435 of file functions.inl.

Method Details:

◆ Appendable()

template<typename TChar >
template<typename TAppendable >
static void Appendable ( const Box & self,
strings::TAString< TChar > & 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 >
template<typename TAppendable >
static void WrappedAppendable ( const Box & self,
strings::TAString< TChar > & 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: