14#include "arccore/base/StringBuilder.h"
15#include "arccore/base/internal/StringImpl.h"
16#include "arccore/base/String.h"
17#include "arccore/base/StringView.h"
30: m_p(new StringImpl(str))
40: m_p(new StringImpl(ustr))
50: m_p(new StringImpl(ustr))
71: m_p(new StringImpl(std::string_view(str, len)))
83 const bool do_alloc =
true;
85 m_p =
new StringImpl(str);
100, m_const_ptr(str.m_const_ptr)
112, m_const_ptr(str.m_const_ptr)
115 m_p = new StringImpl(*str.m_p);
127 m_p->removeReference();
137 str.m_p->addReference();
139 m_p->removeReference();
141 m_const_ptr = str.m_const_ptr;
152 m_p->removeReference();
165 if (str != (*
this)) {
167 m_p->removeReference();
168 m_const_ptr = str.m_const_ptr;
170 m_p =
new StringImpl(*str.m_p);
183 if (m_const_ptr || !m_p) {
186 sv = std::string_view(m_const_ptr);
187 m_p =
new StringImpl(sv);
189 m_const_ptr =
nullptr;
192 if (m_p->nbReference() != 1) {
193 StringImpl* old_p = m_p;
196 old_p->removeReference();
218 return String(m_p->clone());
240 if (str.m_const_ptr) {
241 StringView sv{ std::string_view(str.m_const_ptr, str.m_const_ptr_size) };
242 m_p = m_p->append(sv);
245 m_p = m_p->append(str.m_p);
256 m_p = m_p->replaceWhiteSpace();
267 m_p = m_p->collapseWhiteSpace();
278 m_p = m_p->toUpper();
289 m_p = m_p->toLower();
297operator+=(
const char* str)
303operator+=(
const String& str)
318operator+=(
unsigned long v)
320 append(String::fromNumber(v));
324operator+=(
unsigned int v)
326 append(String::fromNumber(v));
332 append(String::fromNumber(v));
336operator+=(
long double v)
338 append(String::fromNumber(v));
344 append(String::fromNumber(v));
350 append(String::fromNumber(v));
354operator+=(
unsigned long long v)
356 append(String::fromNumber(v));
360operator+=(
long long v)
362 append(String::fromNumber(v));
366operator+=(
const APReal& v)
368 append(String::fromNumber(v));
377 ostr <<
"StringDump(m_const_ptr=" << (
void*)m_const_ptr <<
",m_p=" << m_p;
380 m_p->internalDump(ostr);
402bool operator==(
const StringBuilder& a,
const StringBuilder& b)
404 return a.toString() == b.toString();
Emulation of real number in arbitrary precision.
Unicode character string constructor.
StringBuilder & collapseWhiteSpace()
Performs whitespace character normalization. The behavior is identical to replaceWhiteSpace() plus:
StringBuilder & toLower()
Converts all characters in the string to lowercase.
StringBuilder()
Creates a null string.
StringBuilder & replaceWhiteSpace()
Performs whitespace character normalization. All whitespace characters are replaced by space characte...
void internalDump(std::ostream &ostr) const
Displays internal class information.
StringBuilder clone() const
Clones this string.
StringBuilder & append(const String &str)
Appends str.
StringBuilder & toUpper()
Converts all characters in the string to uppercase.
const StringBuilder & operator=(const String &str)
Copies str into this instance.
String toString() const
Returns the constructed character string.
~StringBuilder()
Releases resources.
View of a UTF-8 character string.
Unicode character string.
bool null() const
Returns true if the string is null.
const char * localstr() const
Returns the conversion of the instance into UTF-8 encoding.
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --
Int32 Integer
Type representing an integer.
ConstArrayView< UChar > UCharConstArrayView
C equivalent of a 1D array of unicode characters.
ConstArrayView< Byte > ByteConstArrayView
C equivalent of a 1D array of characters.
std::ostream & operator<<(std::ostream &ostr, eItemKind item_kind)
Output operator for a stream.