ALib C++ Library
Library Version: 2402 R1
Documentation generated by doxygen
Loading...
Searching...
No Matches
appendables.inl
Go to the documentation of this file.
1/** ************************************************************************************************
2 * \file
3 * This header file is part of module \alib_strings of the \aliblong.
4 *
5 * \emoji :copyright: 2013-2024 A-Worx GmbH, Germany.
6 * Published under \ref mainpage_license "Boost Software License".
7 **************************************************************************************************/
8#ifndef HPP_ALIB_STRINGS_APPENDABLES
9#define HPP_ALIB_STRINGS_APPENDABLES 1
10
11#if !defined(HPP_ALIB_STRINGS_ASTRING)
12# error "ALib sources with ending '.inl' must not be included from outside."
13#endif
14
15namespace alib { namespace strings {
16
17// #################################################################################################
18// struct T_Append: fundamental types
19// #################################################################################################
20
21// Faking all template specializations of namespace strings for doxygen into namespace
22// strings::APPENDABLES to keep the documentation of namespace string clean!
23#if defined(ALIB_DOX)
24namespace APPENDABLES {
25#endif
26
27/** Specialization of functor \alib{strings;T_Append} for type \c bool. */
28template<typename TChar> struct T_Append<bool ,TChar>
29{
30 /** ********************************************************************************************
31 * Writes the words "true" or "false" to the given AString.
32 * @param target The \b AString that \b Append was invoked on.
33 * @param b The boolean to write to \p{target}.
34 **********************************************************************************************/
35 void operator()( TAString<TChar>& target, bool b );
36};
40
41/** Specialization of functor \alib{strings;T_Append} for type \c int8_t. */
42template<typename TChar> struct T_Append<int8_t ,TChar>
43{
44 /**
45 * Creates a defaulted object of type \alib{strings;TFormat;Format} and defers the number
46 * conversion to the corresponding static specialization for that type.
47 *
48 * @param target The \b AString that \b Append was invoked on.
49 * @param value The value to write.
50 */
51 void operator()( TAString<TChar>& target, int8_t value )
52 {
53 T_Append<int64_t, TChar>()( target, value );
54 }
55};
56
57/** Specialization of functor \alib{strings;T_Append} for type \c uint8_t. */
58template<typename TChar> struct T_Append<uint8_t ,TChar>
59{
60 /**
61 * Creates a defaulted object of type \alib{strings;TFormat;Format} and defers the number
62 * conversion to the corresponding static specialization for that type.
63 *
64 * @param target The \b AString that \b Append was invoked on.
65 * @param value The value to write.
66 */
67 void operator()( TAString<TChar>& target, uint8_t value )
68 {
69 T_Append<uint64_t, TChar>()( target, value );
70 }
71};
72
73/** Specialization of functor \alib{strings;T_Append} for type \c int16_t. */
74template<typename TChar> struct T_Append<int16_t ,TChar>
75{
76 /**
77 * Creates a defaulted object of type \alib{strings;TFormat;Format} and defers the number
78 * conversion to the corresponding static specialization for that type.
79 *
80 * @param target The \b AString that \b Append was invoked on.
81
82 * @param value The value to write.
83 */
84 void operator()( TAString<TChar>& target, int16_t value )
85 {
86 T_Append<int64_t, TChar>()( target, value );
87 }
88
89};
90
91/** Specialization of functor \alib{strings;T_Append} for type \c uint16_t. */
92template<typename TChar> struct T_Append<uint16_t ,TChar>
93{
94 /**
95 * Creates a defaulted object of type \alib{strings;TFormat;Format} and defers the number
96 * conversion to the corresponding static specialization for that type.
97 *
98 * @param target The \b AString that \b Append was invoked on.
99 * @param value The value to write.
100 */
101 void operator()( TAString<TChar>& target, uint16_t value )
102 {
103 T_Append<uint64_t, TChar>()( target, value );
104 }
105
106};
107
108/** Specialization of functor \alib{strings;T_Append} for type \c int32_t. */
109template<typename TChar> struct T_Append<int32_t ,TChar>
110{
111 /**
112 * Creates a defaulted object of type \alib{strings;TFormat;Format} and defers the number
113 * conversion to the corresponding static specialization for that type.
114 *
115 * @param target The \b AString that \b Append was invoked on.
116 * @param value The value to write.
117 */
118 void operator()( TAString<TChar>& target, int32_t value )
119 {
120 T_Append<int64_t, TChar>()( target, value );
121 }
122
123};
124
125/** Specialization of functor \alib{strings;T_Append} for type \c uint32_t. */
126template<typename TChar> struct T_Append<uint32_t ,TChar>
127{
128 /**
129 * Creates a defaulted object of type \alib{strings;TFormat;Format} and defers the number
130 * conversion to the corresponding static specialization for that type.
131 *
132 * @param target The \b AString that \b Append was invoked on.
133 * @param value The value to write.
134 */
135 void operator()( TAString<TChar>& target, uint32_t value )
136 {
137 T_Append<uint64_t, TChar>()( target, value );
138 }
139
140};
141
142
143/** Specialization of functor \alib{strings;T_Append} for type \c int64_t. */
144template<typename TChar> struct T_Append<int64_t ,TChar>
145{
146 /**
147 * Creates a defaulted object of type \alib{strings;TFormat;Format} and defers the number
148 * conversion to the corresponding static specialization for that type.
149 *
150 * @param target The \b AString that \b Append was invoked on.
151 * @param value The value to write.
152 */
153 void operator()( TAString<TChar>& target, int64_t value );
154};
155
156/** Specialization of functor \alib{strings;T_Append} for type \c uint64_t. */
157template<typename TChar> struct T_Append<uint64_t ,TChar>
158{
159 /**
160 * Creates a defaulted object of type \alib{strings;TFormat;Format} and defers the number
161 * conversion to the corresponding static specialization for that type.
162 *
163 * @param target The \b AString that \b Append was invoked on.
164 * @param value The value to write.
165 */
166 void operator()( TAString<TChar>& target, uint64_t value );
167};
168
169/** Specialization of functor \alib{strings;T_Append} for type \c intGap_t. */
170template<typename TChar> struct T_Append<intGap_t ,TChar>
171{
172 /**
173 * Creates a defaulted object of type \alib{strings;TFormat;Format} and defers the number
174 * conversion to the corresponding static specialization for that type.
175 *
176 * @param target The \b AString that \b Append was invoked on.
177 * @param value The value to write.
178 */
179 void operator()( TAString<TChar>& target, intGap_t value )
180 {
181 T_Append<int64_t, TChar>()( target, value );
182 }
183
184};
185
186/** Specialization of functor \alib{strings;T_Append} for type \c uintGap_t. */
187template<typename TChar> struct T_Append<uintGap_t ,TChar>
188{
189 /**
190 * Creates a defaulted object of type \alib{strings;TFormat;Format} and defers the number
191 * conversion to the corresponding static specialization for that type.
192 *
193 * @param target The \b AString that \b Append was invoked on.
194 * @param value The value to write.
195 */
196 void operator()( TAString<TChar>& target, uintGap_t value )
197 {
198 T_Append<uint64_t, TChar>()( target, value );
199 }
200};
201
202/** Specialization of functor \alib{strings;T_Append} for type \c float. */
203template<typename TChar> struct T_Append<float ,TChar>
204{
205 /**
206 * Creates a defaulted object of type \alib{strings;TFormat;Format} and defers the number
207 * conversion to the corresponding static specialization for that type.
208 *
209 * @param target The \b AString that \b Append was invoked on.
210 * @param value The value to write.
211 */
212 void operator()( TAString<TChar>& target, float value)
213 {
214 T_Append<double, TChar>()( target, static_cast<double>(value) );
215 }
216};
217
218/** Specialization of functor \alib{strings;T_Append} for type \c double. */
219template<typename TChar> struct T_Append<double ,TChar>
220{
221 /**
222 * Creates a defaulted object of type \alib{strings;TFormat;Format} and defers the number
223 * conversion to the corresponding static specialization for that type.
224 *
225 * @param target The \b AString that \b Append was invoked on.
226 * @param value The value to write.
227 */
228 void operator()( TAString<TChar>& target, double value);
229};
230
231extern template ALIB_API void T_Append< int64_t, nchar>::operator()( TAString<nchar>&, int64_t );
232extern template ALIB_API void T_Append< int64_t, wchar>::operator()( TAString<wchar>&, int64_t );
233extern template ALIB_API void T_Append< int64_t, xchar>::operator()( TAString<xchar>&, int64_t );
234extern template ALIB_API void T_Append< uint64_t, nchar>::operator()( TAString<nchar>&, uint64_t );
235extern template ALIB_API void T_Append< uint64_t, wchar>::operator()( TAString<wchar>&, uint64_t );
236extern template ALIB_API void T_Append< uint64_t, xchar>::operator()( TAString<xchar>&, uint64_t );
237extern template ALIB_API void T_Append<double , nchar>::operator()( TAString<nchar>&, double );
238extern template ALIB_API void T_Append<double , wchar>::operator()( TAString<wchar>&, double );
239extern template ALIB_API void T_Append<double , xchar>::operator()( TAString<xchar>&, double );
240
241
242
243
244#if ALIB_DEBUG
245/** Specialization of functor \alib{strings;T_Append} for type \c std::type_info. */
246template<typename TChar> struct T_Append<std::type_info ,TChar>
247{
248 /** ********************************************************************************************
249 * Writes the demangled type name.
250 * @param target The \b AString that \b Append was invoked on.
251 * @param type The type to write to \p{target}.
252 **********************************************************************************************/
253 void operator()( TAString<TChar>& target, const std::type_info& type );
254};
255extern template ALIB_API void T_Append<std::type_info, nchar>::operator()( TAString<nchar>&, const std::type_info& );
256extern template ALIB_API void T_Append<std::type_info, wchar>::operator()( TAString<wchar>&, const std::type_info& );
257extern template ALIB_API void T_Append<std::type_info, xchar>::operator()( TAString<xchar>&, const std::type_info& );
258
259#endif
260
261
262// Faking all template specializations of namespace strings for doxygen into namespace
263// strings::APPENDABLES to keep the documentation of namespace string clean!
264#if defined(ALIB_DOX)
265}
266#endif
267
268
269}} // namespace [alib::strings]
270
271#endif // HPP_ALIB_STRINGS_APPENDABLES
#define ALIB_API
Definition alib.hpp:538
Definition alib.cpp:57
lang::intGap_t intGap_t
Type alias in namespace alib.
Definition integers.hpp:292
lang::uintGap_t uintGap_t
Type alias in namespace alib.
Definition integers.hpp:295
void operator()(TAString< TChar > &target, float value)
void operator()(TAString< TChar > &target, int16_t value)
void operator()(TAString< TChar > &target, int32_t value)
void operator()(TAString< TChar > &target, int8_t value)
void operator()(TAString< TChar > &target, intGap_t value)
void operator()(TAString< TChar > &target, uint16_t value)
void operator()(TAString< TChar > &target, uint32_t value)
void operator()(TAString< TChar > &target, uint8_t value)
void operator()(TAString< TChar > &target, uintGap_t value)
void operator()(TAString< TChar > &target, const TAppendable &src)