41#include <boost/algorithm/string/replace.hpp>
47using namespace std::literals::string_literals;
67 string(
const char* aString) : iString{ aString } {}
68 string(
const char* aString, std::size_t aLength) : iString{ aString, aLength } {}
69 string(
const std::string& aString = {}) : iString{ aString } {}
70 string(
const std::string_view& aStringView) : iString{ aStringView } {}
75 template <
typename Iter,
typename SFINAE = std::enable_if_t<!std::is_scalar_v<Iter>, sfinae>>
76 string(Iter aBegin, Iter aEnd) : iString{ aBegin, aEnd } {}
92 void clear() final { iString.clear(); }
93 void assign(
const i_container& aOther)
final {
if (&aOther ==
this)
return; iString.assign(aOther.begin(), aOther.end()); }
109 void pop_back() final { iString.erase(iString.end() - 1); }
123 std::ptrdiff_t iterator_offset() const final {
return sizeof(char); }
126 const char*
cdata() const noexcept final {
return iString.data(); }
127 const char*
data() const noexcept final {
return iString.data(); }
128 char*
data() noexcept final {
return iString.data(); }
129 const char*
c_str() const noexcept final {
return iString.c_str(); }
131 void assign(
const i_string& aOther)
final { iString = aOther.to_std_string_view(); }
132 void assign(
const char* aSource,
size_type aSourceLength)
final { iString.assign(aSource, aSourceLength); }
134 void append(
const i_string& aOther)
final { iString.append(aOther.to_std_string_view()); }
135 void append(
const char* aSource,
size_type aSourceLength)
final { iString.append(aSource, aSourceLength); }
137 void replace_all(
const i_string& aSearch,
const i_string& aReplace)
final { boost::replace_all(iString, aSearch.to_std_string_view(), aReplace.to_std_string_view()); }
141 void assign(
string&& aOther) {
if (&aOther ==
this)
return; iString.assign(std::move(aOther.to_std_string())); }
148 inline bool operator==(
const string& lhs,
const string& rhs)
noexcept
150 return lhs.to_std_string_view() == rhs.to_std_string_view();
153 inline std::strong_ordering
operator<=>(
const string& lhs,
const string& rhs)
noexcept
155 return lhs.to_std_string_view() <=> rhs.to_std_string_view();
158 inline bool operator==(
const string& lhs,
const i_string& rhs)
noexcept
160 return lhs.to_std_string_view() == rhs.to_std_string_view();
165 return lhs.to_std_string_view() <=> rhs.to_std_string_view();
168 inline bool operator==(
const i_string& lhs,
const string& rhs)
noexcept
170 return lhs.to_std_string_view() == rhs.to_std_string_view();
175 return lhs.to_std_string_view() <=> rhs.to_std_string_view();
178 inline string operator+(
const string& lhs,
const string& rhs)
189 namespace string_literals
191 inline string operator"" _s(
const char* str,
size_t len)
193 return string{ str, len };
virtual void append(const i_string &aOther)=0
virtual void assign(const i_string &aOther)=0
std::string_view to_std_string_view() const noexcept
string & operator=(const string &aOther)
void append(const char *aSource, size_type aSourceLength) final
void append(const string &aOther)
value_type & front() final
std::string to_std_string() const
size_type capacity() const final
container::random_access_const_iterator< char, std::string::const_iterator > container_const_iterator
const char * c_str() const noexcept final
string & operator=(string &&aOther)
size_type size() const noexcept final
value_type & operator[](size_type aIndex) final
value_type & back() final
string(const string &aOther)
void assign(const char *aSource, size_type aSourceLength) final
void replace_all(const i_string &aSearch, const i_string &aReplace) final
void assign(const i_container &aOther) final
void resize(size_type aSize) final
void reserve(size_type aCapacity) final
const value_type & operator[](size_type aIndex) const final
container_iterator::abstract_iterator abstract_iterator
void append(const i_string &aOther) final
string(const std::string &aString={})
const value_type & at(size_type aIndex) const final
void push_back(const value_type &aValue) final
string(const char *aString, std::size_t aLength)
string(const std::string_view &aStringView)
string(size_type aCount, value_type aChar)
std_type & as_std_string()
void assign(string &&aOther)
void assign(const i_string &aOther) final
container_const_iterator::abstract_const_iterator abstract_const_iterator
string(const char *aString)
const value_type & front() const final
size_type max_size() const noexcept final
void assign(const string &aOther)
const char * cdata() const noexcept final
const std_type & as_std_string() const
std::string_view to_std_string_view() const noexcept
container::random_access_iterator< char, std::string::iterator, std::string::const_iterator > container_iterator
const value_type & back() const final
const char * data() const noexcept final
value_type & at(size_type aIndex) final
string & operator=(const i_string &aOther) final
string(const neolib::quick_string &aOther)
string(Iter aBegin, Iter aEnd)
void resize(size_type aSize, const value_type &aValue) final
string(const i_string &aOther)
char * data() noexcept final
std::partial_ordering operator<=>(const i_container< T, ConstIteratorType, IteratorType > &lhs, const i_container< T, ConstIteratorType, IteratorType > &rhs)
i_string & operator+=(i_string &lhs, const i_string &rhs)
basic_quick_string< char > quick_string