ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::strings::TStringNZT< TChar > Class Template Reference

Description:

template<typename TChar>
class alib::strings::TStringNZT< TChar >

This is rather a helper-class than a genuine string class. While derived from class String, no extension of its interface is offered. Instead, the templated constructor is limited to accepting only string-types that are not zero-terminated.

The class is designed to be used to create API interfaces (i.e., overloaded methods) that accept zero-terminated strings of type CString independently of non-zero-terminated strings: If two overloaded methods accepted type String and CString alternatively, compilation would be ambiguous because the String version would accept zero-terminated strings as well. Therefore, overloaded methods rather must accept this class and CString.

See also
Details and a quick sample are given in chapter 4. Non-Zero-Terminated String Detection of the Programmer's Manual of module ALib Strings.
Template Parameters
TCharThe character type of this string. Alias names of this class using different character types are provided with in namespace alib with type definitions StringNZT, NStringNZT, WStringNZT, and XStringNZT.

Definition at line 36 of file stringnzt.inl.

Inheritance diagram for alib::strings::TStringNZT< TChar >:
[legend]
Collaboration diagram for alib::strings::TStringNZT< TChar >:
[legend]

Public Method Index:

template<typename T>
requires ( characters::IsImplicitArraySource <T, TChar> && !characters::IsImplicitZTArraySource<T, TChar> )
constexpr TStringNZT (const T &src)
 
template<typename T>
requires characters::IsExplicitArraySource <T, TChar>
constexpr TStringNZT (const T &src)
 
template<typename T>
requires ( characters::IsImplicitArraySource <T, TChar> && !characters::IsImplicitZTArraySource<T, TChar> )
constexpr TStringNZT (const T *src)
 
template<typename T>
requires characters::IsExplicitArraySource <T, TChar>
constexpr TStringNZT (const T *src)
 
constexpr TStringNZT (const TChar *pBuffer, integer pLength)
 
template<typename T>
requires characters::IsMutableArraySource<T, TChar>
constexpr TStringNZT (T &src)
 
template<typename T>
requires characters::IsMutableArraySource<T, TChar>
constexpr TStringNZT (T *src)
 
- 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 > &copy)
 
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 TStringoperator= (const TString &) noexcept=default
 
constexpr TStringoperator= (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 > &copy)
 
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 &regionStart, integer &regionLength) const
 

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
 

Constructor(s) / Destructor Details:

◆ TStringNZT() [1/7]

template<typename TChar>
alib::strings::TStringNZT< TChar >::TStringNZT ( const TChar * pBuffer,
integer pLength )
inlineconstexpr

Constructor accepting a pointer to a character array and a string length.

Parameters
pBufferPointer to the start of the character string to represent.
pLengthThe length of the character string to represent.

Definition at line 44 of file stringnzt.inl.

◆ TStringNZT() [2/7]

template<typename TChar>
template<typename T>
requires ( characters::IsImplicitArraySource <T, TChar> && !characters::IsImplicitZTArraySource<T, TChar> )
alib::strings::TStringNZT< TChar >::TStringNZT ( const T & src)
inlineconstexpr

Templated implicit constructor accepting a const reference to an object of a type that satisfies the concept IsImplicitArraySource while it does not satisfy the concept IsImplicitZTArraySource.
In other words, this implicit constructor accepts only non-zero-terminated character arrays.

Template Parameters
TThe type of the given src.
Parameters
srcThe source of the string data to copy.

Definition at line 59 of file stringnzt.inl.

◆ TStringNZT() [3/7]

template<typename TChar>
template<typename T>
requires ( characters::IsImplicitArraySource <T, TChar> && !characters::IsImplicitZTArraySource<T, TChar> )
alib::strings::TStringNZT< TChar >::TStringNZT ( const T * src)
inlineconstexpr

Templated implicit constructor accepting a const pointer to an object of a type that satisfies the concept IsImplicitArraySource while it does not satisfy the concept IsImplicitZTArraySource.
In other words, this implicit constructor accepts only non-zero-terminated character arrays.

Template Parameters
TThe type of the given src.
Parameters
srcThe source of the string data to copy.

Definition at line 74 of file stringnzt.inl.

◆ TStringNZT() [4/7]

template<typename TChar>
template<typename T>
requires characters::IsExplicitArraySource <T, TChar>
alib::strings::TStringNZT< TChar >::TStringNZT ( const T & src)
inlineexplicitconstexpr

Templated implicit constructor accepting a const reference to an object of a type that satisfies the concept IsExplicitArraySource.

Template Parameters
TThe type of the given src.
Parameters
srcThe source of the string data to copy.

Definition at line 86 of file stringnzt.inl.

◆ TStringNZT() [5/7]

template<typename TChar>
template<typename T>
requires characters::IsExplicitArraySource <T, TChar>
alib::strings::TStringNZT< TChar >::TStringNZT ( const T * src)
inlineexplicitconstexpr

Templated implicit constructor accepting a const pointer to an object of a type that satisfies the concept IsExplicitArraySource.

Template Parameters
TThe type of the given src.
Parameters
srcThe source of the string data to copy.

Definition at line 97 of file stringnzt.inl.

◆ TStringNZT() [6/7]

template<typename TChar>
template<typename T>
requires characters::IsMutableArraySource<T, TChar>
alib::strings::TStringNZT< TChar >::TStringNZT ( T & src)
inlineexplicitconstexpr

Templated implicit constructor accepting a mutable reference to an object of a type that satisfies the concept IsMutableArraySource.

Template Parameters
TThe type of the given src.
Parameters
srcThe source of the string data to copy.

Definition at line 108 of file stringnzt.inl.

◆ TStringNZT() [7/7]

template<typename TChar>
template<typename T>
requires characters::IsMutableArraySource<T, TChar>
alib::strings::TStringNZT< TChar >::TStringNZT ( T * src)
inlineexplicitconstexpr

Templated implicit constructor accepting a mutable pointer to an object of a type that satisfies the concept IsMutableArraySource.

Template Parameters
TThe type of the given src.
Parameters
srcThe source of the string data to copy.

Definition at line 119 of file stringnzt.inl.


The documentation for this class was generated from the following file: