ALib C++ Library
Library Version: 2402 R1
Documentation generated by doxygen
Loading...
Searching...
No Matches
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 accept 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 from 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. Alias names of this class using character types character , nchar , wchar and xchar are provided with in namespace alib with type definitions StringNZT , NStringNZT , WStringNZT and XStringNZT .

Definition at line 41 of file stringnzt.hpp.

#include <stringnzt.hpp>

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

Public Method Index:

constexpr TStringNZT (const TChar *pBuffer, integer pLength)
 
template<typename TCharArray >
constexpr TStringNZT (const TCharArray &src)
 
- Public Method Index: inherited from TString< TChar >
constexpr TString () noexcept=default
 
constexpr TString (const TString &) noexcept=default
 
constexpr TString (TString &&) noexcept=default
 
TStringoperator= (const TString &) noexcept=default
 
TStringoperator= (TString &&) noexcept=default
 
constexpr TString (const TChar *pBuffer, integer pLength) noexcept
 
template<typename TCharArray >
constexpr TString (const TCharArray &src)
 
template<typename TCharArray >
 operator TCharArray () const
 
template<typename TCharArray >
 operator TCharArray () const
 
template<bool TCheck = true>
TString< TChar > Substring (integer regionStart, integer regionLength=MAX_LEN) const
 
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<bool TCheck = true>
TChar CharAt (integer idx) const
 
template<bool TCheck = true>
TChar CharAtStart () const
 
template<bool TCheck = true>
TChar CharAtEnd () const
 
TChar operator[] (integer idx) const
 
std::size_t Hashcode () const
 
std::size_t HashcodeIgnoreCase () const
 
template<bool TCheck = true, lang::Case TSensitivity = lang::Case::Sensitive>
bool Equals (const TString< TChar > &rhs) const
 
template<bool TCheck = true, lang::Case TSensitivity = lang::Case::Sensitive>
int CompareTo (const TString< TChar > &rhs) const
 
template<bool TCheck = true, lang::Case TSensitivity = lang::Case::Sensitive>
int CompareTo (const TString &rhs, integer rhsRegionStart, integer rhsRegionLength=MAX_LEN) const
 
template<bool TCheck = true, lang::Case TSensitivity = lang::Case::Sensitive>
int CompareTo (const TString &rhs, integer rhsRegionStart, integer rhsRegionLength, integer regionStart, integer regionLength=MAX_LEN) const
 
template<bool TCheck = true, lang::Case TSensitivity = lang::Case::Sensitive>
bool ContainsAt (const TString &needle, integer pos) const
 
template<bool TCheck = true, lang::Case TSensitivity = lang::Case::Sensitive>
bool StartsWith (const TString &needle) const
 
template<bool TCheck = true, lang::Case TSensitivity = lang::Case::Sensitive>
bool EndsWith (const TString &needle) const
 
template<bool TCheck = true>
integer IndexOf (TChar needle, integer startIdx=0) const
 
template<bool TCheck = true>
integer IndexOf (TChar needle, integer regionStart, integer regionLength) const
 
integer IndexOfOrLength (TChar needle) const
 
template<bool TCheck = true>
ALIB_WARNINGS_ALLOW_UNSAFE_BUFFER_USAGE integer IndexOfOrLength (TChar needle, integer startIdx) const
 
template<bool TCheck = true>
ALIB_WARNINGS_RESTORE integer LastIndexOf (TChar needle, integer startIndex=MAX_LEN) const
 
template<lang::Inclusion TInclusion, bool TCheck = true>
integer IndexOfAny (const TString &needles, integer startIdx=0) const
 
template<lang::Inclusion TInclusion, bool TCheck = true>
integer LastIndexOfAny (const TString &needles, integer startIdx=MAX_LEN) const
 
template<bool TCheck = true, lang::Case TSensitivity = lang::Case::Sensitive>
integer IndexOf (const TString &needle, integer startIdx=0) const
 
template<bool TCheck = true>
integer IndexOfFirstDifference (const TString &needle, lang::Case sensitivity=lang::Case::Sensitive, integer idx=0) const
 
integer IndexOfSegmentEnd (TChar opener, TChar closer, integer idx) const
 
template<bool TCheck = true>
integer CountChar (TChar needle, integer startPos=0) const
 
template<bool TCheck = true>
integer CountChar (TChar needle, TChar omit, integer startPos) const
 
template<bool TCheck = true, lang::Case TSensitivity = lang::Case::Sensitive>
integer Count (const TString &needle, integer startPos=0) const
 
template<bool TCheck = true, lang::Case TSensitivity = lang::Case::Sensitive>
integer Count (const TString &needle, const TString &omit, integer startPos=0) const
 
ALIB_API uint64_t ParseDecDigits (integer startIdx=0, integer *newIdx=nullptr) const
 
ALIB_API 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_API 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_API 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_API 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_API 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_API 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
 
bool AdjustRegion (integer &regionStart, integer &regionLength) const
 
ConstIterator begin () const
 
ConstIterator cbegin () const
 
ALIB_WARNINGS_ALLOW_UNSAFE_BUFFER_USAGE ConstIterator end () const
 
ConstIterator cend () const
 
ALIB_WARNINGS_RESTORE ConstReverseIterator rbegin () const
 
ConstReverseIterator rend () const
 
ConstReverseIterator crbegin () const
 
ConstReverseIterator crend () const
 
 TString (ConstIterator &start, ConstIterator &end)
 

Additional Inherited Members

- Public Type Index: inherited from TString< TChar >
using CharType = TChar
 
using ConstIterator = TRandomAccessIterator<const TChar>
 
using ConstReverseIterator = std::reverse_iterator<ConstIterator>
 

Constructor(s) / Destructor Details::

◆ TStringNZT() [1/2]

template<typename TChar >
constexpr 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 52 of file stringnzt.hpp.

◆ TStringNZT() [2/2]

template<typename TChar >
template<typename TCharArray >
constexpr TStringNZT ( const TCharArray & src)
inlineconstexpr

Templated constructor that accepts C++ string types which are not zero-terminated.

Template Parameters
TCharArrayType that comprises a non-zero-terminated character array.
Parameters
srcThe source object.

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