ALib C++ Framework
by
Library Version: 2511 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
strings.prepro.hpp File Reference

Description:

This header-file is part of the ALib C++ Framework.

© 2013-2025 A-Worx GmbH, Germany. Published under Boost Software License.

Definition in file strings.prepro.hpp.

#include "alib/alib.inl"

Go to the source code of this file.

Macros

#define ALIB_STRING_DBG_CHK(instance)
#define ALIB_STRING_RESETTER(astring)
#define ALIB_STRINGS_APPENDABLE_TYPE(TYPE)
#define ALIB_STRINGS_APPENDABLE_TYPE_DEF(TYPE, IMPL)
#define ALIB_STRINGS_APPENDABLE_TYPE_DEF_N(TYPE, IMPL)
#define ALIB_STRINGS_APPENDABLE_TYPE_DEF_W(TYPE, IMPL)
#define ALIB_STRINGS_APPENDABLE_TYPE_INLINE(TYPE, IMPL)
#define ALIB_STRINGS_APPENDABLE_TYPE_INLINE_N(TYPE, IMPL)
#define ALIB_STRINGS_APPENDABLE_TYPE_INLINE_W(TYPE, IMPL)
#define ALIB_STRINGS_APPENDABLE_TYPE_N(TYPE)
#define ALIB_STRINGS_APPENDABLE_TYPE_W(TYPE)
#define ALIB_STRINGS_FROM_NARROW( src, dest, bufSize)
#define ALIB_STRINGS_FROM_NARROW_ARG( src, bufSize)
#define ALIB_STRINGS_FROM_WIDE( src, dest, bufSize)
#define ALIB_STRINGS_FROM_WIDE_ARG   src,bufSize ) alib::strings::TLocalString<nchar,bufSize>(src);
#define ALIB_STRINGS_SUPPRESS_STD_OSTREAM_OPERATOR(TYPE)
#define ALIB_STRINGS_TO_NARROW( src, dest, bufSize)
#define ALIB_STRINGS_TO_NARROW_ARG( src, bufSize)
#define ALIB_STRINGS_TO_WIDE( src, dest, bufSize)
#define ALIB_STRINGS_TO_WIDE_ARG( src, bufSize)

Macro Definition Documentation

◆ ALIB_STRING_DBG_CHK

#define ALIB_STRING_DBG_CHK ( instance)
Value:
{ (instance)->dbgCheck(); }

Simple macro that just invokes method _dbgCheck(), which is defined for classes String, CString and AString. It is active only when the configuration macro ALIB_DEBUG_STRINGS is true. The macro is placed in almost every method.

Definition at line 34 of file strings.prepro.hpp.

◆ ALIB_STRING_RESETTER

#define ALIB_STRING_RESETTER ( astring)
Value:
std::remove_reference_t<decltype(astring)>::value_type, \
std::remove_reference_t<decltype(astring)>::AllocatorType > \
ALIB_IDENTIFIER(astring)(astring);

Creates an 'anonymous' instance of class TStringLengthResetter. Its identifier name is assembled using macro ALIB_IDENTIFIER, hence from the given AString's identifier and the line number in the code.

Parameters
astringThe AString to reset to its original length when the C++ block scope where this macro is placed, is left.

Definition at line 109 of file strings.prepro.hpp.

◆ ALIB_STRINGS_APPENDABLE_TYPE

#define ALIB_STRINGS_APPENDABLE_TYPE ( TYPE)
Value:
namespace alib::strings { \
template<> struct AppendableTraits<TYPE, alib::character, alib::lang::HeapAllocator> {\
ALIB_DLL void operator()(TAString<alib::character, alib::lang::HeapAllocator>&, const TYPE& ); \
};}
#define ALIB_DLL
Definition alib.inl:573

Helper macro for specializing functor AppendableTraits for type TYPE. This macro has to be positioned outside any namespace, and the given type has to include its full namespace qualification.

This macro is to be used in combination with macro ALIB_STRINGS_APPENDABLE_TYPE_DEF.
As an alternative to the two macros, ALIB_STRINGS_APPENDABLE_TYPE_INLINE might be used, which will specialize AppendableTraits and define its operator() inline.

See also
Chapter 5.1 Appending Custom Types of the Programmer's Manual of module ALib Strings.
Parameters
TYPEThe type to specialize functor AppendableTraits for.

Definition at line 60 of file strings.prepro.hpp.

◆ ALIB_STRINGS_APPENDABLE_TYPE_DEF

#define ALIB_STRINGS_APPENDABLE_TYPE_DEF ( TYPE,
IMPL )
Value:
::operator()( TAString<alib::character, alib::lang::HeapAllocator>& target, const TYPE& src){IMPL}

Macro used in combination with ALIB_STRINGS_APPENDABLE_TYPE which specializes functor AppendableTraits for type TYPE and standard character type, and with this declares its member operator().
This macro is used for the implementation of this member function.

Parameters
TYPEThe type to specialize functor AppendableTraits for.
IMPLThe implementation code for operator().

Definition at line 78 of file strings.prepro.hpp.

◆ ALIB_STRINGS_APPENDABLE_TYPE_DEF_N

#define ALIB_STRINGS_APPENDABLE_TYPE_DEF_N ( TYPE,
IMPL )
Value:
::operator()( TAString<alib::nchar, alib::lang::HeapAllocator>& target, const TYPE& src) {IMPL}

Same as ALIB_STRINGS_APPENDABLE_TYPE_DEF but for character type nchar.

Parameters
TYPEThe type to specialize functor AppendableTraits for.
IMPLThe implementation code for operator().

Definition at line 82 of file strings.prepro.hpp.

◆ ALIB_STRINGS_APPENDABLE_TYPE_DEF_W

#define ALIB_STRINGS_APPENDABLE_TYPE_DEF_W ( TYPE,
IMPL )
Value:
::operator()( TAString<alib::wchar, alib::lang::HeapAllocator>& target, const TYPE& src) {IMPL}

Same as ALIB_STRINGS_APPENDABLE_TYPE_DEF but for character type wchar.

Parameters
TYPEThe type to specialize functor AppendableTraits for.
IMPLThe implementation code for operator().

Definition at line 86 of file strings.prepro.hpp.

◆ ALIB_STRINGS_APPENDABLE_TYPE_INLINE

#define ALIB_STRINGS_APPENDABLE_TYPE_INLINE ( TYPE,
IMPL )
Value:
namespace alib::strings { \
template<> struct AppendableTraits<TYPE,alib::character, alib::lang::HeapAllocator> {\
void operator()(TAString<alib::character, lang::HeapAllocator>& target, const TYPE& src) {IMPL}\
};}

Helper macro for specializing functor AppendableTraits for a custom type TYPE. This macro has to be positioned outside any namespace, and the given type has to include its full namespace qualification.

With the specialization of struct, AppendableTraits<TYPE>::operator() will be defined and implemented inline.

Macros ALIB_STRINGS_APPENDABLE_TYPE and ALIB_STRINGS_APPENDABLE_TYPE_DEF provide a non-inline alternative to this macro.

See also
Chapter 5.1 Appending Custom Types of the Programmer's Manual of module ALib Strings.
Parameters
TYPEThe type to specialize functor AppendableTraits for.
IMPLThe implementation code for operator().

Definition at line 91 of file strings.prepro.hpp.

◆ ALIB_STRINGS_APPENDABLE_TYPE_INLINE_N

#define ALIB_STRINGS_APPENDABLE_TYPE_INLINE_N ( TYPE,
IMPL )
Value:
namespace alib::strings { \
template<> struct AppendableTraits<TYPE,alib::nchar, alib::lang::HeapAllocator> {\
void operator()(TAString<alib::nchar, alib::lang::HeapAllocator>& target, const TYPE& src){IMPL}\
};}

Same as ALIB_STRINGS_APPENDABLE_TYPE_INLINE but for character type nchar.

Parameters
TYPEThe type to specialize functor AppendableTraits for.
IMPLThe implementation code for operator().

Definition at line 97 of file strings.prepro.hpp.

◆ ALIB_STRINGS_APPENDABLE_TYPE_INLINE_W

#define ALIB_STRINGS_APPENDABLE_TYPE_INLINE_W ( TYPE,
IMPL )
Value:
namespace alib::strings { \
template<> struct AppendableTraits<TYPE,alib::wchar, alib::lang::HeapAllocator> {\
void operator()(TAString<alib::wchar, alib::lang::HeapAllocator>& target, const TYPE& src){IMPL}\
};}

Same as ALIB_STRINGS_APPENDABLE_TYPE_INLINE but for character type wchar.

Parameters
TYPEThe type to specialize functor AppendableTraits for.
IMPLThe implementation code for operator().

Definition at line 103 of file strings.prepro.hpp.

◆ ALIB_STRINGS_APPENDABLE_TYPE_N

#define ALIB_STRINGS_APPENDABLE_TYPE_N ( TYPE)
Value:
namespace alib::strings { \
template<> struct AppendableTraits<TYPE, alib::nchar, alib::lang::HeapAllocator> {\
ALIB_DLL void operator()( TAString<alib::nchar, alib::lang::HeapAllocator>&, const TYPE& ); \
};}

Same as ALIB_STRINGS_APPENDABLE_TYPE but for character type nchar.

Parameters
TYPEThe type to specialize functor AppendableTraits for.

Definition at line 66 of file strings.prepro.hpp.

◆ ALIB_STRINGS_APPENDABLE_TYPE_W

#define ALIB_STRINGS_APPENDABLE_TYPE_W ( TYPE)
Value:
namespace alib::strings { \
template<> struct AppendableTraits<TYPE, alib::wchar, alib::lang::HeapAllocator> {\
ALIB_DLL void operator()( TAString<alib::wchar, alib::lang::HeapAllocator>&, const TYPE&); \
};}

Same as ALIB_STRINGS_APPENDABLE_TYPE but for character type wchar.

Parameters
TYPEThe type to specialize functor AppendableTraits for.

Definition at line 72 of file strings.prepro.hpp.

◆ ALIB_STRINGS_FROM_NARROW

#define ALIB_STRINGS_FROM_NARROW ( src,
dest,
bufSize )
Value:
decltype(src)& dest(src);

Creates a new local string variable of standard character type. The name of the variable is defined by parameter dest. If code selection macro ALIB_CHARACTERS_WIDE is false, then dest becomes just a reference to src. The macro in this case is defined as:

  decltype(src)& dest= src;

Otherwise, dest is of type LocalString and src is passed to its constructor.

Parameters
srcThe source string.
destThe name of the destination variable.
bufSizeThe local buffer size used for the conversion.

Definition at line 45 of file strings.prepro.hpp.

◆ ALIB_STRINGS_FROM_NARROW_ARG

#define ALIB_STRINGS_FROM_NARROW_ARG ( src,
bufSize )
Value:
src;

Used when ALib strings of narrow character size should be passed as a string argument of standard size. If code selection macro ALIB_CHARACTERS_WIDE is false, then the macro simply passes (is defined as) src.
Otherwise, the macro wraps src in an object of type LocalString.

Parameters
srcThe source string.
bufSizeThe local buffer size used for the conversion.

Definition at line 46 of file strings.prepro.hpp.

◆ ALIB_STRINGS_FROM_WIDE

#define ALIB_STRINGS_FROM_WIDE ( src,
dest,
bufSize )
Value:

Creates a new local string variable of standard character type. The name of the variable is defined by parameter dest. If code selection macro ALIB_CHARACTERS_WIDE is true, then dest becomes just a reference to src. The macro in this case is defined as:

  decltype(src)& dest= src;

Otherwise, dest is of type LocalString and src is passed to its constructor.

Parameters
srcThe source string.
destThe name of the destination variable.
bufSizeThe local buffer size used for the conversion.

Definition at line 47 of file strings.prepro.hpp.

◆ ALIB_STRINGS_FROM_WIDE_ARG

#define ALIB_STRINGS_FROM_WIDE_ARG   src,bufSize ) alib::strings::TLocalString<nchar,bufSize>(src);

Used when ALib strings of wide character size should be passed as a string argument of standard size. If code selection macro ALIB_CHARACTERS_WIDE is true, then the macro simply passes (is defined as) src.
Otherwise, the macro wraps src in an object of type LocalString.

Parameters
srcThe source string.
bufSizeThe local buffer size used for the conversion.

Definition at line 48 of file strings.prepro.hpp.

◆ ALIB_STRINGS_SUPPRESS_STD_OSTREAM_OPERATOR

#define ALIB_STRINGS_SUPPRESS_STD_OSTREAM_OPERATOR ( TYPE)
Value:
template<> struct SuppressStdOStreamOpTraits<TYPE> : ::std::true_type {}; }

Helper macro for specializing type trait SuppressStdOStreamOpTraits for a custom type TYPE. This macro has to be positioned outside any namespace, and the given type has to include its full namespace qualification.

Parameters
TYPEThe type to specialize functor AppendableTraits for.

Definition at line 120 of file strings.prepro.hpp.

◆ ALIB_STRINGS_TO_NARROW

#define ALIB_STRINGS_TO_NARROW ( src,
dest,
bufSize )
Value:
decltype(src)& dest(src);

Creates a new local string variable of narrow character type. The name of the variable is defined by parameter dest. If code selection macro ALIB_CHARACTERS_WIDE is false, then dest becomes just a reference to src. The macro in this case is defined as:

  decltype(src)& dest= src;

Otherwise, dest is of type LocalString and src is passed to its constructor.

Parameters
srcThe source string.
destThe name of the destination variable.
bufSizeThe local buffer size used for the conversion.

Definition at line 41 of file strings.prepro.hpp.

◆ ALIB_STRINGS_TO_NARROW_ARG

#define ALIB_STRINGS_TO_NARROW_ARG ( src,
bufSize )
Value:
src;

Used when ALib strings of standard character size should be passed as a string argument of narrow size. If code selection macro ALIB_CHARACTERS_WIDE is false, then the macro simply passes (is defined as) src.
Otherwise, the macro wraps src in an object of type LocalString which converts the string to the right character type.

Parameters
srcThe source string.
bufSizeThe local buffer size used for the conversion.

Definition at line 42 of file strings.prepro.hpp.

◆ ALIB_STRINGS_TO_WIDE

#define ALIB_STRINGS_TO_WIDE ( src,
dest,
bufSize )
Value:

Creates a new local string variable of wide character type. The name of the variable is defined by parameter dest. If code selection macro ALIB_CHARACTERS_WIDE is true, then dest becomes just a reference to src. The macro in this case is defined as:

  decltype(src)& dest= src;

Otherwise, dest is of type LocalString and src is passed to its constructor.

Parameters
srcThe source string.
destThe name of the destination variable.
bufSizeThe local buffer size used for the conversion.

Definition at line 43 of file strings.prepro.hpp.

◆ ALIB_STRINGS_TO_WIDE_ARG

#define ALIB_STRINGS_TO_WIDE_ARG ( src,
bufSize )
Value:

Used when ALib strings of standard character size should be passed as a string argument of wide size. If code selection macro ALIB_CHARACTERS_WIDE is true, then the macro simply passes (is defined as) src.
Otherwise, the macro wraps src in an object of type LocalString.

Parameters
srcThe source string.
bufSizeThe local buffer size used for the conversion.

Definition at line 44 of file strings.prepro.hpp.