ALib C++ Library
Library Version: 2402 R1
Documentation generated by doxygen
Loading...
Searching...
No Matches
TMAString< TChar > Class Template Reference

Description:

template<typename TChar>
class alib::monomem::TMAString< TChar >

The name of this class stands for "monotonically allocated string". Consequently, it publicly derives from AString and provides some special constructors that perform an initial allocation using a given MonoAllocator . The constructors allow to specify an (additional) capacity to allocate, besides what is needed when copying the construction parameter.

If the string exceeds this initial capacity, dynamic memory is allocated, just likewise class LocalString does, in the case its stack-memory is exceeded.

If it is assured that no dynamic allocation was performed during the life-cycle of an instance, the instance does not need to be destructed. In this case, the instance itself might be allocated in the same MonoAllocator (without performing additional precautions for proper destruction).

Template Parameters
TCharThe character type.
Alias names for specializations of this class using character types character , nchar , wchar , xchar , complementChar and strangeChar are provided in namespace alib with type definitions MAString , NMAString , WMAString , XMAString , ComplementMAString and StrangeMAString .

Definition at line 47 of file mastring.hpp.

#include <mastring.hpp>

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

Public Method Index:

 TMAString (MonoAllocator &allocator, const strings::TString< TChar > &src, integer additionalCapacity)
 
template<typename TInitialValue >
 TMAString (MonoAllocator &allocator, const TInitialValue &initialValue, integer additionalCapacity)
 
 TMAString (MonoAllocator &allocator, integer pCapacity)
 
- Public Method Index: inherited from TAString< TChar >
constexpr TAString ()
 
 TAString (const TAString &copy)
 
 TAString (TAString &&move) noexcept
 
template<class TAppendable >
 TAString (const TAppendable &src)
 
 ~TAString () noexcept
 
template<typename TCharArray >
 operator TCharArray () const
 
template<typename TCharArray >
 operator TCharArray () const
 
TAStringoperator= (const TAString &copy)
 
ALIB_API void SetBuffer (integer newCapacity)
 
ALIB_API void SetBuffer (TChar *extBuffer, integer extBufferSize, integer extLength=0, lang::Responsibility responsibility=lang::Responsibility::KeepWithSender)
 
void EnsureRemainingCapacity (integer spaceNeeded)
 
void GrowBufferAtLeastBy (integer minimumGrowth)
 
integer Capacity () const
 
bool HasInternalBuffer () const
 
void SetNull ()
 
const TChar * Terminate () const
 
TChar * VBuffer () const
 
template<bool TCheck = true>
void SetCharAt (integer idx, TChar c)
 
TChar & operator[] (integer idx)
 
void SetLength (integer newLength)
 
void DetectLength ()
 
TAStringShortenTo (integer newLength)
 
template<bool TCheck = true, typename TCharSrc >
TAStringAppend (const TCharSrc *src, integer srcLength)
 
template<bool TCheck = true>
TAStringAppend (const TChar *src, integer srcLength)
 
template<bool TCheck = true>
TAStringAppend (const TString< TChar > &src, integer regionStart, integer regionLength=MAX_LEN)
 
template<bool TCheck = true>
TAString_ (const TString< TChar > &src, integer regionStart, integer regionLength=MAX_LEN)
 
TAStringNewLine ()
 
template<bool TCheck = true, typename TAppendable >
TAStringAppend (const TAppendable &src)
 
template<bool TCheck = true, class TAppendable >
TAString_ (const TAppendable &src)
 
template<class TAppendable >
TAStringoperator<< (const TAppendable &src)
 
TAStringReset ()
 
template<bool TCheck = true, typename TAppendable >
TAStringReset (const TAppendable &src)
 
TAString_ ()
 
template<bool TCheck = true>
TAStringInsertAt (const TString< TChar > &src, integer pos)
 
template<bool TCheck = true>
TAStringInsertChars (TChar c, integer qty)
 
template<bool TCheck = true>
TAStringInsertChars (TChar c, integer qty, integer pos)
 
template<bool TCheck = true>
TAStringDelete (integer regionStart, integer regionLength=MAX_LEN)
 
template<bool TCheck = true>
TAStringDeleteStart (integer regionLength)
 
template<bool TCheck = true>
TAStringDeleteEnd (integer regionLength)
 
ALIB_API TAStringTrim (const TCString< TChar > &trimChars=TT_StringConstants< TChar >::DefaultWhitespaces())
 
ALIB_API integer TrimAt (integer idx, const TCString< TChar > &trimChars=TT_StringConstants< TChar >::DefaultWhitespaces())
 
TAStringTrimStart (const TCString< TChar > &trimChars=TT_StringConstants< TChar >::DefaultWhitespaces())
 
TAStringTrimEnd (const TCString< TChar > &trimChars=TT_StringConstants< TChar >::DefaultWhitespaces())
 
template<bool TCheck = true>
TAStringReplaceSubstring (const TString< TChar > &src, integer regionStart, integer regionLength)
 
template<bool TCheck = true>
TAStringReplaceRegion (TChar c, integer regionStart, integer regionLength)
 
ALIB_API integer SearchAndReplace (TChar needle, TChar replacement, integer startIdx=0)
 
ALIB_API integer SearchAndReplace (const TString< TChar > &needle, const TString< TChar > &replacement, integer startIdx=0, integer maxReplacements=MAX_LEN, lang::Case sensitivity=lang::Case::Sensitive)
 
template<bool TCheck = true>
TAStringToUpper (integer regionStart=0, integer regionLength=MAX_LEN)
 
template<bool TCheck = true>
TAStringToLower (integer regionStart=0, integer regionLength=MAX_LEN)
 
template<bool TCheck = true>
TAStringReverse (integer regionStart=0, integer regionLength=MAX_LEN)
 
ALIB_WARNINGS_ALLOW_UNSAFE_BUFFER_USAGE Iterator begin ()
 
Iterator end ()
 
ALIB_WARNINGS_RESTORE ReverseIterator rbegin ()
 
ReverseIterator rend ()
 
void dbgCheck () const
 
void DbgDisableBufferReplacementWarning ()
 
- 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 TAString< TChar >
using Iterator = typename TString<TChar>::template TRandomAccessIterator<TChar>
 
using ReverseIterator = std::reverse_iterator<Iterator>
 
- 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::

◆ TMAString() [1/3]

template<typename TChar >
TMAString ( MonoAllocator & allocator,
integer pCapacity )
inline

Allocates a scope string of given capacity.

Parameters
allocatorThe monotonic allocator to take the initial memory from.
pCapacityThe capacity of the of the string.

Definition at line 56 of file mastring.hpp.

◆ TMAString() [2/3]

template<typename TChar >
TMAString ( MonoAllocator & allocator,
const strings::TString< TChar > & src,
integer additionalCapacity )
inline

Allocates a scope string of given capacity plus the length of the string src and copies source to it.

Parameters
allocatorThe monotonic allocator to take the initial memory from.
srcThe source string to copy.
additionalCapacityThe extra capacity to allocate.

Definition at line 68 of file mastring.hpp.

Here is the call graph for this function:

◆ TMAString() [3/3]

template<typename TChar >
template<typename TInitialValue >
TMAString ( MonoAllocator & allocator,
const TInitialValue & initialValue,
integer additionalCapacity )
inline

Returns a string with contents of the given initialValue written at the start. and the given additional capacity.
Internally, a LocalString<1024> is used to first convert initialValue to a string, which is then copied to this object.

Template Parameters
TInitialValueThe type of the initial object to write into the string.
Parameters
allocatorThe monotonic allocator to take the initial memory from.
initialValueA boxed object to write to the start of the string.
additionalCapacityAdditional capacity to allocate in scope .

Definition at line 86 of file mastring.hpp.

Here is the call graph for this function:

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