ALib C++ Framework
by
Library Version: 2605 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
functions.hpp
Go to the documentation of this file.
1//==================================================================================================
2/// \file
3/// This header-file is part of module \alib_characters of the \aliblong.
4///
5/// Copyright 2013-2026 A-Worx GmbH, Germany.
6/// Published under #"mainpage_license".
7//==================================================================================================
8ALIB_EXPORT namespace alib { namespace characters {
9//==================================================================================================
10/// Converts a character to upper case.
11///
12/// @tparam TChar One of the six (overlapping) #"alib_characters_chars;character types".
13/// @param c The character to convert
14/// @return The upper case version of the given character.
15//==================================================================================================
16template<typename TChar>
17TChar ToUpper( TChar c );
18
19//==================================================================================================
20/// Converts a character sequence to upper case.
21///
22/// @tparam TChar One of the six (overlapping) #"alib_characters_chars;character types".
23/// @param src Pointer to the character array.
24/// @param length The length of the array.
25//==================================================================================================
26template<typename TChar>
27void ToUpper( TChar* src, integer length );
28
29//==================================================================================================
30/// Converts a character to lower case.
31///
32/// @tparam TChar One of the six (overlapping) #"alib_characters_chars;character types".
33/// @param c The character to convert
34/// @return The lower case version of the given character.
35//==================================================================================================
36template<typename TChar>
37TChar ToLower( TChar c );
38
39//==================================================================================================
40/// Converts a character sequence to lower case.
41///
42/// @tparam TChar One of the six (overlapping) #"alib_characters_chars;character types".
43/// @param src Pointer to the character array.
44/// @param length The length of the array.
45//==================================================================================================
46template<typename TChar>
47void ToLower( TChar* src, integer length );
48
49//==================================================================================================
50/// Compares two characters of arbitrary types.
51///
52/// @tparam TChar One of the six (overlapping) #"alib_characters_chars;character types".
53/// @tparam sensitivity Letter case sensitivity of the comparison.
54/// @tparam TRhs The type of the right-hand side letter to compare.
55/// @param lhs The left-hand side character to compare of class template
56/// type \p{TChar}.
57/// @param rhs The right-hand side character to compare of method template
58/// type \p{TCharRhs} .
59/// @return \c true if the given characters are equal, \c false otherwise.
60//==================================================================================================
61template<typename TChar, lang::Case sensitivity, typename TRhs >
62bool Equal( TChar lhs, TRhs rhs ) {
63 using TLhs= TChar;
64 bool sensitive= (sensitivity == lang::Case::Sensitive);
65
66 if constexpr ( sizeof(TLhs) == sizeof(TRhs) )
67 return sensitive ? lhs == rhs
68 : ToUpper( lhs) == ToUpper( rhs);
69
70 else if constexpr ( sizeof(TLhs) < sizeof(TRhs) )
71 return sensitive ? static_cast<TRhs>(lhs) == rhs
72 : ToUpper( static_cast<TRhs>(lhs)) == ToUpper( rhs);
73
74 else if constexpr ( sizeof(TLhs) > sizeof(TRhs) )
75 return sensitive ? lhs == static_cast<TLhs>(rhs)
76 : ToUpper( lhs ) == ToUpper(static_cast<TLhs>(rhs));
77}
78
79//==================================================================================================
80/// Returns the length of a zero-terminated "c-style" character array.
81///
82/// Note: This method is implemented as an inlined, direct call to \c std::char_traits::length.
83///
84/// @tparam TChar One of the six (overlapping) #"alib_characters_chars;character types".
85/// @param cstring Pointer to a zero-terminated character array.
86/// @return The length of the string.
87//==================================================================================================
88template<typename TChar>
89integer Length( const TChar* cstring )
90{ return integer( std::char_traits<TChar>::length(cstring) ); }
91
92//==================================================================================================
93/// Copies the contents of a character array into another, non-overlapping (!) array.
94///
95/// Note: This method is implemented as an inlined, direct call to \c std::char_traits::copy.
96///
97/// @tparam TChar One of the six (overlapping) #"alib_characters_chars;character types".
98/// @param src Pointer to the source array.
99/// @param length The length to copy.
100/// @param dest Pointer to the destination array.
101//==================================================================================================
102template<typename TChar>
103void Copy( const TChar* src, integer length, TChar* dest )
104{ std::char_traits<TChar>::copy( dest, src, size_t(length) ); }
105
106//==================================================================================================
107/// Copies the contents of a character array into another, possibly overlapping array.
108///
109/// Note: This method is implemented as an inlined, direct call to \c std::char_traits::move.
110///
111/// @tparam TChar One of the six (overlapping) #"alib_characters_chars;character types".
112/// @param src Pointer to the source array.
113/// @param length The length to copy.
114/// @param dest Pointer to the destination array, optionally within source.
115//==================================================================================================
116template<typename TChar>
117void Move( const TChar* src, integer length, TChar* dest )
118{ std::char_traits<TChar>::move( dest, src, size_t(length) ); }
119
120//==================================================================================================
121/// Sets all elements of the given character array to value \p{value}.
122///
123/// @tparam TChar One of the six (overlapping) #"alib_characters_chars;character types".
124/// @param dest Pointer to the destination array.
125/// @param length The length to fill.
126/// @param value The value to fill the array with.
127//==================================================================================================
128template<typename TChar>
129void Fill( TChar* dest, integer length, TChar value );
130
131//==================================================================================================
132/// Reverses the order of the characters.
133///
134/// @tparam TChar One of the six (overlapping) #"alib_characters_chars;character types".
135/// @param src Pointer to the character array.
136/// @param length The length of the array.
137//==================================================================================================
138template<typename TChar>
139void Reverse( TChar* src, integer length );
140
141//==================================================================================================
142/// Searches the character. Returns a pointer to the location of \p{needle} in \p{haystack},
143/// respectively \c nullptr if not found.
144///
145/// Note: This method is implemented as a direct call to \c std::memchr, respectively
146/// other character versions of it.
147///
148/// @tparam TChar One of the six (overlapping) #"alib_characters_chars;character types".
149/// @param haystack Pointer to the start of the string.
150/// @param haystackLength The length of the string or the maximum position to search.
151/// @param needle Character to search.
152///
153/// @return The pointer to the first occurrence of \p{needle} respectively \c nullptr if
154/// not found.
155//==================================================================================================
156template<typename TChar>
157const TChar* Search( const TChar* haystack, integer haystackLength, TChar needle )
158{ return std::char_traits<TChar>::find( haystack, size_t(haystackLength), needle ); }
159
160//==================================================================================================
161/// Returns the index of the first character in \p{haystack} which is included in a given set
162/// of \p{needles}.
163///
164/// This method searches up to a given maximum index. For a search to the end of the
165/// zero-terminated string, use the faster method provided with class #"^CString".
166///
167/// @tparam TChar One of the six (overlapping) #"alib_characters_chars;character types".
168/// @param haystack Pointer to the start of the string.
169/// @param haystackLength The length of the string or the maximum position to search.
170/// If -1 is provided, the length is determined using standard library
171/// function \c strlen (which needs haystack to be zero-terminated).
172/// @param needles Pointer to a set of characters to be searched for.
173/// @param needlesLength The length of the string of needles.
174/// If -1 is provided, the length is determined using standard library
175/// function \c strlen (which needs needles to be zero-terminated).
176///
177/// @return The index of the first character found that is included in \p{needles}.
178/// If no character of haystack is included in \p{needles}, \c -1 is returned.
179//==================================================================================================
180template<typename TChar>
181integer IndexOfAnyIncluded( const TChar* haystack, integer haystackLength,
182 const TChar* needles, integer needlesLength );
183
184//==================================================================================================
185/// Same as #"IndexOfAnyIncluded(const" TChar*,integer,const TChar*,integer) but works on
186/// zero-terminated strings.
187///
188/// @tparam TChar One of the six (overlapping) #"alib_characters_chars;character types".
189/// @param haystack Pointer to a zero-terminated character array to search in.
190/// @param needles Pointer to a zero-terminated set of characters to search for.
191///
192/// @return The index of the first character found that is included in \p{needles}.
193/// If no character of haystack is included in \p{needles}, \c -1 is returned.
194//==================================================================================================
195template<typename TChar>
196integer IndexOfAnyIncludedZT( const TChar* haystack, const TChar* needles );
197
198//==================================================================================================
199/// Returns the index of the first character in \p{haystack} which is not included in a given
200/// set of \p{needles}.
201///
202/// This method searches up to a given maximum index. For a search to the end of the
203/// zero-terminated string, use the faster method provided with class #"^CString".
204///
205/// @tparam TChar One of the six (overlapping) #"alib_characters_chars;character types".
206/// @param haystack Pointer to the start of the string.
207/// @param haystackLength The length of the string or the maximum position to search.
208/// If -1 is provided, the length is determined using standard library
209/// function \c strlen (which needs haystack to be zero-terminated).
210/// @param needles Pointer to a set of characters to be searched for.
211/// @param needlesLength The length of the string of needles.
212/// If -1 is provided, the length is determined using standard library
213/// function \c strlen (which needs needles to be zero-terminated).
214///
215/// @return The index of the first character that is not included in \p{needles}.
216/// If all characters of haystack are included in \p{needles}, \c -1 is returned.
217//==================================================================================================
218template<typename TChar>
219integer IndexOfAnyExcluded( const TChar* haystack, integer haystackLength,
220 const TChar* needles, integer needlesLength );
221
222
223//==================================================================================================
224/// Same as #"IndexOfAnyExcluded(const" TChar*,integer,const TChar*,integer) but works on
225/// zero-terminated strings.
226///
227/// @tparam TChar One of the six (overlapping) #"alib_characters_chars;character types".
228/// @param haystack Pointer to a zero-terminated character array to search in.
229/// @param needles Pointer to a zero-terminated set of characters to search for.
230///
231/// @return The index of the first character that is not included in \p{needles}.
232/// If all characters of haystack are included in \p{needles}, \c -1 is returned.
233//==================================================================================================
234template<typename TChar>
235integer IndexOfAnyExcludedZT( const TChar* haystack, const TChar* needles );
236
237//==================================================================================================
238/// Returns the index of the last character in \p{haystack} which is included in a given set
239/// of \p{needles}.
240///
241/// This method searches backwards from the end of the string.
242///
243/// @tparam TChar One of the six (overlapping) #"alib_characters_chars;character types".
244/// @param haystack Pointer to the start of the string.
245/// @param startIdx The position to start the search from. This must be smaller than
246/// the length of the string and greater or equal to zero.
247/// @param needles Pointer to a set of characters to be searched for.
248/// @param needlesLength The length of the string of needles.
249/// If -1 is provided, the length is determined using standard library
250/// function \c strlen (which needs needles to be zero-terminated).
251///
252/// @return The index of the first character found which is included in the given set
253/// of characters. If nothing is found, -1 is returned.
254//==================================================================================================
255template<typename TChar>
256integer LastIndexOfAnyInclude( const TChar* haystack, integer startIdx,
257 const TChar* needles, integer needlesLength );
258
259//==================================================================================================
260/// Returns the index of the last character in \p{haystack} which is not included in a given
261/// set of \p{needles}.
262///
263/// This method searches backwards from the end of the string.
264///
265/// @tparam TChar One of the six (overlapping) #"alib_characters_chars;character types".
266/// @param haystack Pointer to the start of the string.
267/// @param startIdx The position to start the search from. This must be smaller than
268/// the length of the string and greater or equal to zero.
269/// @param needles Pointer to a set of characters to be searched for.
270/// @param needlesLength The length of the string of needles.
271/// If -1 is provided, the length is determined using standard library
272/// function \c strlen (which needs needles to be zero-terminated).
273///
274/// @return The index of the first character found which is included in the given set
275/// of characters. If nothing is found, -1 is returned.
276//==================================================================================================
277template<typename TChar>
278integer LastIndexOfAnyExclude( const TChar* haystack, integer startIdx,
279 const TChar* needles, integer needlesLength );
280
281//==================================================================================================
282/// Returns the index of the first character which is not equal within two strings.
283/// If \p{haystack} starts with \p{needle}, then the length of \p{needle} is returned.
284///
285/// @tparam TChar One of the six (overlapping) #"alib_characters_chars;character types".
286/// @param haystack Pointer to the start of the string.
287/// @param haystackLength The length of the string or the maximum position to search.
288/// If -1 is provided, the length is determined using standard library
289/// function \c strlen (which needs haystack to be zero-terminated).
290/// @param needle Pointer to the start of the string to compare with.
291/// @param needleLength The length of \p{needle}.
292/// If -1 is provided, the length is determined using standard library
293/// function \c strlen (which needs needles to be zero-terminated).
294/// @param sensitivity Denotes whether the comparison should be made case-sensitive
295/// or not.
296///
297/// @return The index of the first character found which is not equal in given strings.
298//==================================================================================================
299template<typename TChar>
300integer IndexOfFirstDifference( const TChar* haystack, integer haystackLength,
301 const TChar* needle, integer needleLength,
302 lang::Case sensitivity );
303
304//==================================================================================================
305/// Searches for a difference in two character arrays of equal length.
306///
307/// @tparam TChar One of the six (overlapping) #"alib_characters_chars;character types".
308/// @param lhs The first array to compare.
309/// @param rhs The second array to compare.
310/// @param cmpLength The number of characters to compare.
311///
312/// @return \c true if the string arrays have identical contents, \c false otherwise.
313//==================================================================================================
314template<typename TChar>
315bool Equal( const TChar* lhs, const TChar* rhs, integer cmpLength )
316{ return ::memcmp( lhs, rhs, size_t(cmpLength) * sizeof(TChar) ) == 0; }
317
318//==================================================================================================
319/// Compares up to \p{cmpLength} characters of two character arrays.
320/// Comparison stops if termination character \c '\0' is found in one of the arrays.
321///
322/// @tparam TChar One of the six (overlapping) #"alib_characters_chars;character types".
323/// @param lhs The first array to compare.
324/// @param rhs The second array to compare.
325/// @param cmpLength The number of characters to compare.
326///
327/// @return Negative value if lhs appears before rhs in lexicographical order.
328/// \c 0 if lhs and rhs are equal.
329/// Positive value if lhs appears after rhs in lexicographical order.
330//==================================================================================================
331template<typename TChar>
332int Compare( const TChar* lhs, const TChar* rhs, integer cmpLength )
333{ return std::char_traits<TChar>::compare( lhs, rhs, size_t(cmpLength) ); }
334
335//==================================================================================================
336/// Compares two character arrays of equal length ignoring letter case.
337/// @tparam TChar One of the six (overlapping) #"alib_characters_chars;character types".
338/// @param lhs The first array to compare.
339/// @param rhs The second array to compare.
340/// @param cmpLength The number of characters to compare.
341///
342/// @return Negative value if lhs appears before rhs in lexicographical order.
343/// \c 0 if lhs and rhs are equal.
344/// Positive value if lhs appears after rhs in lexicographical order.
345//==================================================================================================
346template<typename TChar>
347int CompareIgnoreCase( const TChar* lhs, const TChar* rhs, integer cmpLength );
348
349
350
351//! @cond NO_DOX
352//##################################################################################################
353// Narrow character specifics
354//##################################################################################################
355template<> inline void Fill<nchar>( nchar* dest, integer length, nchar c )
356{ memset( dest, c, size_t(length) ); }
357
358template<> inline nchar ToUpper<nchar>(nchar c) { return static_cast<nchar>( toupper(c) ); }
359
360template<> inline nchar ToLower<nchar>(nchar c) { return static_cast<nchar>( tolower(c) ); }
361
362template<> inline void ToUpper<nchar>(nchar* src, integer length) {
363 nchar* end= src + length;
364 while( src != end ) {
365 *src= ToUpper<nchar>( *src );
366 ++src;
367} }
368
369template<> inline void ToLower<nchar>(nchar* src, integer length) {
370 nchar* end= src + length;
371 while( src != end ) {
372 *src= ToLower<nchar>( *src );
373 ++src;
374} }
375
376template<> inline int CompareIgnoreCase<nchar>( const nchar* lhs, const nchar* rhs,
377 integer cmpLength ) {
378 #if defined (__GLIBCXX__) || defined(_LIBCPP_VERSION) || defined(__APPLE__) || defined(__ANDROID_NDK__)
379 return ::strncasecmp( lhs, rhs, size_t(cmpLength) );
380 #elif defined ( _WIN32 )
381 return _strnicmp ( lhs, rhs, size_t(cmpLength) );
382 #else
383 #pragma message ( "Unknown Platform in file: " __FILE__ )
384 #endif
385}
386
387template<> inline integer IndexOfAnyIncludedZT <nchar>( const nchar* haystack,
388 const nchar* needles ) {
389 const nchar* result= std::strpbrk(haystack, needles);
390 return result ? result - haystack
391 : -1;
392}
393
394template<> inline integer IndexOfAnyExcludedZT<nchar>( const nchar* haystack, const nchar* needles )
395{ return integer( std::strspn(haystack, needles) ); }
396
397
398
404extern template ALIB_DLL void Reverse <nchar>( nchar*,integer );
405
406
407//##################################################################################################
408// Wide character specifics
409//##################################################################################################
410template<> inline wchar ToUpper<wchar>(wchar c)
411{ return static_cast<wchar>(towupper(static_cast<wint_t>(c))); }
412
413template<> inline wchar ToLower<wchar>(wchar c)
414{ return static_cast<wchar>(towlower(static_cast<wint_t>(c))); }
415
416template<> inline void ToUpper<wchar>(wchar* src, integer length) {
417 wchar* end= src + length;
418 while( src != end ) {
419 *src= ToUpper<wchar>( *src );
420 ++src;
421} }
422
423template<> inline void ToLower<wchar>(wchar* src, integer length) {
424 wchar* end= src + length;
425 while( src != end ) {
426 *src= ToLower<wchar>( *src );
427 ++src;
428} }
429
430#if ALIB_CHARACTERS_NATIVE_WCHAR
431template<> inline void Fill<wchar>( wchar* dest, integer length, wchar c )
432{ wmemset( dest, c, size_t(length) ); }
433
434template<> inline int CompareIgnoreCase<wchar>( const wchar* lhs, const wchar* rhs,
435 integer cmpLength ) {
436 #if defined ( _WIN32 )
437 return _wcsnicmp ( lhs, rhs, size_t(cmpLength) );
438 #elif defined (__GLIBCXX__) || defined(_LIBCPP_VERSION) || defined(__APPLE__) || defined(__ANDROID_NDK__)
439 return ::wcsncasecmp( lhs, rhs, size_t(cmpLength) );
440 #else
441 #pragma message ( "Unknown Platform in file: " __FILE__ )
442 #endif
443}
444
445template<> inline integer IndexOfAnyIncludedZT<wchar>(const wchar* haystack, const wchar* needles) {
446 const wchar* result= std::wcspbrk(haystack, needles);
447 return result ? result - haystack
448 : -1;
449}
450template<> inline integer IndexOfAnyExcludedZT<wchar>(const wchar* haystack, const wchar* needles)
451{ return integer( std::wcsspn(haystack, needles) ); }
452
453
454#else
455template<> ALIB_DLL void Fill<wchar>( wchar* dest, integer length, wchar c );
456template<> ALIB_DLL int CompareIgnoreCase <wchar>( const wchar* lhs, const wchar* rhs, integer cmpLength );
457template<> ALIB_DLL integer IndexOfAnyIncludedZT<wchar>( const wchar* haystack, const wchar* needles );
458template<> ALIB_DLL integer IndexOfAnyExcludedZT<wchar>( const wchar* haystack, const wchar* needles );
459#endif
460
461
467extern template ALIB_DLL void Reverse <wchar>( wchar*,integer );
468
469
470
471//##################################################################################################
472// Strange character specifics
473//##################################################################################################
474template<> inline xchar ToUpper<xchar>(xchar c)
475{ return static_cast<xchar>(towupper(static_cast<wint_t>(c))); }
476
477template<> inline xchar ToLower<xchar>(xchar c)
478{ return static_cast<xchar>(towlower(static_cast<wint_t>(c))); }
479
480template<> inline void ToUpper<xchar>(xchar* src, integer length) {
481 xchar* end= src + length;
482 while( src != end ) {
483 *src= ToUpper<xchar>( *src );
484 ++src;
485} }
486
487template<> inline void ToLower<xchar>(xchar* src, integer length) {
488 xchar* end= src + length;
489 while( src != end ) {
490 *src= ToLower<xchar>( *src );
491 ++src;
492} }
493
494#if ALIB_CHARACTERS_NATIVE_WCHAR
495template<> ALIB_DLL void Fill<xchar>( xchar* dest, integer length, xchar c );
496template<> ALIB_DLL int CompareIgnoreCase<xchar>( const xchar* lhs, const xchar* rhs, integer cmpLength );
497template<> ALIB_DLL integer IndexOfAnyIncludedZT<xchar>( const xchar* haystack, const xchar* needles );
498template<> ALIB_DLL integer IndexOfAnyExcludedZT<xchar>( const xchar* haystack, const xchar* needles );
499#else
500template<> inline void Fill<xchar>( xchar* dest, integer length, xchar c )
501{
502 wmemset( dest, c, size_t(length) );
503}
504
505template<> inline int CompareIgnoreCase<xchar>( const xchar* lhs, const xchar* rhs, integer cmpLength )
506{
507 #if defined (__GLIBCXX__)|| defined(_LIBCPP_VERSION) || defined(__APPLE__)
508 return ::wcsncasecmp( lhs, rhs, size_t(cmpLength) );
509 #elif defined ( _WIN32 )
510 return _wcsnicmp ( lhs, rhs, size_t(cmpLength) );
511 #else
512 #pragma message ( "Unknown Platform in file: " __FILE__ )
513 #endif
514}
515
516template<> inline integer IndexOfAnyIncludedZT <xchar>( const xchar* haystack, const xchar* needles )
517{
518 const xchar* result= std::wcspbrk(haystack, needles);
519 return result ? result - haystack
520 : -1;
521}
522template<> inline integer IndexOfAnyExcludedZT<xchar>( const xchar* haystack, const xchar* needles )
523{
524 return integer( std::wcsspn(haystack, needles) );
525}
526#endif
527
533extern template ALIB_DLL void Reverse <xchar>( xchar*,integer );
534//! @endcond
535
536//##################################################################################################
537// struct AlignedCharArray
538//##################################################################################################
539/// Encapsulates a fixed-size character buffer.
540/// The character type and the buffer's length are templated.
541/// Furthermore, the buffer, and with it this type, are aligned to \c 8 bytes on 64-bit machines and
542/// to \c 4 bytes on 32-bit hardware.
543/// This supports fast access and compile-time optimizations.
544///
545/// An overloaded constructor and method #".Fill" allow filling the buffer with a distinct character.
546/// This is provided, as a frequent use-case for this struct is to provide #"^String" objects of
547/// variable length.
548/// For example, when generating indentation in text files, a <c>std::basic_ostream</c> might be
549/// faster filled with spaces using a local variable of this type than putting character by
550/// character to the stream in a loop.
551///
552/// The type's name uses the word "local" because usually it is used with local (stack allocated)
553/// variables.
554/// @tparam TChar The character type.
555/// Alias names for C++ character types exist with
556/// - #"characters::character",
557/// - #"characters::nchar",
558/// - #"characters::wchar",
559/// - #"characters::xchar",
560/// - #"characters::complementChar", and
561/// - #"characters::strangeChar".
562///
563/// Defaults to #"characters::character".
564///
565/// @tparam TLength The length of the local buffer. Defaults to 128 bytes.
566template<typename TChar= character, size_t TLength= 128/sizeof(TChar)>
568 /// The alignment of the field #".buffer". Because this is the first (and only) field, this
569 /// struct itself shares this alignment.
570 static constexpr size_t Alignment =
571 std::conditional_t<sizeof(void*) == 8, std::integral_constant<size_t, 64>,
572 std::integral_constant<size_t, 64>>::value;
573
574 /// The buffer.
575 alignas(Alignment) TChar buffer[TLength];
576
577 /// Default constructor. Leaves the characters uninitialized.
578 constexpr AlignedCharArray() noexcept =default;
579
580 /// Constructor taking a character to initialize the buffer with.
581 /// @param fillChar The character to fill this local buffer with.
582 constexpr AlignedCharArray( TChar fillChar ) noexcept { Fill( fillChar ); }
583
584 /// Returns a pointer to the internal buffer.
585 /// @return A mutable pointer to the characters.
586 constexpr TChar* Buffer() noexcept { return buffer; }
587
588 /// Returns a pointer to the internal buffer.
589 /// @return A const pointer to the characters.
590 constexpr const TChar* Buffer() const noexcept { return buffer; }
591
592 /// Returns the number of characters in this buffer.
593 /// @return The value of template parameter \p{TLength}.
594 constexpr integer Length() const noexcept { return TLength; }
595
596 /// Fills the buffer with given \p{fillChar}.
597 /// @param fillChar The character to fill this local buffer with.
598 constexpr void Fill( TChar fillChar ) noexcept
599 { characters::Fill( buffer, TLength, fillChar); }
600};
601
602}
603
604/// Type alias in namespace #"%alib".
605/// Note that the original struct has template parameters, which, for technical reasons can
606/// not be defaulted with this alias as they are defaulted in the original.
607/// Therefore, this alias uses explicit defaults (which are not changeable).
609
610} // namespace [alib::character]
#define ALIB_DLL
#define ALIB_EXPORT
const TChar * Search(const TChar *haystack, integer haystackLength, TChar needle)
PLATFORM_SPECIFIC xchar
Definition chartypes.hpp:51
void Copy(const TChar *src, integer length, TChar *dest)
PLATFORM_SPECIFIC character
Definition chartypes.hpp:91
integer Length(const TChar *cstring)
Definition functions.hpp:89
integer IndexOfFirstDifference(const TChar *haystack, integer haystackLength, const TChar *needle, integer needleLength, lang::Case sensitivity)
integer LastIndexOfAnyExclude(const TChar *haystack, integer startIdx, const TChar *needles, integer needlesLength)
void Reverse(TChar *src, integer length)
TChar ToUpper(TChar c)
integer LastIndexOfAnyInclude(const TChar *haystack, integer startIdx, const TChar *needles, integer needlesLength)
int Compare(const TChar *lhs, const TChar *rhs, integer cmpLength)
void Move(const TChar *src, integer length, TChar *dest)
PLATFORM_SPECIFIC wchar
Definition chartypes.hpp:38
integer IndexOfAnyIncludedZT(const TChar *haystack, const TChar *needles)
void Fill(TChar *dest, integer length, TChar value)
bool Equal(TChar lhs, TRhs rhs)
Definition functions.hpp:62
TChar ToLower(TChar c)
integer IndexOfAnyIncluded(const TChar *haystack, integer haystackLength, const TChar *needles, integer needlesLength)
integer IndexOfAnyExcluded(const TChar *haystack, integer haystackLength, const TChar *needles, integer needlesLength)
integer IndexOfAnyExcludedZT(const TChar *haystack, const TChar *needles)
int CompareIgnoreCase(const TChar *lhs, const TChar *rhs, integer cmpLength)
Case
Denotes upper and lower case character treatment.
Definition alox.cpp:14
strings::TFill< character > Fill
Type alias in namespace #"%alib".
Definition format.hpp:576
characters::AlignedCharArray<> AlignedCharArray
lang::integer integer
Type alias in namespace #"%alib".
Definition integers.hpp:149
characters::nchar nchar
Type alias in namespace #"%alib".
constexpr AlignedCharArray() noexcept=default
Default constructor. Leaves the characters uninitialized.
constexpr integer Length() const noexcept
constexpr TChar * Buffer() noexcept
static constexpr size_t Alignment
constexpr const TChar * Buffer() const noexcept
TChar buffer[TLength]
The buffer.
constexpr void Fill(TChar fillChar) noexcept