7#include "Arp/Base/Core/Detail/PrimitiveTypes.hpp"
13#include <initializer_list>
16#ifndef ARP_INSIDE_ARP_BASE_CORE_ARP_H
17 #error Never include 'BasicString.hxx' directly, just include 'Arp.hpp'
20namespace Arp {
namespace Base {
namespace Core
32template<
class C,
class A = std::allocator<C>>
48 using Tokens = std::vector<SelfType>;
49 using AppendToken = std::function < void(
SelfType&&) >;
50 using Bytes = std::vector<byte>;
59 using pointer =
typename AllocatorTraits::pointer;
115 Tokens Split(
CharType delimiter,
bool trimTokens =
true,
bool removeEmptyTokens =
true)
const;
116 Tokens Split(std::span<const CharType> delimiters,
bool trimTokens =
true,
bool removeEmptyTokens =
true)
const;
118 void Split(
CharType delimiter,
bool trimTokens,
bool removeEmptyTokens, AppendToken appendToken)
const;
119 void Split(std::span<const CharType> delimiters,
bool trimTokens,
bool removeEmptyTokens, AppendToken appendToken)
const;
120 void SplitByWord(
const SelfType& delimiter,
bool trimTokens,
bool removeEmptyTokens, AppendToken appendToken)
const;
124 template<
typename... Args>
static SelfType Format(
const char* format,
const Args& ... args);
125 template<
typename... Args>
static SelfType FormatPrintf(
const char* format,
const Args& ... args);
133template<
class C,
class A>
136template <
class C,
class A>
This template class implements the extensions of class String related to std::string,...
Definition: BasicString.hxx:34
typename StdString::difference_type difference_type
The difference type of this type.
Definition: BasicString.hxx:56
typename AllocatorTraits::pointer pointer
The pointer type of this type.
Definition: BasicString.hxx:59
BasicString(SelfType &&arg) noexcept
This move constructor moves the as argument passed string to this string.
static SelfType FormatPrintf(const char *format, const Args &... args)
Formats the format C-string using the printf syntax with the given variadic arguments.
Definition: BasicString.inl:280
SelfType & operator=(const SelfType &arg)
This assignment operator copies the right-hand-side operand to this string.
typename StdString::const_iterator ConstIterator
The iterator type of this type.
Definition: BasicString.hxx:45
std::allocator_traits< Allocator > AllocatorTraits
The allocator type traits.
Definition: BasicString.hxx:37
CharType value_type
The char type of this type.
Definition: BasicString.hxx:54
std::basic_string< CharType, std::char_traits< CharType >, Allocator > StdString
The type of the basic std string.
Definition: BasicString.hxx:41
typename StdString::size_type size_type
The size type of this type.
Definition: BasicString.hxx:55
typename StdString::reverse_iterator reverse_iterator
The reverse iterator type of this type.
Definition: BasicString.hxx:63
Allocator GetAllocator(void) const
Gets the allocator of this string.
Definition: BasicString.inl:309
SelfType & operator=(SelfType &&arg) noexcept
This move assignment operator moves the right-hand-side operand to this string.
typename StdString::reference Reference
The reference type of this type.
Definition: BasicString.hxx:42
typename AllocatorTraits::const_pointer const_pointer
The const pointer type of this type.
Definition: BasicString.hxx:60
static SelfType Format(const SelfType &format, const Args &... args)
Formats the format string using the .NET/Python syntax with the given variadic arguments.
Definition: BasicString.inl:255
std::vector< SelfType > Tokens
Used by initializing operations.
Definition: BasicString.hxx:48
typename StdString::const_reference ConstReference
The const reference type of this type.
Definition: BasicString.hxx:43
Tokens SplitByWord(const SelfType &delimiter, bool trimTokens=true, bool removeEmptyTokens=true) const
Splits this string into tokens using the specified (single) delimiter string.
Definition: BasicString.inl:435
C CharType
The character type.
Definition: BasicString.hxx:38
typename StdString::reverse_iterator ReverseIterator
The iterator type of this type.
Definition: BasicString.hxx:46
Arp::Base::Core::char8u Char8uType
The UTF8 character type.
Definition: BasicString.hxx:39
typename StdString::iterator iterator
The iterator type of this type.
Definition: BasicString.hxx:61
typename StdString::const_reverse_iterator const_reverse_iterator
The const reverse iterator type of this type.
Definition: BasicString.hxx:64
typename StdString::const_reference const_reference
The const reference type of this type.
Definition: BasicString.hxx:58
BasicString(const SelfType &arg)
The copy constructor copies the as argument passed string deeply.
BasicString(void)
The default constructor constructs an empty string instance.
Allocator allocator_type
The allocator type of this type.
Definition: BasicString.hxx:53
typename StdString::const_iterator const_iterator
The const iterator type of this type.
Definition: BasicString.hxx:62
typename StdString::iterator Iterator
The iterator type of this type.
Definition: BasicString.hxx:44
A Allocator
The characters allocator type.
Definition: BasicString.hxx:36
typename StdString::const_reverse_iterator ConstReverseIterator
Used by Split() operations.
Definition: BasicString.hxx:47
~BasicString(void)
The destructor deallocates all memory of this instance.
typename StdString::reference reference
The reference type of this type.
Definition: BasicString.hxx:57
StdString & GetStdString(void)
Gets the basic std string.
Definition: BasicString.inl:293
SelfType & ReplaceAll(const SelfType &pattern, const SelfType &replacement)
Replaces a given pattern by a replacement string.
Definition: BasicString.inl:231
Tokens Split(CharType delimiter, bool trimTokens=true, bool removeEmptyTokens=true) const
Splits this string into tokens using the specified delimiter characters (multiple).
Definition: BasicString.inl:406
char8_t char8u
The Arp UTF8 character type of 1 byte size.
Definition: PrimitiveTypes.hpp:47
Root namespace for the PLCnext API