ALib C++ Library
Library Version: 2402 R1
Documentation generated by doxygen
Loading...
Searching...
No Matches
cstring.hpp
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_CSTRING
9#define HPP_ALIB_STRINGS_CSTRING 1
10
11#if !defined (HPP_ALIB_STRINGS_STRING)
13#endif
14
15
16// conditional expression is constant for using our constant template parameters to select
17// checking vs. non-checking method versions
18#if defined(_MSC_VER)
19 #pragma warning( push )
20 #pragma warning( disable : 4127 )
21#endif
22
23namespace alib { namespace strings {
24
25/** ************************************************************************************************
26 * This class specializes its base class \alib{strings;TString;String} in that respect that
27 * the character strings represented are guaranteed to be zero-terminated.<br>
28 * Zero-terminated strings are widely used by programming language \b C and are often called
29 * "C-strings", what gave the class its name.
30 *
31 * \see
32 * For an introduction into the \alib string classes see this module's
33 * \ref alib_mod_strings "Programmer's Manual".
34 *
35 * @tparam TChar The character type.<br>
36 * Alias names for specializations of this class using character types
37 * \alib{characters;character}, \alib{characters;nchar}, \alib{characters;wchar},
38 * \alib{characters;xchar}, \alib{characters;complementChar} and \alib{characters;strangeChar}
39 * are provided in namespace #alib with type definitions \alib{CString}, \alib{NCString},
40 * \alib{WCString}, \alib{XCString}, \alib{ComplementCString} and \alib{StrangeCString}.
41 **************************************************************************************************/
42template<typename TChar>
43class TCString : public TString<TChar>
44{
45 public:
46
47 /** ****************************************************************************************
48 * Default constructor creating a \ref alib_strings_details_nulled \e "nulled" c-string.
49 ******************************************************************************************/
50 constexpr
52 : TString<TChar>()
53 {}
54
55 /** ****************************************************************************************
56 * Constructor accepting a pointer to a character array and a string length.
57 *
58 * \note
59 * It is a user's responsibility to ensure that the character array provided includes
60 * a terminating \c '\0' character.<br>
61 * In debug-compilations a run-time assertion is raised if the provided buffer is not
62 * zero-terminated.
63 *
64 *
65 * @param pBuffer The buffer to use.
66 * @param contentLength The length of the content in the given buffer.
67 ******************************************************************************************/
68 constexpr
69 explicit
70 TCString( const TChar* pBuffer, integer contentLength )
71 : TString<TChar>( pBuffer, contentLength )
72 {
73 #if ALIB_DEBUG // needed to avoid empty {} in constexpr constructor
77 "Error: Explicit construction of CString with unterminated string." )
79 #endif
80 }
81
82
83 #if defined(ALIB_DOX)
84 /** ****************************************************************************************
85 * This templated constructor accepts various different kinds of source data.
86 * Unlike this documentation suggests, this constructor is internally implemented by a
87 * series of different constructors which are selected using template meta programming
88 * (i.e. \c std::enable_if).
89 *
90 * Together, the set of constructors provide maximum flexibility by allowing implicit
91 * construction with (and assignment of) any built-in or third-party character array type.
92 * Some of the constructors are defined using keyword \c explict.
93 *
94 * In debug-compilations a run-time assertion is raised if the provided buffer is not
95 * zero-terminated.
96 *
97 * \see
98 * More information about construction of this type is provided with chapter
99 * \ref alib_strings_cc_construction_cstring of the Programmer's Manual of module
100 * \alib_strings.
101 *
102 * @tparam TZTCharArray Type that comprises a zero-terminated character array.
103 * @param src The source object.
104 ******************************************************************************************/
105 template <typename TZTCharArray>
106 inline
107 constexpr
108 TCString( const TTerminatable& src );
109
110
111 /** ****************************************************************************************
112 * \b Implicit cast operator to objects of type \p{TZTCharArray}.<br>
113 * This operator is available for all custom types that have an accordingly specialized
114 * version of TMP struct \alib{characters;T_CharArray} and/or
115 * \alib{characters;T_ZTCharArray} defined.
116 *
117 * \see
118 * More information about casting \alib string types to built-in C++ types or custom
119 * types is provided with chapter \ref alib_strings_cc_cast_cstring of the Programmer's
120 * Manual of module \alib_strings.
121 *
122 * @tparam TZTCharArray The custom type to implicitly convert this object to.
123 * @return A value of custom string type.
124 ******************************************************************************************/
125 template<typename TZTCharArray>
126 inline
127 operator TZTCharArray () const
128 {}
129
130 /** ****************************************************************************************
131 * \b Explicit cast operator to objects of type \p{TZTCharArray}.<br>
132 * This operator is available for all custom types that have an accordingly specialized
133 * version of TMP struct \alib{characters;T_CharArray} and/or
134 * \alib{characters;T_ZTCharArray} defined.
135 *
136 * \see
137 * More information about casting \alib string types to built-in C++ types or custom
138 * types is provided with chapter \ref alib_strings_cc_cast_cstring of the Programmer's
139 * Manual of module \alib_strings.
140 *
141 * @tparam TZTCharArray The custom type to explicitly convert this object to.
142 * @return A value of custom string type.
143 ******************************************************************************************/
144 template<typename TZTCharArray>
145 inline explicit
146 operator TZTCharArray () const
147 {}
148
149 #else // no doxygen now
150
151 // ##################### Constructors selected with std::enable_if #########################
153
154 ATMP_SELECT_IF_1TP( typename T, std::is_same<std::nullptr_t,T>::value )
155 constexpr
156 TCString(const T& )
157 : TString<TChar>( nullptr, 0 )
158 {}
159
160 // Note: 240226:
161 // We had to add an "intermediate" template 'v' here, which defaults to the expression
162 // that is used with the enable_if template type. See corresponding constructor of
163 // base String for further notes.
164 template <typename T,
166 typename std::enable_if<v, int>::type = 0 >
167 constexpr
168 TCString(const T& src)
169 : TString<TChar>( characters::T_ZTCharArray<ATMP_RCV(T), TChar>::Buffer( src ),
171 {
172 #if ALIB_DEBUG // needed to avoid empty {} in constexpr constructor
174 || TString<TChar>::buffer[TString<TChar>::length] == '\0', "STRINGS",
175 "Error: Implicit construction of CString with unterminated string." )
176 #endif
177 }
178
179 ATMP_SELECT_IF_1TP( typename T, characters::T_ZTCharArray<ATMP_RCV(T),TChar>::Access == characters::AccessType::Implicit )
180 constexpr
181 TCString(const T* src)
182 : TString<TChar>( characters::T_ZTCharArray<ATMP_RCV(T), TChar>::Buffer( *src ),
183 characters::T_ZTCharArray<ATMP_RCV(T), TChar>::Length( *src ) )
184 {
185 #if ALIB_DEBUG // needed to avoid empty {} in constexpr constructor
187 || TString<TChar>::buffer[TString<TChar>::length] == '\0', "STRINGS",
188 "Error: Implicit construction of CString with unterminated string." )
189 #endif
190 }
191
192 ATMP_SELECT_IF_1TP( typename T, characters::T_ZTCharArray<ATMP_RCV(T),TChar>::Access == characters::AccessType::ExplicitOnly )
193 constexpr
194 explicit
195 TCString( T& src)
196 : TString<TChar>( characters::T_ZTCharArray<ATMP_RCV(T),TChar>::Buffer( src ),
197 characters::T_ZTCharArray<ATMP_RCV(T),TChar>::Length( src ) )
198 {
199 #if ALIB_DEBUG // needed to avoid empty {} in constexpr constructor
201 || TString<TChar>::buffer[TString<TChar>::length] == '\0', "STRINGS",
202 "Error: Explicit construction of CString with unterminated string." )
203 #endif
204 }
205
206 ATMP_SELECT_IF_1TP( typename T, characters::T_ZTCharArray<ATMP_RCV(T),TChar>::Access == characters::AccessType::ExplicitOnly )
207 constexpr
208 explicit
209 TCString( T* src)
210 : TString<TChar>( characters::T_ZTCharArray<ATMP_RCV(T),TChar>::Buffer( *src ),
211 characters::T_ZTCharArray<ATMP_RCV(T),TChar>::Length( *src ) )
212 {
213 #if ALIB_DEBUG // needed to avoid empty {} in constexpr constructor
215 || TString<TChar>::buffer[TString<TChar>::length] == '\0', "STRINGS",
216 "Error: Explicit construction of CString with unterminated string." )
217 #endif
218 }
219
220 ATMP_SELECT_IF_1TP( typename T, characters::T_ZTCharArray<ATMP_RCV(T),TChar>::Access == characters::AccessType::MutableOnly && !std::is_const<T>::value )
221 constexpr
222 explicit
223 TCString( T& src)
224 : TString<TChar>( characters::T_ZTCharArray<ATMP_RCV(T),TChar>::Buffer( const_cast<T&>( src ) ),
225 characters::T_ZTCharArray<ATMP_RCV(T),TChar>::Length( const_cast<T&>( src ) ) )
226 {
227 #if ALIB_DEBUG // needed to avoid empty {} in constexpr constructor
229 || TString<TChar>::buffer[TString<TChar>::length] == '\0', "STRINGS",
230 "Error: Construction of CString (from mutable object) with unterminated string." )
231 #endif
232 }
233
234 ATMP_SELECT_IF_1TP( typename T, characters::T_ZTCharArray<ATMP_RCV(T),TChar>::Access == characters::AccessType::MutableOnly && !std::is_const<T>::value )
235 constexpr
236 explicit
237 TCString( T* src)
238 : TString<TChar>( characters::T_ZTCharArray<ATMP_RCV(T),TChar>::Buffer( *src ),
239 characters::T_ZTCharArray<ATMP_RCV(T),TChar>::Length( *src ) )
240 {
241 #if ALIB_DEBUG // needed to avoid empty {} in constexpr constructor
243 || TString<TChar>::buffer[TString<TChar>::length] == '\0', "STRINGS",
244 "Error: Construction of CString (from mutable object) with unterminated string." )
245 #endif
246 }
247
248 // ############################## casting back ######################################
250 && !T_SuppressAutoCast<TCString<TChar>,characters::ConstructionType::Implicit ,ATMP_RCV(T)>::value)
251 operator T () const
252 {
254 }
255
257 && !T_SuppressAutoCast<TCString<TChar>,characters::ConstructionType::ExplicitOnly,ATMP_RCV(T)>::value)
258 explicit
259 operator T () const
260 {
262 }
263
264
266 && characters::T_ZTCharArray<T,TChar>::Construction == characters::ConstructionType::Implicit
267 && !T_SuppressAutoCast<TCString<TChar>,characters::ConstructionType::Implicit ,ATMP_RCV(T)>::value)
268 operator T () const
269 {
271 }
272
274 && characters::T_ZTCharArray<T,TChar>::Construction == characters::ConstructionType::ExplicitOnly
275 && !T_SuppressAutoCast<TCString<TChar>,characters::ConstructionType::ExplicitOnly,ATMP_RCV(T)>::value)
276 explicit
277 operator T () const
278 {
280 }
281
283 #endif // doxygen
284
285
286 public:
287 /** ****************************************************************************************
288 * Reads a character at a given index.<br> Overrides
289 * \alib{strings;TString::operator[];String::operator[]} to change the debug assertion
290 * to allow inclusion of the termination character.
291 *
292 * \attention
293 * No parameter check is performed (other than an assertions in debug-compilation of
294 * \alib). See \alib{strings;TString::operator[];String::operator[]} for details.
295 *
296 * @param op The index of the character within this object's buffer.
297 * @returns If the character contained at index \p{op}.
298 ******************************************************************************************/
299 TChar operator[] (integer op) const
300 {
301 ALIB_ASSERT_ERROR( op >= 0 && op <= TString<TChar>::length, "STRINGS",
302 "Index out of bounds" )
304 return TString<TChar>::buffer[op];
306 }
307
308 /** ****************************************************************************************
309 * Returns the index of the first character which is included, respectively <em>not</em>
310 * included in a given set of characters.
311 *
312 * This method searches forwards. For backwards search, see
313 * \alib{strings;TString::LastIndexOfAny;String::LastIndexOfAny}.
314 *
315 * \note
316 * This method overrides method \alib{strings;TString::IndexOfAny;String::IndexOf}.
317 * This implementation however expects a \b %CString with parameter \p{needles}
318 * (beside the fact that it has to be invoked on a \b %CString itself).
319 * If no zero-terminated needle string is available, the parent's original method
320 * needs to be invoked. This has to be done by explicitly naming
321 * the parent class in the invocation, like for example in
322 *
323 * myCString.TString::IndexOfAny<Inclusion::Include>( myString );
324 *
325 * \note
326 * On most platforms, this zero-terminated version should perform slightly faster than
327 * the original method in class \b %String.
328 *
329 * @tparam TCheck Defaults to \c true which is the normal invocation mode.
330 * If \c <false> is added to the method name, no parameter checks are
331 * performed and the needles must not be empty.
332 * @tparam TInclusion Denotes whether the search returns the first index that holds a value
333 * that is included or that is not excluded in the set of needle
334 * characters.
335 * @param needles Set of characters to be taken into account.
336 * @param startIdx The index to start the search at. If the given value is less than \c 0,
337 * it is set to \c 0. If it exceeds the length of the string, the length of
338 * the string is returned.
339 * Defaults to \c 0.
340 *
341 * @return The index of the first character found which is included, respectively not
342 * included, in the given set of characters. If nothing is found, \c -1 is returned.
343 ******************************************************************************************/
344 template <lang::Inclusion TInclusion,
345 bool TCheck= true >
346 integer IndexOfAny( const TCString& needles, integer startIdx= 0 )
347 const
348 {
349 if (TCheck)
350 {
351 if ( startIdx < 0 ) startIdx= 0;
352 if ( startIdx >= TString<TChar>::length ) return -1;
353 }
354 else
355 {
356 ALIB_ASSERT_ERROR( startIdx >= 0
357 && startIdx < TString<TChar>::length
358 && needles.Length() != 0, "STRINGS",
359 "Non checking and illegal parameters" )
360 }
361
362
364 if constexpr ( TInclusion == lang::Inclusion::Include )
365 {
368 return idx >= 0 ? idx + startIdx : -1;
369 }
370 else
371 {
372 const TChar* haystack= TString<TChar>::buffer + startIdx;
374 return idx < 0 || *( haystack + idx ) == '\0' ? -1 : startIdx + idx;
375 }
377 }
378
379}; // class TCString
380
381#if (ALIB_CPP_STANDARD >= 20 && !defined(_MSC_VER)) && !defined(ALIB_DOX)
382// The following operators are re-implementations of those found with class String.
383// They are needed to mitigate typical C++ 20 comparison operator ambiguities.
384
385// CString/CString
386inline bool operator== (const TCString<nchar>& lhs, const NCString& rhs) { return lhs.CompareTo<true,lang::Case::Sensitive>( rhs ) == 0; }
387inline bool operator== (const TCString<wchar>& lhs, const WCString& rhs) { return lhs.CompareTo<true,lang::Case::Sensitive>( rhs ) == 0; }
388inline bool operator== (const TCString<xchar>& lhs, const XCString& rhs) { return lhs.CompareTo<true,lang::Case::Sensitive>( rhs ) == 0; }
389inline auto operator<=> (const TCString<nchar>& lhs, const NCString& rhs) { return lhs.CompareTo<true,lang::Case::Sensitive>( rhs ); }
390inline auto operator<=> (const TCString<wchar>& lhs, const WCString& rhs) { return lhs.CompareTo<true,lang::Case::Sensitive>( rhs ); }
391inline auto operator<=> (const TCString<xchar>& lhs, const XCString& rhs) { return lhs.CompareTo<true,lang::Case::Sensitive>( rhs ); }
392
393// CString/char*
394inline bool operator== (const TCString<nchar>& lhs, const nchar* rhs) { return lhs.CompareTo<true,lang::Case::Sensitive>( rhs ) == 0; }
395inline bool operator== (const TCString<wchar>& lhs, const wchar* rhs) { return lhs.CompareTo<true,lang::Case::Sensitive>( rhs ) == 0; }
396inline bool operator== (const TCString<xchar>& lhs, const xchar* rhs) { return lhs.CompareTo<true,lang::Case::Sensitive>( rhs ) == 0; }
397inline auto operator<=> (const TCString<nchar>& lhs, const nchar* rhs) { return lhs.CompareTo<true,lang::Case::Sensitive>( rhs ); }
398inline auto operator<=> (const TCString<wchar>& lhs, const wchar* rhs) { return lhs.CompareTo<true,lang::Case::Sensitive>( rhs ); }
399inline auto operator<=> (const TCString<xchar>& lhs, const xchar* rhs) { return lhs.CompareTo<true,lang::Case::Sensitive>( rhs ); }
400#endif
401
402
403/** ************************************************************************************************
404 * This template class has three specializations for types \c nchar, \c wchar, and \c xchar, which
405 * each provide static fields:
406 * - \b EmptyString,
407 * - \b NewLine and
408 * - \b DefaultWhitespaces.
409 *
410 * The class is useful to implement methods that are templated with the character type they use.
411 *
412 * \note
413 * In non-templated code (that works with fixed or logical character sizes), it might lead to
414 * better readable code, if the following shortcut/alias functions of namespace #alib are used:
415 * - \ref EmptyString, \ref EmptyComplementString, \ref EmptyStrangeString,
416 * \ref EmptyNString, \ref EmptyWString, \ref EmptyXString,
417 * - \ref NewLine, \ref ComplementNewLine, \ref StrangeNewLine,
418 * \ref NNewLine, \ref WNewLine, \ref XNewLine and
419 * - \ref DefaultWhitespaces, \ref ComplementDefaultWhitespaces, \ref StrangeDefaultWhitespaces,
420 * \ref NDefaultWhitespaces, \ref WDefaultWhitespaces, \ref XDefaultWhitespaces.
421 * <p>
422 *
423 * \note
424 * Constants for \e nulled strings are given with
425 * \ref NullString, \ref NullComplementString, \ref NullStrangeString,
426 * \ref NullNString, \ref NullWString and \ref NullXString. However, those are returning
427 * type \b String instead of \b CString. For \e nulled objects of type \b CString use
428 * keyword \c nullptr which performs implicit constexpr creation.
429 *
430 * \see
431 * See also manual chapter \ref alib_strings_details_constants.
432 *
433 * @tparam TChar The character type.
434 **************************************************************************************************/
435template<typename TChar> struct TT_StringConstants
436{
437 #if defined(ALIB_DOX)
438 /** @return A \e zero-terminated empty string. */
439 constexpr inline static CString<TChar> EmptyString();
440
441 /**
442 * On Windows OS, the returned string contains characters <c>'\\r'</c> and <c>'\\n'</c>, on
443 * other platforms just character <c>'\\n'</c>.
444 * @return A \e zero-terminated string containing platform dependent "newline" charcater(s).
445 */
446 constexpr inline static CString<TChar> NewLine();
447
448 /** @return A zero-terminated string containing default whitespace characters "space", "newline"
449 * "carriage return" and "tablulator", hence <c>" \n\r\t"</c>. */
450 constexpr inline static CString<TChar> DefaultWhitespaces());
451 #endif
452};
453
454
455#if !defined(ALIB_DOX)
456
457template<> struct TT_StringConstants<nchar>
458{
459 constexpr static NCString EmptyString() { return "" ; }
460
461 #if defined(_WIN32)
462 constexpr static NCString NewLine() { return "\r\n" ; }
463 #else
464 constexpr static NCString NewLine() { return "\n" ; }
465 #endif
466
467 constexpr static NCString DefaultWhitespaces() { return " \n\r\t" ; }
468};
469
470template<> struct TT_StringConstants<wchar>
471{
472 constexpr static WCString EmptyString() { return A_WCHAR("" ); }
473
474 #if defined(_WIN32)
475 constexpr static WCString NewLine() { return A_WCHAR("\r\n" ); }
476 #else
477 constexpr static WCString NewLine() { return A_WCHAR("\n" ); }
478 #endif
479
480 constexpr static WCString DefaultWhitespaces() { return A_WCHAR(" \n\r\t"); }
481};
482
483template<> struct TT_StringConstants<xchar>
484{
485 constexpr static XCString EmptyString() { return A_XCHAR("" ); }
486
487 #if defined(_WIN32)
488 constexpr static XCString NewLine() { return A_XCHAR("\r\n" ); }
489 #else
490 constexpr static XCString NewLine() { return A_XCHAR("\n" ); }
491 #endif
492
493 constexpr static XCString DefaultWhitespaces() { return A_XCHAR(" \n\r\t"); }
494};
495
496#endif //!defined(ALIB_DOX)
497
498} // namespace alib[::strings]
499
500/// Inline shortcut to method \alib{strings;TT_StringConstants<TChar>::EmptyString;TT_StringConstants<character>::EmptyString}.
501/// @return A zero-terminated, empty string.
503
504/// Inline shortcut to method \alib{strings;TT_StringConstants<TChar>::EmptyString;TT_StringConstants<complementChar>::EmptyString}.
505/// @return A zero-terminated, empty string.
507
508/// Inline shortcut to method \alib{strings;TT_StringConstants<TChar>::EmptyString;TT_StringConstants<strangeChar>::EmptyString}.
509/// @return A zero-terminated, empty string.
511
512/// Inline shortcut to method \alib{strings;TT_StringConstants<TChar>::EmptyString;TT_StringConstants<nchar>::EmptyString}.
513/// @return A zero-terminated, empty string.
515
516/// Inline shortcut to method \alib{strings;TT_StringConstants<TChar>::EmptyString;TT_StringConstants<wchar>::EmptyString}.
517/// @return A zero-terminated, empty string.
519
520/// Inline shortcut to method \alib{strings;TT_StringConstants<TChar>::DefaultWhitespaces;TT_StringConstants<xchar>::DefaultWhitespaces}.
521/// @return A zero-terminated, empty string.
523
524
525
526/// Inline shortcut to method \alib{strings;TT_StringConstants<TChar>::NewLine;TT_StringConstants<character>::NewLine}.
527/// @return A zero-terminated string containing the new-line character sequence.
529
530/// Inline shortcut to method \alib{strings;TT_StringConstants<TChar>::NewLine;TT_StringConstants<complementChar>::NewLine}.
531/// @return A zero-terminated string containing the new-line character sequence.
533
534/// Inline shortcut to method \alib{strings;TT_StringConstants<TChar>::NewLine;TT_StringConstants<strangeChar>::NewLine}.
535/// @return A zero-terminated string containing the new-line character sequence.
537
538/// Inline shortcut to method \alib{strings;TT_StringConstants<TChar>::NewLine;TT_StringConstants<nchar>::NewLine}.
539/// @return A zero-terminated string containing the new-line character sequence.
541
542/// Inline shortcut to method \alib{strings;TT_StringConstants<TChar>::NewLine;TT_StringConstants<wchar>::NewLine}.
543/// @return A zero-terminated string containing the new-line character sequence.
545
546/// Inline shortcut to method \alib{strings;TT_StringConstants<TChar>::NewLine;TT_StringConstants<xchar>::NewLine}.
547/// @return A zero-terminated string containing the new-line character sequence.
549
550
551
552/// Inline shortcut to method \alib{strings;TT_StringConstants<TChar>::DefaultWhitespaces;TT_StringConstants<character>::DefaultWhitespaces}.
553/// @return A zero-terminated string of default whitespace characters.
555
556/// Inline shortcut to method \alib{strings;TT_StringConstants<TChar>::DefaultWhitespaces;TT_StringConstants<complementChar>::DefaultWhitespaces}.
557/// @return A zero-terminated string of default whitespace characters.
559
560/// Inline shortcut to method \alib{strings;TT_StringConstants<TChar>::DefaultWhitespaces;TT_StringConstants<strangeChar>::DefaultWhitespaces}.
561/// @return A zero-terminated string of default whitespace characters.
563
564/// Inline shortcut to method \alib{strings;TT_StringConstants<TChar>::DefaultWhitespaces;TT_StringConstants<nchar>::DefaultWhitespaces}.
565/// @return A zero-terminated string of default whitespace characters.
567
568/// Inline shortcut to method \alib{strings;TT_StringConstants<TChar>::DefaultWhitespaces;TT_StringConstants<wchar>::DefaultWhitespaces}.
569/// @return A zero-terminated string of default whitespace characters.
571
572/// Inline shortcut to method \alib{strings;TT_StringConstants<TChar>::DefaultWhitespaces;TT_StringConstants<xchar>::DefaultWhitespaces}.
573/// @return A zero-terminated string of default whitespace characters.
575
576/// A global instance of a \e nulled zero-terminated string of standard character size.
578
579/// A global instance of a \e nulled zero-terminated string of complementary character size.
581
582/// A global instance of a \e nulled zero-terminated string of strange character size.
584
585/// A global instance of a \e nulled zero-terminated string of wide character size.
587
588/// A global instance of a \e nulled zero-terminated string of wide character size.
590
591/// A global instance of a \e nulled zero-terminated string of strange character size.
593
594} // namespace [alib]
595
596#if defined(_MSC_VER)
597 #pragma warning( pop )
598#endif
599#endif // HPP_ALIB_STRINGS_CSTRING
integer IndexOfAny(const TCString &needles, integer startIdx=0) const
Definition cstring.hpp:346
constexpr TCString(const TChar *pBuffer, integer contentLength)
Definition cstring.hpp:70
TChar operator[](integer op) const
Definition cstring.hpp:299
constexpr TCString(const TTerminatable &src)
constexpr bool IsNull() const
Definition string.hpp:395
const TChar * buffer
Definition string.hpp:129
constexpr integer Length() const
Definition string.hpp:357
constexpr TString() noexcept=default
constexpr const TChar * Buffer() const
Definition string.hpp:350
#define ATMP_RCV( T)
Definition tmp.hpp:40
#define ALIB_WARNINGS_RESTORE
Definition alib.hpp:715
#define ALIB_API
Definition alib.hpp:538
#define A_XCHAR(STR)
#define ALIB_ASSERT_ERROR(cond,...)
Definition alib.hpp:984
#define ALIB_WARNINGS_ALLOW_UNSAFE_BUFFER_USAGE
Definition alib.hpp:644
#define A_WCHAR(STR)
#define ATMP_SELECT_IF_1TP(TParam, ...)
Definition tmp.hpp:57
@ Include
Chooses inclusion.
bool operator==(const String &lhs, const String &rhs)
Definition string.hpp:2319
bool operator<=>(const String &lhs, const String &rhs)
Definition string.hpp:2349
Definition alib.cpp:57
constexpr XCString XDefaultWhitespaces()
Definition cstring.hpp:574
ALIB_API CString EMPTY_STRING
A global instance of a nulled zero-terminated string of standard character size.
Definition string.cpp:476
constexpr CString DefaultWhitespaces()
Definition cstring.hpp:554
constexpr NCString NDefaultWhitespaces()
Definition cstring.hpp:566
ALIB_API WCString EMPTY_W_STRING
A global instance of a nulled zero-terminated string of wide character size.
Definition string.cpp:480
constexpr ComplementCString ComplementDefaultWhitespaces()
Definition cstring.hpp:558
constexpr ComplementCString ComplementNewLine()
Definition cstring.hpp:532
constexpr CString NewLine()
Definition cstring.hpp:528
constexpr WCString EmptyWString()
Definition cstring.hpp:518
constexpr NCString NNewLine()
Definition cstring.hpp:540
constexpr StrangeCString StrangeDefaultWhitespaces()
Definition cstring.hpp:562
constexpr StrangeCString EmptyStrangeString()
Definition cstring.hpp:510
constexpr NCString EmptyNString()
Definition cstring.hpp:514
characters::wchar wchar
Type alias in namespace alib.
ALIB_API NCString EMPTY_N_STRING
A global instance of a nulled zero-terminated string of wide character size.
Definition string.cpp:479
strings::TCString< complementChar > ComplementCString
Type alias in namespace alib.
constexpr XCString EmptyXString()
Definition cstring.hpp:522
constexpr CString EmptyString()
Definition cstring.hpp:502
ALIB_API XString EMPTY_X_STRING
A global instance of a nulled zero-terminated string of strange character size.
Definition string.cpp:481
characters::xchar xchar
Type alias in namespace alib.
constexpr WCString WNewLine()
Definition cstring.hpp:544
strings::TCString< character > CString
Type alias in namespace alib.
constexpr StrangeCString StrangeNewLine()
Definition cstring.hpp:536
strings::TCString< nchar > NCString
Type alias in namespace alib.
characters::nchar nchar
Type alias in namespace alib.
ALIB_API StrangeCString EMPTY_STRANGE_STRING
A global instance of a nulled zero-terminated string of strange character size.
Definition string.cpp:478
constexpr XCString XNewLine()
Definition cstring.hpp:548
strings::TCString< strangeChar > StrangeCString
Type alias in namespace alib.
strings::TString< xchar > XString
Type alias in namespace alib.
ALIB_API ComplementCString EMPTY_COMPLEMENT_STRING
A global instance of a nulled zero-terminated string of complementary character size.
Definition string.cpp:477
strings::TCString< xchar > XCString
Type alias in namespace alib.
constexpr ComplementCString EmptyComplementString()
Definition cstring.hpp:506
lang::integer integer
Type alias in namespace alib.
Definition integers.hpp:286
strings::TCString< wchar > WCString
Type alias in namespace alib.
constexpr WCString WDefaultWhitespaces()
Definition cstring.hpp:570
static integer IndexOfAnyExcludedZT(const TChar *haystack, const TChar *needles)
static constexpr ConstructionType Construction
static TString Construct(const TChar *array, integer length)
static TString Construct(const TChar *array, integer length)
static constexpr CString< TChar > DefaultWhitespaces())
static constexpr CString< TChar > NewLine()
static constexpr CString< TChar > EmptyString()