Arcane  4.2.1.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::StringImpl Class Reference

Implementation of the String class. More...

#include </__w/arcaneframework.github.io/arcaneframework.github.io/framework/arccore/src/base/arccore/base/internal/StringImpl.h>

Collaboration diagram for Arcane::StringImpl:

Public Member Functions

 StringImpl (std::string_view str)
 StringImpl (const StringImpl &str)
 StringImpl (Span< const Byte > bytes)
UCharConstArrayView utf16 ()
Span< const BytelargeUtf8 ()
 View of the UTF-8 encoding WITH null terminator.
Span< const Bytebytes ()
 same as largeUtf8() but WITHOUT the null terminator
bool isEqual (StringImpl *str)
bool isLessThan (StringImpl *str)
bool isEqual (StringView str)
bool isLessThan (StringView str)
std::string_view toStdStringView ()
StringView view ()
void addReference ()
void removeReference ()
Int32 nbReference ()
void internalDump (std::ostream &ostr)
StringImpl * clone ()
StringImpl * append (StringImpl *str)
StringImpl * append (StringView str)
StringImpl * replaceWhiteSpace ()
StringImpl * collapseWhiteSpace ()
StringImpl * toUpper ()
StringImpl * toLower ()
bool null ()
bool empty ()
bool hasUtf8 () const
bool hasUtf16 () const

Static Public Member Functions

static StringImpl * substring (StringImpl *str, Int64 pos, Int64 len)

Private Types

enum  { eValidUtf16 = 1 << 0 , eValidUtf8 = 1 << 1 }

Private Member Functions

 StringImpl (Span< const UChar > uchars)
void _setUtf16 (Span< const UChar > src)
void _createUtf16 ()
void _setUtf8 (const Byte *src)
void _createUtf8 ()
void _checkReference ()
void _invalidateUtf16 ()
void _invalidateUtf8 ()
void _setArray ()
void _setStrFromArray (Int64 ulen)
void _printStrUtf16 (std::ostream &o, Span< const UChar > str)
void _printStrUtf8 (std::ostream &o, Span< const Byte > str)
void _appendUtf8 (Span< const Byte > ref_str)
void _initFromSpan (Span< const Byte > bytes)
void _finalizeUtf8Creation ()

Private Attributes

std::atomic< Int32m_nb_ref
int m_flags
Impl::CoreArray< UCharm_utf16_array
Impl::CoreArray< Bytem_utf8_array

Friends

class String
class StringBuilder

Detailed Description

Implementation of the String class.

Warning
This class is internal to Arcane and should not be used outside of Arcane.

Currently, the implementation supports two encodings simultaneously: UTF-8 and UTF-16. The UTF-16 encoding is obsolete and will be removed at the end of 2019.

When C++20 is available, this class will only be an encapsulation of std::u8string.

Definition at line 45 of file arccore/src/base/arccore/base/internal/StringImpl.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

Constructor & Destructor Documentation

◆ StringImpl() [1/5]

Arcane::StringImpl::StringImpl ( std::string_view str)

Definition at line 110 of file StringImpl.cc.

◆ StringImpl() [2/5]

Arcane::StringImpl::StringImpl ( const StringImpl & str)

Definition at line 134 of file StringImpl.cc.

◆ StringImpl() [3/5]

Arcane::StringImpl::StringImpl ( Span< const Byte > bytes)

Definition at line 146 of file StringImpl.cc.

◆ StringImpl() [4/5]

Arcane::StringImpl::StringImpl ( )
private

Definition at line 157 of file StringImpl.cc.

◆ StringImpl() [5/5]

Arcane::StringImpl::StringImpl ( Span< const UChar > uchars)
private

Definition at line 122 of file StringImpl.cc.

Member Function Documentation

◆ _appendUtf8()

void Arcane::StringImpl::_appendUtf8 ( Span< const Byte > ref_str)
private

Definition at line 366 of file StringImpl.cc.

◆ _checkReference()

void Arcane::StringImpl::_checkReference ( )
inlineprivate

Definition at line 73 of file StringImpl.cc.

◆ _createUtf16()

void Arcane::StringImpl::_createUtf16 ( )
private

Definition at line 448 of file StringImpl.cc.

◆ _createUtf8()

void Arcane::StringImpl::_createUtf8 ( )
private

Definition at line 467 of file StringImpl.cc.

◆ _finalizeUtf8Creation()

void Arcane::StringImpl::_finalizeUtf8Creation ( )
inlineprivate

Definition at line 86 of file StringImpl.cc.

◆ _initFromSpan()

void Arcane::StringImpl::_initFromSpan ( Span< const Byte > bytes)
inlineprivate

Definition at line 100 of file StringImpl.cc.

◆ _invalidateUtf16()

void Arcane::StringImpl::_invalidateUtf16 ( )
private

Definition at line 499 of file StringImpl.cc.

◆ _invalidateUtf8()

void Arcane::StringImpl::_invalidateUtf8 ( )
private

Definition at line 509 of file StringImpl.cc.

◆ _printStrUtf16()

void Arcane::StringImpl::_printStrUtf16 ( std::ostream & o,
Span< const UChar > str )
private

Definition at line 519 of file StringImpl.cc.

◆ _printStrUtf8()

void Arcane::StringImpl::_printStrUtf8 ( std::ostream & o,
Span< const Byte > str )
private

Definition at line 533 of file StringImpl.cc.

◆ _setUtf16()

void Arcane::StringImpl::_setUtf16 ( Span< const UChar > src)
private

Definition at line 486 of file StringImpl.cc.

◆ addReference()

void Arcane::StringImpl::addReference ( )

Definition at line 206 of file StringImpl.cc.

◆ append() [1/2]

StringImpl * Arcane::StringImpl::append ( StringImpl * str)

Definition at line 335 of file StringImpl.cc.

◆ append() [2/2]

StringImpl * Arcane::StringImpl::append ( StringView str)

Definition at line 348 of file StringImpl.cc.

◆ bytes()

Span< const Byte > Arcane::StringImpl::bytes ( )

same as largeUtf8() but WITHOUT the null terminator

Definition at line 167 of file StringImpl.cc.

References Arcane::SpanImpl< T, SizeType, Extent >::data(), largeUtf8(), and Arcane::SpanImpl< T, SizeType, Extent >::size().

Here is the call graph for this function:

◆ clone()

StringImpl * Arcane::StringImpl::clone ( )

Definition at line 304 of file StringImpl.cc.

◆ collapseWhiteSpace()

StringImpl * Arcane::StringImpl::collapseWhiteSpace ( )

Definition at line 400 of file StringImpl.cc.

◆ empty()

bool Arcane::StringImpl::empty ( )

Definition at line 316 of file StringImpl.cc.

◆ hasUtf16()

bool Arcane::StringImpl::hasUtf16 ( ) const
inline

◆ hasUtf8()

bool Arcane::StringImpl::hasUtf8 ( ) const
inline

◆ internalDump()

void Arcane::StringImpl::internalDump ( std::ostream & ostr)

Definition at line 546 of file StringImpl.cc.

◆ isEqual() [1/2]

bool Arcane::StringImpl::isEqual ( StringImpl * str)

Definition at line 252 of file StringImpl.cc.

◆ isEqual() [2/2]

bool Arcane::StringImpl::isEqual ( StringView str)

Definition at line 282 of file StringImpl.cc.

◆ isLessThan() [1/2]

bool Arcane::StringImpl::isLessThan ( StringImpl * str)

Definition at line 265 of file StringImpl.cc.

◆ isLessThan() [2/2]

bool Arcane::StringImpl::isLessThan ( StringView str)

Definition at line 293 of file StringImpl.cc.

◆ largeUtf8()

Span< const Byte > Arcane::StringImpl::largeUtf8 ( )

View of the UTF-8 encoding WITH null terminator.

Definition at line 241 of file StringImpl.cc.

Referenced by bytes().

Here is the caller graph for this function:

◆ nbReference()

Int32 Arcane::StringImpl::nbReference ( )
inline

◆ null()

bool Arcane::StringImpl::null ( )
inline

◆ removeReference()

void Arcane::StringImpl::removeReference ( )

Definition at line 216 of file StringImpl.cc.

◆ replaceWhiteSpace()

StringImpl * Arcane::StringImpl::replaceWhiteSpace ( )

Definition at line 388 of file StringImpl.cc.

◆ substring()

StringImpl * Arcane::StringImpl::substring ( StringImpl * str,
Int64 pos,
Int64 len )
static

Definition at line 436 of file StringImpl.cc.

◆ toLower()

StringImpl * Arcane::StringImpl::toLower ( )

Definition at line 424 of file StringImpl.cc.

◆ toStdStringView()

std::string_view Arcane::StringImpl::toStdStringView ( )

Definition at line 187 of file StringImpl.cc.

◆ toUpper()

StringImpl * Arcane::StringImpl::toUpper ( )

Definition at line 412 of file StringImpl.cc.

◆ utf16()

ConstArrayView< UChar > Arcane::StringImpl::utf16 ( )

Definition at line 230 of file StringImpl.cc.

◆ view()

StringView Arcane::StringImpl::view ( )

Definition at line 197 of file StringImpl.cc.

◆ String

friend class String
friend

◆ StringBuilder

friend class StringBuilder
friend

Member Data Documentation

◆ m_flags

int Arcane::StringImpl::m_flags
private

◆ m_nb_ref

std::atomic<Int32> Arcane::StringImpl::m_nb_ref
private

◆ m_utf16_array

Impl::CoreArray<UChar> Arcane::StringImpl::m_utf16_array
private

◆ m_utf8_array

Impl::CoreArray<Byte> Arcane::StringImpl::m_utf8_array
private

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