This class specializes its base class String in that respect that the character strings represented are guaranteed to be zero-terminated.
Zero-terminated strings are widely used by programming language C and are often called "C-strings", what gave the class its name.
| TChar | The character type of this string. |
Definition at line 30 of file cstring.inl.
Public Method Index: | |
| constexpr | TCString ()=default |
| Defaulted default constructor. Leaves this instance uninitialized and undefined. | |
| template<typename T> requires alib::characters::IsImplicitZTArraySource<T, TChar> | |
| constexpr | TCString (const T &src) |
| template<typename T> requires alib::characters::IsImplicitZTArraySource<T, TChar> | |
| constexpr | TCString (const T *src) |
| constexpr | TCString (const TChar *pBuffer, integer contentLength) |
| constexpr | TCString (lang::IsNullptr auto const &) noexcept |
Constructor accepting nullptr. Constructs a nulled string. | |
| template<typename T> requires alib::characters::IsExplicitZTArraySource<T, TChar> | |
| constexpr | TCString (T &src) |
| template<typename T> requires alib::characters::IsMutableZTArraySource<T, TChar> | |
| constexpr | TCString (T &src) |
| template<typename T> requires alib::characters::IsExplicitZTArraySource<T, TChar> | |
| constexpr | TCString (T *src) |
| template<typename T> requires alib::characters::IsMutableZTArraySource<T, TChar> | |
| constexpr | TCString (T *src) |
| template<typename TAllocator> requires alib::lang::IsAllocator<TAllocator> | |
| TCString (TAllocator &allocator, const TString< TChar > ©) | |
| template<typename TAllocator> requires alib::lang::IsAllocator<TAllocator> | |
| void | Allocate (TAllocator &allocator, const TString< TChar > ©) |
| template<typename TAllocator> requires alib::lang::IsAllocator<TAllocator> | |
| void | Free (TAllocator &allocator) const |
| template<lang::Inclusion TInclusion, typename TCheck = CHK> | |
| integer | IndexOfAny (const TCString &needles, integer startIdx=0) const |
| template<typename T> requires ( alib::characters::IsImplicitArrayCast<T, TChar> && !alib::strings::NoAutoCastTraits< TCString<TChar>, characters::Policy::Implicit, std::remove_cv_t<T> >::value ) | |
| constexpr | operator T () const |
| template<typename T> requires ( alib::characters::IsExplicitArrayCast<T, TChar> && !alib::characters::IsImplicitZTArrayCast<T, TChar> && !alib::characters::IsExplicitZTArrayCast<T, TChar> && !alib::strings::NoAutoCastTraits< TCString<TChar>, characters::Policy::ExplicitOnly, std::remove_cv_t<T> >::value ) | |
| constexpr | operator T () const |
| template<typename T> requires ( !alib::characters::IsImplicitArrayCast <T, TChar> && alib::characters::IsImplicitZTArrayCast<T, TChar> && !alib::strings::NoAutoCastTraits< TCString<TChar>, characters::Policy::Implicit, std::remove_cv_t<T> >::value ) | |
| constexpr | operator T () const |
| template<typename T> requires ( alib::characters::IsExplicitZTArrayCast<T, TChar> && !alib::characters::IsImplicitZTArrayCast<T, TChar> && !alib::strings::NoAutoCastTraits< TCString<TChar>, characters::Policy::ExplicitOnly, std::remove_cv_t<T> >::value ) | |
| constexpr | operator T () const |
| TChar | operator[] (integer op) const |
Public Method Index: inherited from alib::strings::TString< TChar > | |
| constexpr | TString () noexcept=default |
| template<typename T> requires alib::characters::IsImplicitArraySource<T, TChar> | |
| constexpr | TString (const T &src) noexcept |
| template<typename T> requires alib::characters::IsExplicitArraySource<T, TChar> | |
| constexpr | TString (const T &src) noexcept |
| constexpr | TString (const TChar *pBuffer, integer pLength) noexcept |
| constexpr | TString (const TString &) noexcept=default |
| Defaulted copy constructor. | |
| TString (const_iterator &start, const_iterator &end) | |
| constexpr | TString (lang::IsNullptr auto const &) noexcept |
Constructor accepting nullptr. Constructs a nulled string. | |
| template<typename T> requires alib::characters::IsMutableArraySource<T, TChar> | |
| constexpr | TString (T &src) noexcept |
| template<typename TAllocator> requires alib::lang::IsAllocator<TAllocator> | |
| TString (TAllocator &allocator, const TString< TChar > ©) | |
| constexpr | TString (TString &&) noexcept=default |
| Defaulted move constructor. | |
| template<typename T> requires ( alib::characters::IsImplicitArrayCast<T, TChar> && !alib::strings::NoAutoCastTraits< TString<TChar>, characters::Policy::Implicit, std::remove_cv_t<T> >::value ) | |
| constexpr | operator T () const |
| template<typename T> requires ( alib::characters::IsExplicitArrayCast<T, TChar> && !alib::strings::NoAutoCastTraits< TString<TChar>, characters::Policy::ExplicitOnly, std::remove_cv_t<T> >::value ) | |
| constexpr | operator T () const |
| constexpr TString & | operator= (const TString &) noexcept=default |
| constexpr TString & | operator= (TString &&) noexcept=default |
| constexpr const TChar * | Buffer () const |
| constexpr integer | Length () const |
| integer | WStringLength () const |
| constexpr bool | IsNull () const |
| constexpr bool | IsNotNull () const |
| constexpr bool | IsEmpty () const |
| constexpr bool | IsNotEmpty () const |
| template<typename TCheck = CHK> | |
| TString< TChar > | Substring (integer regionStart, integer regionLength=MAX_LEN) const |
| template<typename TCheck = CHK> | |
| TChar | CharAt (integer idx) const |
| template<typename TCheck = CHK> | |
| TChar | CharAtStart () const |
| template<typename TCheck = CHK> | |
| TChar | CharAtEnd () const |
| TChar | operator[] (integer idx) const |
| std::size_t | Hashcode () const |
| std::size_t | HashcodeIgnoreCase () const |
| template<typename TCheck = CHK, lang::Case TSensitivity = lang::Case::Sensitive> | |
| bool | Equals (const TString< TChar > &rhs) const |
| template<typename TCheck = CHK, lang::Case TSensitivity = lang::Case::Sensitive> | |
| int | CompareTo (const TString< TChar > &rhs) const |
| template<typename TCheck = CHK, lang::Case TSensitivity = lang::Case::Sensitive> | |
| int | CompareTo (const TString &rhs, integer rhsRegionStart, integer rhsRegionLength=MAX_LEN) const |
| template<typename TCheck = CHK, lang::Case TSensitivity = lang::Case::Sensitive> | |
| int | CompareTo (const TString &rhs, integer rhsRegionStart, integer rhsRegionLength, integer regionStart, integer regionLength=MAX_LEN) const |
| template<typename TCheck = CHK, lang::Case TSensitivity = lang::Case::Sensitive> | |
| bool | ContainsAt (const TString &needle, integer pos) const |
| template<typename TCheck = CHK, lang::Case TSensitivity = lang::Case::Sensitive> | |
| bool | StartsWith (const TString &needle) const |
| template<typename TCheck = CHK, lang::Case TSensitivity = lang::Case::Sensitive> | |
| bool | EndsWith (const TString &needle) const |
| template<typename TCheck = CHK> | |
| integer | IndexOf (TChar needle, integer startIdx=0) const |
| template<typename TCheck = CHK> | |
| integer | IndexOf (TChar needle, integer regionStart, integer regionLength) const |
| integer | IndexOfOrLength (TChar needle) const |
| template<typename TCheck = CHK> | |
| integer | IndexOfOrLength (TChar needle, integer startIdx) const |
| template<typename TCheck = CHK> | |
| integer | LastIndexOf (TChar needle, integer startIndex=MAX_LEN) const |
| template<lang::Inclusion TInclusion, typename TCheck = CHK> | |
| integer | IndexOfAny (const TString &needles, integer startIdx=0) const |
| template<lang::Inclusion TInclusion, typename TCheck = CHK> | |
| integer | LastIndexOfAny (const TString &needles, integer startIdx=MAX_LEN) const |
| template<typename TCheck = CHK, lang::Case TSensitivity = lang::Case::Sensitive> | |
| integer | IndexOf (const TString &needle, integer startIdx=0, integer endIdx=strings::MAX_LEN) const |
| template<typename TCheck = CHK> | |
| integer | IndexOfFirstDifference (const TString &needle, lang::Case sensitivity=lang::Case::Sensitive, integer startIdx=0) const |
| integer | IndexOfSegmentEnd (TChar opener, TChar closer, integer idx) const |
| template<typename TCheck = CHK> | |
| integer | CountChar (TChar needle, integer startPos=0) const |
| template<typename TCheck = CHK> | |
| integer | CountChar (TChar needle, TChar omit, integer startPos) const |
| template<typename TCheck = CHK, lang::Case TSensitivity = lang::Case::Sensitive> | |
| integer | Count (const TString &needle, integer startPos=0) const |
| template<typename TCheck = CHK, lang::Case TSensitivity = lang::Case::Sensitive> | |
| integer | Count (const TString &needle, const TString &omit, integer startPos=0) const |
| ALIB_DLL uint64_t | ParseDecDigits (integer startIdx=0, integer *newIdx=nullptr) const |
| ALIB_DLL int64_t | ParseInt (integer startIdx=0, TNumberFormat< TChar > *numberFormat=nullptr, integer *newIdx=nullptr) const |
| int64_t | ParseInt (TNumberFormat< TChar > *numberFormat, integer *newIdx=nullptr) const |
| int64_t | ParseInt (integer *newIdx) const |
| int64_t | ParseInt (integer startIdx, integer *newIdx) const |
| ALIB_DLL uint64_t | ParseDec (integer startIdx=0, TNumberFormat< TChar > *numberFormat=nullptr, integer *newIdx=nullptr) const |
| uint64_t | ParseDec (TNumberFormat< TChar > *numberFormat, integer *newIdx=nullptr) const |
| uint64_t | ParseDec (integer *newIdx) const |
| uint64_t | ParseDec (integer startIdx, integer *newIdx) const |
| ALIB_DLL uint64_t | ParseBin (integer startIdx=0, TNumberFormat< TChar > *numberFormat=nullptr, integer *newIdx=nullptr) const |
| uint64_t | ParseBin (TNumberFormat< TChar > *numberFormat, integer *newIdx=nullptr) const |
| uint64_t | ParseBin (integer *newIdx) const |
| uint64_t | ParseBin (integer startIdx, integer *newIdx) const |
| ALIB_DLL uint64_t | ParseHex (integer startIdx=0, TNumberFormat< TChar > *numberFormat=nullptr, integer *newIdx=nullptr) const |
| uint64_t | ParseHex (TNumberFormat< TChar > *numberFormat, integer *newIdx=nullptr) const |
| uint64_t | ParseHex (integer *newIdx) const |
| uint64_t | ParseHex (integer startIdx, integer *newIdx) const |
| ALIB_DLL uint64_t | ParseOct (integer startIdx=0, TNumberFormat< TChar > *numberFormat=nullptr, integer *newIdx=nullptr) const |
| uint64_t | ParseOct (TNumberFormat< TChar > *numberFormat, integer *newIdx=nullptr) const |
| uint64_t | ParseOct (integer *newIdx) const |
| uint64_t | ParseOct (integer startIdx, integer *newIdx) const |
| ALIB_DLL double | ParseFloat (integer startIdx=0, TNumberFormat< TChar > *numberFormat=nullptr, integer *newIdx=nullptr) const |
| double | ParseFloat (TNumberFormat< TChar > *numberFormat, integer *newIdx=nullptr) const |
| double | ParseFloat (integer *newIdx) const |
| double | ParseFloat (integer startIdx, integer *newIdx) const |
| integer | CopyTo (TChar *dest) const |
| template<typename TAllocator> requires alib::lang::IsAllocator<TAllocator> | |
| void | Allocate (TAllocator &allocator, const TString< TChar > ©) |
| template<typename TAllocator> requires alib::lang::IsAllocator<TAllocator> | |
| void | Free (TAllocator &allocator) |
| const_iterator | begin () const |
| const_iterator | cbegin () const |
| const_iterator | end () const |
| const_iterator | cend () const |
| const_reverse_iterator | rbegin () const |
| const_reverse_iterator | rend () const |
| const_reverse_iterator | crbegin () const |
| const_reverse_iterator | crend () const |
| size_type | size () const |
| bool | AdjustRegion (integer ®ionStart, integer ®ionLength) const |
Protected Type Index: | |
| using | base = TString<TChar> |
| Shortcut to the base type. | |
Additional Inherited Members | |
Public Type Index: inherited from alib::strings::TString< TChar > | |
| using | size_type = integer |
| The type defining sizes of strings. | |
| using | value_type = TChar |
Exposes template parameter TChar to the outer world in a std compatible way. | |
| using | const_iterator = TRandomAccessIterator<const TChar> |
| using | const_reverse_iterator = std::reverse_iterator<const_iterator> |
Protected Field Index: inherited from alib::strings::TString< TChar > | |
| const TChar * | buffer |
| integer | length |
Protected Method Index: inherited from alib::strings::TString< TChar > | |
| template<lang::Case TSensitivity = lang::Case::Sensitive> | |
| ALIB_DLL integer | indexOfString (const TString &needle, integer startIdx, integer endIdx) const |
|
protected |
Shortcut to the base type.
Definition at line 34 of file cstring.inl.
|
inlineexplicitconstexpr |
Constructor accepting a pointer to a character array and a string length.
'\0' character.| pBuffer | The buffer to use. |
| contentLength | The length of the content in the given buffer. |
Definition at line 50 of file cstring.inl.
|
inlineconstexprnoexcept |
Constructor accepting nullptr. Constructs a nulled string.
Definition at line 62 of file cstring.inl.
|
inlineconstexpr |
Templated implicit constructor accepting a const reference to an object of a type that satisfies the concept IsImplicitZTArraySource.
Custom types can be enabled for this constructor by specializing the traits-type ZTArrayTraits, which is used for both; the implementation of the concept, and the implementation of this constructor itself.
| T | The type of the given src. Requires satisfying the concept IsImplicitZTArraySource. Deduced by the compiler. |
| src | The source of the string data to copy. |
Definition at line 78 of file cstring.inl.
|
inlineconstexpr |
Templated implicit constructor accepting a const pointer to an object of a type that satisfies the concept IsImplicitZTArraySource.
Custom types can be enabled for this constructor by specializing the traits-type ZTArrayTraits, which is used for both; the implementation of the concept, and the implementation of this constructor itself.
| T | The type of the given src. Requires satisfying the concept IsImplicitZTArraySource. Deduced by the compiler. |
| src | A pointer to the source of the string data to copy. |
Definition at line 103 of file cstring.inl.
|
inlineexplicitconstexpr |
Templated explicit constructor accepting a const reference to an object of a type that satisfies the concept IsExplicitZTArraySource.
Custom types can be enabled for this constructor by specializing the traits-type ZTArrayTraits, which is used for both; the implementation of the concept, and the implementation of this constructor itself.
| T | The type of the given src. Requires satisfying the concept IsExplicitZTArraySource. Deduced by the compiler. |
| src | The source of the string data to copy. |
Definition at line 126 of file cstring.inl.
|
inlineexplicitconstexpr |
Templated explicit constructor accepting a const pointer to an object of a type that satisfies the concept IsExplicitZTArraySource.
Custom types can be enabled for this constructor by specializing the traits-type ZTArrayTraits, which is used for both; the implementation of the concept, and the implementation of this constructor itself.
| T | The type of the given src. Requires satisfying the concept IsExplicitZTArraySource. Deduced by the compiler. |
| src | A pointer to the source of the string data to copy. |
Definition at line 151 of file cstring.inl.
|
inlineexplicitconstexpr |
Templated explicit constructor accepting a mutable reference to an object of a type that satisfies the concept IsMutableZTArraySource.
Custom types can be enabled for this constructor by specializing the traits-type ZTArrayTraits, which is used for both; the implementation of the concept, and the implementation of this constructor itself.
| T | The type of the given src. Requires satisfying the concept IsMutableZTArraySource. Deduced by the compiler. |
| src | The source of the string data to copy. |
Definition at line 176 of file cstring.inl.
|
inlineexplicitconstexpr |
Templated explicit constructor accepting a mutable pointer to an object of a type that satisfies the concept IsMutableZTArraySource.
Custom types can be enabled for this constructor by specializing the traits-type ZTArrayTraits, which is used for both; the implementation of the concept, and the implementation of this constructor itself.
| T | The type of the given src. Requires satisfying the concept IsMutableZTArraySource. Deduced by the compiler. |
| src | A pointer to the source of the string data to copy. |
Definition at line 201 of file cstring.inl.
|
inline |
Constructor which allocates memory including an extra character for zero-termination, copies the given string's contents and lets this CString represent this new zero-terminated character array.
Note that it is up to the using code to duly deallocate the memory, because the destructor of this type does not do so.
| TAllocator | The type of the given allocator, as prototyped with Allocator. Deduced by the compiler. |
| allocator | The allocator to use. |
| copy | The string to copy to the new memory allocated. |
Definition at line 227 of file cstring.inl.
|
inline |
Sets this object to a zero-terminated copy of the given string, allocated in given allocator.
| TAllocator | The type of the given allocator, as prototyped with Allocator. Deduced by the compiler. |
| allocator | The allocator to use. |
| copy | The string to copy to the new memory allocated. |
Definition at line 441 of file cstring.inl.
|
inline |
Deallocates this String's memory in allocator and sets this instance to nulled.
| TAllocator | The type of the given allocator, as prototyped with Allocator. Deduced by the compiler. |
| allocator | The allocator to use. |
Definition at line 465 of file cstring.inl.
|
inline |
Returns the index of the first character which is included, respectively not included in a given set of characters.
This method searches forwards. For backwards search, see String::LastIndexOfAny.
myCString.TString::IndexOfAny<Inclusion::Include>( myString );
| TCheck | Defaults to CHK, which is the normal invocation mode. If <false> is added to the method name, no parameter checks are performed and the needles must not be empty. |
| TInclusion | Denotes whether the search returns the first index that holds a value that is included or that is not excluded in the set of needle characters. |
| needles | Set of characters to be taken into account. |
| startIdx | The index to start the search at. If the given value is less than 0, it is set to 0. If it exceeds the length of the string, the length of the string is returned. Defaults to 0. |
-1 is returned. Definition at line 394 of file cstring.inl.
|
inlineconstexpr |
Templated implicit cast operator constructing an instance of type T from this string instance. This operator requires the type T satisfying the concept IsImplicitZTArrayCast.
Custom types can be enabled for this operator by specializing the traits-type ArrayTraits, which is used for both; the implementation of the concept, and the implementation of this operator itself.
| T | The type to implicitly cast this instance to. Requires satisfying the concept IsImplicitZTArrayCast. Deduced by the compiler. |
Definition at line 261 of file cstring.inl.
|
inlineexplicitconstexpr |
Templated explicit cast operator constructing an instance of type T from this string instance. This operator requires the type T satisfying the concept IsExplicitZTArrayCast.
Custom types can be enabled for this operator by specializing the traits-type ArrayTraits, which is used for both; the implementation of the concept, and the implementation of this operator itself.
| T | The type to implicitly cast this instance to. Deduced by the compiler. |
Definition at line 285 of file cstring.inl.
|
inlineconstexpr |
Templated implicit cast operator constructing an instance of type T from this string instance. This operator requires the type T satisfying the concept IsImplicitZTArrayCast.
Custom types can be enabled for this operator by specializing the traits-type ZTArrayTraits, which is used for both; the implementation of the concept, and the implementation of this operator itself.
| T | The type to implicitly cast this instance to. Requires satisfying the concept IsImplicitZTArrayCast. Deduced by the compiler. |
Definition at line 310 of file cstring.inl.
|
inlineexplicitconstexpr |
Templated explicit cast operator constructing an instance of type T from this string instance. This operator requires the type T satisfying the concept IsExplicitZTArrayCast.
Custom types can be enabled for this operator by specializing the traits-type ZTArrayTraits, which is used for both; the implementation of the concept, and the implementation of this operator itself.
| T | The type to explicitly cast this instance to. Deduced by the compiler. |
Definition at line 333 of file cstring.inl.
|
inline |
Reads a character at a given index.
Overrides String::operator[] to change the debug assertion to allow inclusion of the termination character.
| op | The index of the character within this object's buffer. |
Definition at line 349 of file cstring.inl.