PLCnext API Documentation  22.9.0.33
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
Arp::BasicString< C, Alloc > Class Template Reference

#include <BasicString.hxx>

Public Types

using Allocator = Alloc
 The characters allocator type.
 
using AllocatorTraits = std::allocator_traits< Alloc >
 
using CharType = C
 The character type.
 
using SelfType = BasicString< CharType, Allocator >
 The self type.
 
using BaseString = std::basic_string< CharType, std::char_traits< CharType >, Allocator >
 The type of the basic std string.
 
using Tokens = std::vector< SelfType >
 Used by Split() operation.
 
using allocator_type = Allocator
 The allocator type of this type.
 
using value_type = CharType
 The char type of this type.
 
using size_type = typename BaseString::size_type
 The size type of this type.
 
using difference_type = typename BaseString::difference_type
 The difference type of this type.
 
using reference = typename BaseString::reference
 The reference type of this type.
 
using const_reference = typename BaseString::const_reference
 The const reference type of this type.
 
using pointer = typename AllocatorTraits::pointer
 The pointer type of this type.
 
using const_pointer = typename AllocatorTraits::const_pointer
 The const pointer type of this type.
 
using iterator = typename BaseString::iterator
 The iterator type of this type.
 
using const_iterator = typename BaseString::const_iterator
 The const iterator type of this type.
 
using reverse_iterator = typename BaseString::reverse_iterator
 The reverse iterator type of this type.
 
using const_reverse_iterator = typename BaseString::const_reverse_iterator
 The const reverse iterator type of this type.
 

Public Member Functions

 BasicString ()=default
 The default constructor constructs an empty string instance. More...
 
 BasicString (const SelfType &arg)=default
 The copy constructor copies the as argument passed string deeply. More...
 
 BasicString (const SelfType &arg, const Allocator &alloc)
 This constructor copies the as argument passed string deeply. More...
 
 BasicString (const Allocator &alloc)
 This constructor creates an empty string instance. More...
 
 BasicString (const SelfType &arg, size_type offset, size_type count=NPos)
 This constructor copies the as argument passed string partially. More...
 
 BasicString (const SelfType &arg, size_type offset, size_type count, const Allocator &alloc)
 This constructor copies the as argument passed string partially. More...
 
 BasicString (const CharType *pChars, size_type count)
 This constructor copies the as argument passed C-string. More...
 
 BasicString (const CharType *pChars, size_type count, const Allocator &alloc)
 This constructor copies the as argument passed C-string. More...
 
 BasicString (const CharType *pChars)
 This constructor copies the as argument passed C-string. More...
 
 BasicString (const CharType *pChars, const Allocator &alloc)
 This constructor copies the as argument passed C-string. More...
 
 BasicString (size_type count, CharType c)
 Fills the string with count consecutive copies of character c . More...
 
 BasicString (size_type count, CharType c, const Allocator &alloc)
 Fills the string with count consecutive copies of character c . More...
 
 BasicString (SelfType &&arg) noexcept=default
 This move constructor moves the as argument passed string to this string. More...
 
 BasicString (SelfType &&arg, const Allocator &alloc)
 This move constructor moves the as argument passed string to this string. More...
 
 BasicString (std::initializer_list< CharType > arg, const Allocator &alloc=Allocator())
 Copies each of the characters in initList , in the same order. More...
 
 BasicString (iterator first, iterator last, const Allocator &alloc=Allocator())
 Copies the sequence of characters in the range [first,last), in the same order.. More...
 
 BasicString (const_iterator first, const_iterator last, const Allocator &alloc=Allocator())
 Copies the sequence of characters in the range [first,last), in the same order.. More...
 
 BasicString (const BaseString &arg)
 This copy constructor copies the as argument passed std::string to this string. More...
 
 BasicString (BaseString &&arg)
 This move constructor moves the as argument passed std::string to this string. More...
 
 ~BasicString ()=default
 The destructor deallocates all memory of this instance. More...
 
SelfTypeoperator= (SelfType &&right) noexcept=default
 This move assignment operator moves the right-hand-side operand to this string. More...
 
SelfTypeoperator= (std::initializer_list< CharType > right)
 This assignment operator copies each of the characters in the right-hand-side operand to this string, in the same order. More...
 
SelfTypeoperator= (const SelfType &right)=default
 This assignment operator copies the the right-hand-side operand to this string. More...
 
SelfTypeoperator= (const CharType *right)
 This assignment operator copies the right-hand-side operand to this string. More...
 
SelfTypeoperator= (CharType c)
 This assignment operator copies the right-hand-side operand to this string. More...
 
SelfTypeoperator+= (std::initializer_list< CharType > right)
 This assignment operator appends each of the characters in the right-hand-side operand to this string, in the same order. More...
 
SelfTypeoperator+= (const SelfType &right)
 This assignment operator appends the the right-hand-side operand to this string. More...
 
SelfTypeoperator+= (const CharType *right)
 This assignment operator appends the the right-hand-side operand to this string. More...
 
SelfTypeoperator+= (CharType c)
 This assignment operator appends the the right-hand-side operand to this string. More...
 
SelfTypeAssign (SelfType &&arg)
 This operation moves the as argument passed string to this string. More...
 
SelfTypeAssign (std::initializer_list< CharType > arg)
 This operation copies each of the characters in the argument to this string, in the same order. More...
 
SelfTypeAssign (const SelfType &arg)
 This operation copies the the argument to this string. More...
 
SelfTypeAssign (const SelfType &arg, size_type offset, size_type count=NPos)
 This operation copies the as argument passed string partially. More...
 
SelfTypeAssign (const BaseString &arg)
 This operation copies the argument to this string. More...
 
SelfTypeAssign (BaseString &&arg)
 This operation moves the argument to this string. More...
 
SelfTypeAssign (const CharType *pChars, size_type count)
 This operation copies the as argument passed C-string partially. More...
 
SelfTypeAssign (const CharType *pChars)
 This operation copies the as argument passed C-string. More...
 
SelfTypeAssign (size_type count, CharType c)
 Fills this string with count consecutive copies of character c . More...
 
SelfTypeAssign (iterator first, iterator last)
 Copies the sequence of characters in the range [first,last), in the same order. More...
 
SelfTypeAssign (const_iterator first, const_iterator last)
 Copies the sequence of characters in the range [first,last), in the same order. More...
 
SelfTypeAssign (const_pointer first, const_pointer last)
 Copies the sequence of characters in the range [first,last), in the same order. More...
 
SelfTypeAppend (std::initializer_list< CharType > arg)
 This operation appends each of the characters in the argument to this string, in the same order. More...
 
SelfTypeAppend (const SelfType &arg)
 This operation appends the the argument to this string. More...
 
SelfTypeAppend (const SelfType &arg, size_type offset, size_type count=NPos)
 This operation appends the as argument passed string partially. More...
 
SelfTypeAppend (const CharType *pChars, size_type count)
 This operation appends the as argument passed C-string partially. More...
 
SelfTypeAppend (const CharType *pChars)
 This operation appends the as argument passed C-string. More...
 
SelfTypeAppend (size_type count, CharType c)
 Appends to this string count consecutive copies of character c . More...
 
SelfTypeAppend (iterator first, iterator last)
 Appends the sequence of characters in the range [first,last), in the same order. More...
 
SelfTypeAppend (const_iterator first, const_iterator last)
 Appends the sequence of characters in the range [first,last), in the same order. More...
 
SelfTypeAppend (const_pointer first, const_pointer last)
 Appends the sequence of characters in the range [first,last), in the same order. More...
 
iterator Insert (const_iterator where, std::initializer_list< CharType > arg)
 This operation inserts each of the characters in the argument to this string, in the same order. More...
 
SelfTypeInsert (size_type offset, const SelfType &arg)
 This operation inserts the the argument at the given position. More...
 
SelfTypeInsert (size_type offset, const SelfType &arg, size_type argOffset, size_type count=NPos)
 This operation inserts the as argument passed string partially. More...
 
SelfTypeInsert (size_type offset, const CharType *pChars, size_type count)
 This operation inserts the as argument passed string partially. More...
 
SelfTypeInsert (size_type offset, const CharType *pChars)
 This operation inserts the as argument passed string. More...
 
SelfTypeInsert (size_type offset, size_type count, CharType c)
 Inserts count consecutive copies of character c at position offset . More...
 
iterator Insert (const_iterator where, CharType c)
 Inserts character c at position where . More...
 
iterator Insert (const_iterator where, size_type count, CharType c)
 Inserts character c at position where . More...
 
iterator Insert (const_iterator where, iterator first, iterator last)
 Inserts a range of chars [first;last) at position where . More...
 
iterator Insert (const_iterator where, const_iterator first, const_iterator last)
 Inserts a range of chars [first;last) at position where . More...
 
iterator Insert (const_iterator where, const_pointer first, const_pointer last)
 Inserts a range of chars [first;last) at position where . More...
 
SelfTypeErase (size_type offset=0)
 This operation erases chars from this string. More...
 
SelfTypeErase (size_type offset, size_type count)
 This operation erases chars from this string. More...
 
iterator Erase (const_iterator where)
 This operation erases chars from this string. More...
 
iterator Erase (const_iterator first, const_iterator last)
 Erases a range of chars [first;last). More...
 
SelfTypeReplace (const_iterator first, const_iterator last, std::initializer_list< CharType > chars)
 Replaces a range of chars [first;last). More...
 
SelfTypeReplace (size_type offset, size_type length, const SelfType &arg)
 Replaces a range of chars. More...
 
SelfTypeReplace (size_type offset, size_type length, const SelfType &arg, size_type offsetArg, size_type count=NPos)
 Replaces a range of chars. More...
 
SelfTypeReplace (size_type offset, size_type length, const CharType *pChars, size_type count)
 Replaces a range of chars. More...
 
SelfTypeReplace (size_type offset, size_type length, const CharType *pChars)
 Replaces a range of chars. More...
 
SelfTypeReplace (size_type offset, size_type length, size_type count, CharType c)
 Replaces a range of chars by a character. More...
 
SelfTypeReplace (const_iterator first, const_iterator last, const SelfType &arg)
 Replaces a range of chars [first;last). More...
 
SelfTypeReplace (const_iterator first, const_iterator last, const CharType *pChars, size_type count)
 Replaces a range of chars [first;last). More...
 
SelfTypeReplace (const_iterator first, const_iterator last, const CharType *pChars)
 Replaces a range of chars [first;last). More...
 
SelfTypeReplace (const_iterator first, const_iterator last, size_type count, CharType c)
 Replaces a range of chars [first;last). More...
 
SelfTypeReplace (const_iterator first, const_iterator last, iterator first2, iterator last2)
 Replaces a range of chars [first;last). More...
 
SelfTypeReplace (const_iterator first, const_iterator last, const_iterator first2, const_iterator last2)
 Replaces a range of chars [first;last). More...
 
SelfTypeReplace (const_iterator first, const_iterator last, const_pointer first2, const_pointer last2)
 Replaces a range of chars [first;last). More...
 
SelfTypeReplace (const_iterator first, const_iterator last, pointer first2, pointer last2)
 Replaces a range of chars [first;last). More...
 
SelfTypeReplaceAll (const SelfType &pattern, const SelfType &replacement)
 Replaces a given pattern by a replacement string. More...
 
iterator begin ()
 Returns the begin iterator of this string. More...
 
const_iterator begin () const
 Returns the begin iterator of this string. More...
 
iterator end ()
 Returns the end iterator of this string. More...
 
const_iterator end () const
 Returns the end iterator of this string. More...
 
iterator Begin ()
 Returns the begin iterator of this string. More...
 
const_iterator Begin () const
 Returns the begin iterator of this string. More...
 
iterator End ()
 Returns the end iterator of this string. More...
 
const_iterator End () const
 Returns the end iterator of this string. More...
 
reverse_iterator ReverseBegin ()
 Returns the begin iterator of this string for reverse iterating. More...
 
const_reverse_iterator ReverseBegin () const
 Returns the begin iterator of this string for reverse iterating. More...
 
reverse_iterator ReverseEnd ()
 Returns the end iterator of this string for reverse iterating. More...
 
const_reverse_iterator ReverseEnd () const
 Returns the end iterator of this string for reverse iterating. More...
 
const_iterator ConstBegin () const
 Returns the begin iterator of this const string. More...
 
const_iterator ConstEnd () const
 Returns the end iterator of this const string. More...
 
const_reverse_iterator ConstReverseBegin () const
 Returns the begin iterator of this const string for reverse iterating. More...
 
const_reverse_iterator ConstReverseEnd () const
 Returns the end iterator of this const string for reverse iterating. More...
 
void ShrinkToFit ()
 Reduces the capacity of this string to its size. More...
 
void PushBack (CharType c)
 Appends the character c to this string. More...
 
void PopBack ()
 Removes the character at the end of this string. More...
 
reference Front ()
 Returns a reference to the first character in the string. More...
 
const_reference Front () const
 Returns a const reference to the first character in the string. More...
 
reference Back ()
 Returns a reference to the last character in the string. More...
 
const_reference Back () const
 Returns a const reference to the last character in the string. More...
 
reference At (size_type offset)
 Returns a const reference to the character at position offset . More...
 
const_reference At (size_type offset) const
 Returns a const reference to the character at position offset . More...
 
reference operator[] (size_type offset)
 Returns a reference to the character at position offset . More...
 
const_reference operator[] (size_type offset) const
 Returns a const reference to the character at position offset . More...
 
size_type Length () const
 Returns the number of char elements in this string. More...
 
size_type Size () const
 Returns the number of char elements in this string. More...
 
size_type MaxSize () const
 Returns the number maximum size any string might have. More...
 
size_type Capacity () const
 Rceturns the capacity of this string. More...
 
bool IsEmpty () const
 Determines if this string is empty. More...
 
void Resize (size_type newSize)
 Resizes this string to the specified new size. More...
 
void Resize (size_type newSize, CharType c)
 Resizes this string to the specified new size. More...
 
void Reserve (size_type newCapacity=0)
 Reserves memory upto the specified newCapacity . More...
 
void Clear ()
 Clears the content of this string, but does not modify the capacity. More...
 
size_type Find (const SelfType &pattern, size_type offset=0) const
 Finds the first substring which equal to pattern . More...
 
size_type Find (const CharType *pChars, size_type offset, size_type count) const
 Finds the first substring which equal to pChars . More...
 
size_type Find (const CharType *pChars, size_type offset=0) const
 Finds the first substring which equal to pChars . More...
 
size_type Find (CharType c, size_type offset=0) const
 Finds the first char which equal to c . More...
 
size_type ReverseFind (const SelfType &pattern, size_type offset=NPos) const
 Finds the last substring which equal to pattern . More...
 
size_type ReverseFind (const CharType *pChars, size_type offset, size_type count) const
 Finds the last substring which equal to pChars . More...
 
size_type ReverseFind (const CharType *pChars, size_type offset=NPos) const
 Finds the last substring which equal to pChars . More...
 
size_type ReverseFind (CharType c, size_type offset=NPos) const
 Finds the last char which equal to c . More...
 
size_type FindFirstOf (const SelfType &chars, size_type offset=0) const
 Finds the first occurence of any character in chars . More...
 
size_type FindFirstOf (const CharType *pChars, size_type offset, size_type count) const
 Finds the first occurence of any character in pChars . More...
 
size_type FindFirstOf (const CharType *pChars, size_type offset=0) const
 Finds the first occurence of any character in pChars . More...
 
size_type FindFirstOf (CharType c, size_type offset=0) const
 Finds the first occurence of character c . More...
 
size_type FindLastOf (const SelfType &chars, size_type offset=NPos) const
 Finds the last occurence of any character in chars . More...
 
size_type FindLastOf (const CharType *pChars, size_type offset, size_type count) const
 Finds the last occurence of any character in pChars . More...
 
size_type FindLastOf (const CharType *pChars, size_type offset=NPos) const
 Finds the last occurence of any character in pChars . More...
 
size_type FindLastOf (CharType c, size_type offset=NPos) const
 Finds the last occurence of character c . More...
 
size_type FindFirstNotOf (const SelfType &chars, size_type offset=0) const
 Finds the first occurence of any character which is not in chars . More...
 
size_type FindFirstNotOf (const CharType *pChars, size_type offset, size_type count) const
 Finds the first occurence of any character which is not in pChars . More...
 
size_type FindFirstNotOf (const CharType *pChars, size_type offset=0) const
 Finds the first occurence of any character which is not in pChars . More...
 
size_type FindFirstNotOf (CharType c, size_type offset=0) const
 Finds the first occurence of any character which is not equal to c . More...
 
size_type FindLastNotOf (const SelfType &chars, size_type offset=NPos) const
 Finds the last occurence of any character which is not in chars . More...
 
size_type FindLastNotOf (const CharType *pChars, size_type offset, size_type count) const
 Finds the last occurence of any character which is not in pChars . More...
 
size_type FindLastNotOf (const CharType *pChars, size_type offset=NPos) const
 Finds the last occurence of any character which is not in pChars . More...
 
size_type FindLastNotOf (CharType c, size_type offset=NPos) const
 Finds the last occurence of any character which is not equal to c . More...
 
int Compare (const SelfType &other) const
 Compares this string to the other string lexicographical. More...
 
int Compare (size_type offset, size_type count, const SelfType &other) const
 Compares this string to the other string lexicographical. More...
 
int Compare (size_type offset, size_type count, const SelfType &other, size_type offsetOther, size_type countOther=NPos) const
 Compares a substring of this string to a substring of the other string lexicographical. More...
 
int Compare (const CharType *pOther) const
 Compares this string to the pOther string lexicographical. More...
 
int Compare (size_type offset, size_type count, const CharType *pOther) const
 Compares this string to the pOther string lexicographical. More...
 
int Compare (size_type offset, size_type count, const CharType *pOther, size_type countOther) const
 Compares a substring of this string to a substring of the pOther string lexicographical. More...
 
bool StartWith (const CharType *pChars) const
 Determines if this string starts with the pChars C-string. More...
 
bool StartWith (const SelfType &pattern) const
 Determines if this string starts with the pattern string. More...
 
bool EndWith (const CharType *pChars) const
 Determines if this string ends with the pChars C-string. More...
 
bool EndWith (const SelfType &pattern) const
 Determines if this string starts with the pattern string. More...
 
const BaseStringGetBaseString () const
 Gets the basic std string. More...
 
const CharTypeCStr () const
 Gets the character data of this string. More...
 
 operator const CharType * () const
 Converts this string implicitly to a C-string. More...
 
 operator const BaseString & () const
 Converts this string implicitly to a std string. More...
 
SelfType Substr (size_type offset=0, size_type count=NPos) const
 Gets a substring of this string. More...
 
Allocator GetAllocator () const
 Gets the allocator of this string. More...
 
void Swap (SelfType &other)
 Swaps the content of this string with the content of the other string. More...
 
SelfType TrimLeft () const
 
SelfType TrimRight () const
 
SelfType Trim () const
 
Tokens Split (char delimiter, bool trimTokens=true, bool removeEmptyTokens=true) const
 Splits this string into tokens using the specified delimiter characters (multiple). More...
 
Tokens Split (const char delimiters[], size_t delimitersCount, bool trimTokens=true, bool removeEmptyTokens=true) const
 Splits this string into tokens using the specified delimiter characters (multiple). More...
 
Tokens SplitByWord (const SelfType &delimiter, bool trimTokens=true, bool removeEmptyTokens=true) const
 Splits this string into tokens using the specified (single) delimiter string. More...
 

Static Public Member Functions

template<typename... Args>
static SelfType Format (const SelfType &format, const Args &... args)
 Formats the format string using the .NET/Python syntax with the given variadic arguments. More...
 
template<typename... Args>
static SelfType Format (const char *format, const Args &... args)
 Formats the format C-string using the .NET/Python syntax with the given variadic arguments. More...
 

Static Public Attributes

static const size_type NPos = size_type(-1)
 This position value is returned when find operations do not match, or is used as default value for any length parameter meaning 'until the end of the string'. More...
 
static const SelfType Empty
 An emtpy static string instance. More...
 
static const SelfType NewLine
 This static string instance represents the (platform specific) new line string. More...
 

Detailed Description

template<class C, class Alloc = std::allocator<C>>
class Arp::BasicString< C, Alloc >

Template Parameters
CThe char type, this should be char. wchar_t is UTF16 2byte char on Windows, but UTF32 4byte char on Linux.
AllocThe characters allocator type

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