Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::String Class Reference

Unicode character string. More...

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

Collaboration diagram for Arcane::String:

Public Member Functions

 String ()
 Creates a null string.
 String (const char *str)
 Creates a string from str in UTF-8 encoding.
 String (char *str)
 Creates a string from str in UTF-8 encoding.
 String (const char *str, bool do_alloc)
 Creates a string from str in UTF-8 encoding.
 String (const char *str, Integer len)
 Creates a string from str in UTF-8 encoding.
 String (std::string_view str)
 Creates a string from str in UTF-8 encoding.
 String (StringView str)
 Creates a string from str in UTF-8 encoding.
 String (const std::string &str)
 Creates a string from str in UTF-8 encoding.
 String (const UCharConstArrayView &ustr)
 Creates a string from str in UTF-16 encoding.
 String (const Span< const Byte > &ustr)
 Creates a string from str in UTF-8 encoding.
 String (StringImpl *impl)
 Creates a string from str in UTF-8 encoding.
 String (const String &str)
 Creates a string from str.
 String (String &&str)
 Creates a string from str.
Stringoperator= (const String &str)
 Copies str into this instance.
Stringoperator= (String &&str)
 Copies str into this instance.
Stringoperator= (StringView str)
 Copies str into this instance.
Stringoperator= (const char *str)
 References str encoded in UTF-8 in this instance.
Stringoperator= (std::string_view str)
 Copies str encoded in UTF-8 into this instance.
Stringoperator= (const std::string &str)
 Copies str encoded in UTF-8 into this instance.
 ~String ()
 Frees resources.
 operator StringView () const
 Returns a view of the current string.
ConstArrayView< UCharutf16 () const
 Returns the conversion of the instance into UTF-16 encoding.
ByteConstArrayView utf8 () const
 Returns the conversion of the instance into UTF-8 encoding.
Span< const Bytebytes () const
 Returns the conversion of the instance into UTF-8 encoding.
const char * localstr () const
 Returns the conversion of the instance into UTF-8 encoding.
std::string_view toStdStringView () const
 Returns an STL view of the current string.
StringView view () const
 Returns a view of the current string.
String clone () const
 Clones this string.
String upper () const
 Transforms all characters in the string to uppercase.
String lower () const
 Transforms all characters in the string to lowercase.
bool null () const
 Returns true if the string is null.
Integer len () const
 Returns the length of the string in 32 bits.
Int64 length () const
 Returns the length of the string.
bool empty () const
 True if the string is empty (null or "").
Int32 hashCode () const
 Calculates a hash value for this character string.
void writeBytes (std::ostream &o) const
 Writes the string in UTF-8 format to the stream o.
String operator+ (const char *str) const
String operator+ (std::string_view str) const
String operator+ (const std::string &str) const
String operator+ (const String &str) const
String operator+ (unsigned long v) const
String operator+ (unsigned int v) const
String operator+ (double v) const
String operator+ (long double v) const
String operator+ (int v) const
String operator+ (long v) const
String operator+ (unsigned long long v) const
String operator+ (long long v) const
String operator+ (const APReal &v) const
bool contains (const String &s) const
 Indicates if the string contains s.
bool startsWith (const String &s) const
 Indicates if the string starts with the characters of s.
bool endsWith (const String &s) const
 Indicates if the string ends with the characters of s.
String substring (Int64 pos) const
 Substring starting at position pos.
String substring (Int64 pos, Int64 len) const
 Substring starting at position pos and of length len.
template<typename StringContainer>
void split (StringContainer &str_array, char c) const
 Splits the string based on the character c.
void internalDump (std::ostream &ostr) const
 Displays the internal information of the class.

Static Public Member Functions

static String fromUtf8 (Span< const Byte > bytes)
static String replaceWhiteSpace (const String &rhs)
 Performs whitespace character normalization.
static String collapseWhiteSpace (const String &rhs)
 Performs whitespace character normalization.
static String fromNumber (unsigned long v)
static String fromNumber (unsigned int v)
static String fromNumber (double v)
static String fromNumber (double v, Integer nb_digit_after_point)
static String fromNumber (long double v)
static String fromNumber (int v)
static String fromNumber (long v)
static String fromNumber (unsigned long long v)
static String fromNumber (long long v)
static String fromNumber (const APReal &v)
static String format (const String &str)
static String format (const String &str, const StringFormatterArg &arg1)
static String format (const String &str, const StringFormatterArg &arg1, const StringFormatterArg &arg2)
static String format (const String &str, const StringFormatterArg &arg1, const StringFormatterArg &arg2, const StringFormatterArg &arg3)
static String format (const String &str, const StringFormatterArg &arg1, const StringFormatterArg &arg2, const StringFormatterArg &arg3, const StringFormatterArg &arg4)
static String format (const String &str, const StringFormatterArg &arg1, const StringFormatterArg &arg2, const StringFormatterArg &arg3, const StringFormatterArg &arg4, const StringFormatterArg &arg5)
static String format (const String &str, const StringFormatterArg &arg1, const StringFormatterArg &arg2, const StringFormatterArg &arg3, const StringFormatterArg &arg4, const StringFormatterArg &arg5, const StringFormatterArg &arg6)
static String format (const String &str, const StringFormatterArg &arg1, const StringFormatterArg &arg2, const StringFormatterArg &arg3, const StringFormatterArg &arg4, const StringFormatterArg &arg5, const StringFormatterArg &arg6, const StringFormatterArg &arg7)
static String format (const String &str, const StringFormatterArg &arg1, const StringFormatterArg &arg2, const StringFormatterArg &arg3, const StringFormatterArg &arg4, const StringFormatterArg &arg5, const StringFormatterArg &arg6, const StringFormatterArg &arg7, const StringFormatterArg &arg8)
static String format (const String &str, const StringFormatterArg &arg1, const StringFormatterArg &arg2, const StringFormatterArg &arg3, const StringFormatterArg &arg4, const StringFormatterArg &arg5, const StringFormatterArg &arg6, const StringFormatterArg &arg7, const StringFormatterArg &arg8, const StringFormatterArg &arg9)
static String concat (const StringFormatterArg &arg1)
static String concat (const StringFormatterArg &arg1, const StringFormatterArg &arg2)
static String concat (const StringFormatterArg &arg1, const StringFormatterArg &arg2, const StringFormatterArg &arg3)
static String concat (const StringFormatterArg &arg1, const StringFormatterArg &arg2, const StringFormatterArg &arg3, const StringFormatterArg &arg4)
static String plural (const Integer n, const String &str, const bool with_number=true)
 Standard plural form by adding an 's'.
static String plural (const Integer n, const String &str, const String &str2, const bool with_number=true)
 Special plural form by variant.
static String join (String delim, ConstArrayView< String > strs)

Private Member Functions

void _checkClone () const
bool isLess (const String &s) const
String_append (const String &str)
std::string_view _viewFromConstChar () const
void _removeReference ()
ConstArrayView< UChar_internalUtf16BE () const
void _resetFields ()
void _copyFields (const String &str)
void _removeReferenceIfNeeded ()
 Removes the reference to the implementation if it is not null.
void _removeImplReference ()
 Removes the reference to the implementation.

Private Attributes

StringImplm_p = nullptr
 Class implementation.
const char * m_const_ptr = nullptr
Int64 m_const_ptr_size = 0
 String length if constant (-1 otherwise).

Friends

class StringBuilder
class StringUtilsImpl
bool operator< (const String &a, const String &b)
bool operator== (const String &a, const String &b)
 Compares two unicode strings.
bool operator!= (const String &a, const String &b)
 Compares two unicode strings.
std::ostream & operator<< (std::ostream &o, const String &str)
 String output operator.
std::istream & operator>> (std::istream &o, String &str)
 String input operator.
bool operator== (const char *a, const String &b)
 Compares two unicode strings.
bool operator!= (const char *a, const String &b)
 Compares two unicode strings.
bool operator== (const String &a, const char *b)
 Compares two unicode strings.
bool operator!= (const String &a, const char *b)
 Compares two unicode strings.
String operator+ (const char *a, const String &b)
 Adds two strings.
bool operator< (const String &a, const String &b)

Detailed Description

Unicode character string.

This class allows managing a character string using either UTF-8 or UTF-16 encoding. Note that UTF-16 encoding is obsolete and will be removed in a later version when C++20 is available.

All methods using const char* as arguments assume that the encoding used is UTF-8.

Instances of this class are immutable.

This class is similar to std::string but with the following differences:

  • The String class uses UTF-8 encoding, whereas for std::string, the encoding is undefined.
  • Unlike std::string, it is currently not possible to preserve null characters inside a String.
  • For String, there is a distinction between a null string and an empty string. The String::String() constructor creates a null string, while String::String("") creates an empty string. If the string is null, calls to view() or toStdStringView() return an empty string.

When C++20 is available, the String class will correspond to the std::optional<std::u8string> type.

For performance reasons, when building a string piece by piece, it is preferable to use the 'StringBuilder' class.

Definition at line 69 of file arccore/src/base/arccore/base/String.h.

Constructor & Destructor Documentation

◆ String() [1/13]

Arcane::String::String ( )
inline

Creates a null string.

Definition at line 80 of file arccore/src/base/arccore/base/String.h.

Referenced by clone(), collapseWhiteSpace(), contains(), endsWith(), lower(), operator!=, operator!=, operator!=, operator+, operator+(), operator+(), operator+(), operator+(), operator<<, operator=(), operator=(), operator=(), operator=(), operator=(), operator=(), operator==, operator==, operator==, operator>>, plural(), plural(), replaceWhiteSpace(), split(), startsWith(), String(), String(), substring(), substring(), and upper().

Here is the caller graph for this function:

◆ String() [2/13]

Arcane::String::String ( const char * str)
inline

Creates a string from str in UTF-8 encoding.

Warning
Attention, the string is assumed to have infinite constant validity (i.e., it is a compile-time constant string. If the string passed as an argument can be deallocated, use String(std::string_view) instead.

Definition at line 89 of file arccore/src/base/arccore/base/String.h.

References m_const_ptr_size.

◆ String() [3/13]

Arcane::String::String ( char * str)

Creates a string from str in UTF-8 encoding.

Definition at line 127 of file String.cc.

References m_const_ptr_size, and m_p.

◆ String() [4/13]

Arcane::String::String ( const char * str,
bool do_alloc )

Creates a string from str in UTF-8 encoding.

Definition at line 138 of file String.cc.

References m_const_ptr_size, and m_p.

◆ String() [5/13]

Arcane::String::String ( const char * str,
Integer len )

Creates a string from str in UTF-8 encoding.

Definition at line 116 of file String.cc.

References len(), m_const_ptr_size, and m_p.

Here is the call graph for this function:

◆ String() [6/13]

Arcane::String::String ( std::string_view str)

Creates a string from str in UTF-8 encoding.

Definition at line 59 of file String.cc.

References m_const_ptr_size, and m_p.

◆ String() [7/13]

Arcane::String::String ( StringView str)

Creates a string from str in UTF-8 encoding.

Definition at line 70 of file String.cc.

References m_const_ptr_size, m_p, and toStdStringView().

Here is the call graph for this function:

◆ String() [8/13]

Arcane::String::String ( const std::string & str)

Creates a string from str in UTF-8 encoding.

Definition at line 48 of file String.cc.

References m_const_ptr_size, and m_p.

◆ String() [9/13]

Arcane::String::String ( const UCharConstArrayView & ustr)

Creates a string from str in UTF-16 encoding.

Definition at line 82 of file String.cc.

References m_const_ptr_size, and m_p.

◆ String() [10/13]

Arcane::String::String ( const Span< const Byte > & ustr)

Creates a string from str in UTF-8 encoding.

Definition at line 93 of file String.cc.

References m_const_ptr_size, and m_p.

◆ String() [11/13]

Arcane::String::String ( StringImpl * impl)
explicit

Creates a string from str in UTF-8 encoding.

Creates a string from str in UTF-8 encoding

Definition at line 104 of file String.cc.

References m_const_ptr_size, and m_p.

◆ String() [12/13]

Arcane::String::String ( const String & str)

Creates a string from str.

Definition at line 158 of file String.cc.

References m_const_ptr_size, m_p, and String().

Here is the call graph for this function:

◆ String() [13/13]

Arcane::String::String ( String && str)
inline

Creates a string from str.

Definition at line 120 of file arccore/src/base/arccore/base/String.h.

References m_const_ptr_size, m_p, and String().

Here is the call graph for this function:

◆ ~String()

Arcane::String::~String ( )
inline

Frees resources.

Definition at line 158 of file arccore/src/base/arccore/base/String.h.

References _removeReferenceIfNeeded().

Here is the call graph for this function:

Member Function Documentation

◆ _append()

String & Arcane::String::_append ( const String & str)
private

Definition at line 424 of file String.cc.

◆ _checkClone()

void Arcane::String::_checkClone ( ) const
private

Definition at line 389 of file String.cc.

◆ _copyFields()

void Arcane::String::_copyFields ( const String & str)
inlineprivate

Definition at line 553 of file arccore/src/base/arccore/base/String.h.

◆ _internalUtf16BE()

ConstArrayView< UChar > Arcane::String::_internalUtf16BE ( ) const
private

Definition at line 250 of file String.cc.

◆ _removeImplReference()

void Arcane::String::_removeImplReference ( )
private

Removes the reference to the implementation.

Precondition
m_p != nullptr

Definition at line 241 of file String.cc.

References m_p.

Referenced by _removeReferenceIfNeeded().

Here is the caller graph for this function:

◆ _removeReferenceIfNeeded()

void Arcane::String::_removeReferenceIfNeeded ( )
inlineprivate

Removes the reference to the implementation if it is not null.

Definition at line 563 of file arccore/src/base/arccore/base/String.h.

References _removeImplReference(), and m_p.

Referenced by operator=(), operator=(), operator=(), and ~String().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _resetFields()

void Arcane::String::_resetFields ( )
inlineprivate

Definition at line 547 of file arccore/src/base/arccore/base/String.h.

◆ _viewFromConstChar()

std::string_view Arcane::String::_viewFromConstChar ( ) const
inlineprivate

Definition at line 541 of file arccore/src/base/arccore/base/String.h.

◆ bytes()

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

Returns the conversion of the instance into UTF-8 encoding.

bytes().size() corresponds to the length of the character string but the returned view always contains a terminal '\0'.

Warning
The instance remains the owner of the returned value and this value is invalidated by any modification of this instance.

Definition at line 292 of file String.cc.

References m_const_ptr_size, and m_p.

Referenced by Arcane::SubDomain::_printCPUAffinity(), Arcane::MshParallelMeshReader::_readAndCheck(), Arcane::VariableIOReaderMng::_readMetaData(), Arcane::ParameterList::addParameterLine(), Arcane::ParameterListWithCaseOption::addParameterLine(), endsWith(), hashCode(), Arcane::BasicSerializer::put(), Arcane::MeshReaderMng::readMesh(), Arcane::BasicSerializer::reserve(), startsWith(), writeBytes(), and Arcane::TraceMng::writeDirect().

Here is the caller graph for this function:

◆ clone()

String Arcane::String::clone ( ) const

Clones this string.

Definition at line 413 of file String.cc.

References m_p, and String().

Referenced by Arcane::TimeHistoryMngInternal::_addHistoryValue(), Arcane::TimeHistoryMngInternal::iterationsAndValues(), Arcane::ArcaneCurveWriter::writeCurve(), and Arcane::GnuplotTimeHistoryCurveWriter2::writeCurve().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ collapseWhiteSpace()

String Arcane::String::collapseWhiteSpace ( const String & rhs)
static

Performs whitespace character normalization.

The behavior is identical to replaceWhiteSpace() plus:

  • replacement of all consecutive whitespaces by a single one.
  • removal of whitespaces at the beginning and end of the string. This corresponds to the xs:collapse attribute of XMLSchema 1.0

Definition at line 453 of file String.cc.

References m_p, null(), and String().

Referenced by Arcane::CaseOptionMultiSimpleT< Arcane::Integer >::print().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ concat() [1/4]

String Arcane::String::concat ( const StringFormatterArg & arg1)
static

Definition at line 1018 of file String.cc.

◆ concat() [2/4]

String Arcane::String::concat ( const StringFormatterArg & arg1,
const StringFormatterArg & arg2 )
static

Definition at line 1024 of file String.cc.

◆ concat() [3/4]

String Arcane::String::concat ( const StringFormatterArg & arg1,
const StringFormatterArg & arg2,
const StringFormatterArg & arg3 )
static

Definition at line 1031 of file String.cc.

◆ concat() [4/4]

String Arcane::String::concat ( const StringFormatterArg & arg1,
const StringFormatterArg & arg2,
const StringFormatterArg & arg3,
const StringFormatterArg & arg4 )
static

Definition at line 1039 of file String.cc.

◆ contains()

bool Arcane::String::contains ( const String & s) const

Indicates if the string contains s.

Definition at line 1078 of file String.cc.

References null(), String(), and toStdStringView().

Here is the call graph for this function:

◆ empty()

◆ endsWith()

bool Arcane::String::endsWith ( const String & s) const

Indicates if the string ends with the characters of s.

Definition at line 1094 of file String.cc.

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

Referenced by Arcane::LIBXML2_DOMWriter::DoIndentation(), Arcane::Platform::getLoadedSharedLibraryFullPath(), Arcane::MshMeshWriter::writeMesh(), Arcane::VtkLegacyMeshWriter::writeMeshToFile(), Arcane::VtuMeshWriter::writeMeshToFile(), and Arcane::XmfMeshWriter::writeMeshToFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ format() [1/10]

String Arcane::String::format ( const String & str)
static

Definition at line 838 of file String.cc.

◆ format() [2/10]

String Arcane::String::format ( const String & str,
const StringFormatterArg & arg1 )
static

Definition at line 847 of file String.cc.

◆ format() [3/10]

String Arcane::String::format ( const String & str,
const StringFormatterArg & arg1,
const StringFormatterArg & arg2 )
static

Definition at line 858 of file String.cc.

◆ format() [4/10]

String Arcane::String::format ( const String & str,
const StringFormatterArg & arg1,
const StringFormatterArg & arg2,
const StringFormatterArg & arg3 )
static

Definition at line 871 of file String.cc.

◆ format() [5/10]

String Arcane::String::format ( const String & str,
const StringFormatterArg & arg1,
const StringFormatterArg & arg2,
const StringFormatterArg & arg3,
const StringFormatterArg & arg4 )
static

Definition at line 886 of file String.cc.

◆ format() [6/10]

String Arcane::String::format ( const String & str,
const StringFormatterArg & arg1,
const StringFormatterArg & arg2,
const StringFormatterArg & arg3,
const StringFormatterArg & arg4,
const StringFormatterArg & arg5 )
static

Definition at line 903 of file String.cc.

◆ format() [7/10]

String Arcane::String::format ( const String & str,
const StringFormatterArg & arg1,
const StringFormatterArg & arg2,
const StringFormatterArg & arg3,
const StringFormatterArg & arg4,
const StringFormatterArg & arg5,
const StringFormatterArg & arg6 )
static

Definition at line 922 of file String.cc.

◆ format() [8/10]

String Arcane::String::format ( const String & str,
const StringFormatterArg & arg1,
const StringFormatterArg & arg2,
const StringFormatterArg & arg3,
const StringFormatterArg & arg4,
const StringFormatterArg & arg5,
const StringFormatterArg & arg6,
const StringFormatterArg & arg7 )
static

Definition at line 943 of file String.cc.

◆ format() [9/10]

String Arcane::String::format ( const String & str,
const StringFormatterArg & arg1,
const StringFormatterArg & arg2,
const StringFormatterArg & arg3,
const StringFormatterArg & arg4,
const StringFormatterArg & arg5,
const StringFormatterArg & arg6,
const StringFormatterArg & arg7,
const StringFormatterArg & arg8 )
static

Definition at line 966 of file String.cc.

◆ format() [10/10]

String Arcane::String::format ( const String & str,
const StringFormatterArg & arg1,
const StringFormatterArg & arg2,
const StringFormatterArg & arg3,
const StringFormatterArg & arg4,
const StringFormatterArg & arg5,
const StringFormatterArg & arg6,
const StringFormatterArg & arg7,
const StringFormatterArg & arg8,
const StringFormatterArg & arg9 )
static

Definition at line 991 of file String.cc.

◆ fromNumber() [1/10]

String Arcane::String::fromNumber ( const APReal & v)
static

Definition at line 573 of file String.cc.

◆ fromNumber() [2/10]

String Arcane::String::fromNumber ( double v)
static

Definition at line 537 of file String.cc.

◆ fromNumber() [3/10]

String Arcane::String::fromNumber ( double v,
Integer nb_digit_after_point )
static

Definition at line 579 of file String.cc.

◆ fromNumber() [4/10]

String Arcane::String::fromNumber ( int v)
static

Definition at line 549 of file String.cc.

◆ fromNumber() [5/10]

String Arcane::String::fromNumber ( long double v)
static

Definition at line 543 of file String.cc.

◆ fromNumber() [6/10]

String Arcane::String::fromNumber ( long long v)
static

Definition at line 567 of file String.cc.

◆ fromNumber() [7/10]

String Arcane::String::fromNumber ( long v)
static

Definition at line 555 of file String.cc.

◆ fromNumber() [8/10]

String Arcane::String::fromNumber ( unsigned int v)
static

Definition at line 531 of file String.cc.

◆ fromNumber() [9/10]

String Arcane::String::fromNumber ( unsigned long long v)
static

Definition at line 561 of file String.cc.

◆ fromNumber() [10/10]

String Arcane::String::fromNumber ( unsigned long v)
static

Definition at line 525 of file String.cc.

◆ fromUtf8()

String Arcane::String::fromUtf8 ( Span< const Byte > bytes)
static

Definition at line 711 of file String.cc.

◆ hashCode()

Int32 Arcane::String::hashCode ( ) const

Calculates a hash value for this character string.

Definition at line 734 of file String.cc.

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

Here is the call graph for this function:

◆ internalDump()

void Arcane::String::internalDump ( std::ostream & ostr) const

Displays the internal information of the class.

This method is only useful for debugging Arccore

Definition at line 720 of file String.cc.

References m_p.

◆ isLess()

bool Arcane::String::isLess ( const String & s) const
private

Definition at line 675 of file String.cc.

◆ join()

String Arcane::String::join ( String delim,
ConstArrayView< String > strs )
static

Definition at line 1148 of file String.cc.

◆ len()

Integer Arcane::String::len ( ) const

Returns the length of the string in 32 bits.

Definition at line 329 of file String.cc.

References Arcane::arccoreCheckArraySize(), and toStdStringView().

Referenced by Arcane::dom::DOMImplementation::_load(), split(), String(), and substring().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ length()

Int64 Arcane::String::length ( ) const

Returns the length of the string.

Definition at line 339 of file String.cc.

References toStdStringView().

Referenced by Arcane::TimeHistoryMngInternal::_dumpSummaryOfCurves(), Arcane::TimeHistoryMngInternal::_dumpSummaryOfCurvesLegacy(), Arcane::TimeHistoryMngInternal::dumpCurves(), Arcane::MessagePassing::namedBarrier(), Arcane::BasicSerializer::put(), Arcane::platform::raiseFloatingException(), split(), and substring().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ localstr()

const char * Arcane::String::localstr ( ) const

Returns the conversion of the instance into UTF-8 encoding.

If null() is true, returns the empty string. Otherwise, this method is equivalent to calling bytes().data(). There is always a terminal '\0' at the end of the returned string.

Warning
The instance remains the owner of the returned value and this value is invalidated by any modification of this instance.

Definition at line 228 of file String.cc.

References m_p.

Referenced by Arcane::Otf2LibWrapper::_buildOtf2ClockAndStringDefinition(), Arcane::VariableIOReaderMng::_checkHashFunction(), Arcane::mesh::ItemFamily::_cmpIVariablePtr(), Arcane::mesh::FaceUniqueIdBuilder::_computeFacesUniqueIdsParallelV1(), Arcane::TimeHistoryMngInternal::_dumpSummaryOfCurves(), Arcane::TimeHistoryMngInternal::_dumpSummaryOfCurvesLegacy(), Arcane::SimpleTableInternalComparator::_exploreColumn(), Arcane::SimpleTableInternalComparator::_exploreRows(), Arcane::TimeLoopMng::_extractModuleAndEntryPointName(), Arcane::dom::DOMImplementation::_load(), Arcane::MetisMeshPartitioner::_partitionMesh(), Arcane::VtkMeshIOService::_readFacesMesh(), Arcane::ItemTypeMng::_readTypes(), Arcane::LimaCutInfosReader::_readUniqueIndexFromXml(), Arcane::DumpWEnsight7::_saveGroup(), Arcane::VtkHdfV2DataWriter::_writeDataSetGeneric(), Arcane::MetisMeshPartitioner::_writeGraph(), Arcane::VtkLegacyMeshWriter::_writeMeshToFile(), Arcane::centralizePartInfo(), Arcane::FlexLMMng::checkLicense(), Arcane::mesh::TiedInterfaceBuilder::computeInterfaceConnections(), Arcane::CartesianMeshCoarsening::createCoarseCells(), Arcane::Platform::createDirectory(), Arcane::InternalInfosDumper::dumpArcaneDatabase(), Arcane::TimeHistoryMngInternal::dumpCurves(), Arcane::MeshUtils::dumpSynchronizerTopologyJSON(), Arcane::TimeStats::endGatherStats(), Arcane::DumpWEnsight7::endWrite(), Arcane::DumpWUCD::endWrite(), Arcane::TimeLoopMng::execExitEntryPoints(), Arcane::Process::execute(), Arcane::FlexLMMng::featureInfo(), Arcane::platform::getCompilerId(), Arcane::Platform::getEnvironmentVariable(), Arcane::FlexLMMng::getLicense(), Arcane::Platform::getLoadedSharedLibraryFullPath(), Arcane::Otf2LibWrapper::init(), Arcane::CodeService::initCase(), Arcane::PapiPerformanceService::initialize(), Arcane::SimpleTableReaderWriterUtils::isFileExist(), Arcane::Platform::isFileReadable(), Arcane::MessagePassing::namedBarrier(), Arcane::operator<<(), operator<<, Arcane::platform::raiseFloatingException(), Arcane::MatVec::Matrix::read(), Arcane::MatVec::Matrix::readHypre(), Arcane::MatVec::Vector::readHypre(), Arcane::VtkMeshIOService::readMesh(), Arcane::XmfMeshReader::readMeshFromFile(), Arcane::MshMeshReader::readMeshFromMshFile(), Arcane::MshParallelMeshReader::readMeshFromMshFile(), Arcane::TimeHistoryMngInternal::readVariables(), Arcane::FlexLMMng::releaseAllLicenses(), Arcane::FlexLMMng::releaseLicense(), Arcane::ArcaneMain::setErrorCode(), Arcane::impl::BasicWriter::setMetaData(), Arcane::AlephMatrix::solveNow(), split(), Arcane::VersionInfo::VersionInfo(), Arcane::KdiDataWriter::write(), Arcane::GnuplotTimeHistoryCurveWriter2::writeCurve(), Arcane::CheckpointMng::writeDefaultCheckpoint(), Arcane::MshMeshWriter::writeMesh(), Arcane::MeshUtils::writeMeshConnectivity(), Arcane::MeshUtils::writeMeshInfosSorted(), Arcane::LimaMeshWriter::writeMeshToFile(), Arcane::VtuMeshWriter::writeMeshToFile(), Arcane::XmfMeshWriter::writeMeshToFile(), and Arcane::IOMng::writeXmlFile().

◆ lower()

String Arcane::String::lower ( ) const

Transforms all characters in the string to lowercase.

Definition at line 479 of file String.cc.

References m_p, and String().

Referenced by Arcane::VtkFile::checkString(), Arcane::VtkFile::checkString(), and Arcane::VtkFile::isEqualString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ null()

bool Arcane::String::null ( ) const

Returns true if the string is null.

Definition at line 305 of file String.cc.

References m_p.

Referenced by Arcane::ItemTypeMng::_buildTypes(), Arcane::VariableIOReaderMng::_checkHashFunction(), Arcane::ArcaneBasicMeshSubdividerService::_checkMeshUid(), Arcane::TimeLoopMng::_fillModuleFactoryMap(), Arcane::TimeLoopMng::_fillModuleStateMap(), Arcane::dom::DOMImplementation::_load(), Arcane::MetisMeshPartitioner::_partitionMesh(), Arcane::TimeLoopMng::_processEntryPoints(), Arcane::LimaCutInfosReader::_readUniqueIndexFromXml(), Arcane::CaseOptionExtended::_search(), Arcane::CaseOptionMultiExtended::_search(), Arcane::CaseOptionMultiSimpleT< T >::_search(), Arcane::CaseOptionSimpleT< T >::_search(), Arcane::CaseMng::_searchInvalidOptions(), Arcane::ConfigurationReader::addValuesFromXmlNode(), Arcane::VariableMng::addVariable(), Arcane::MeshGeneratorService::allowExtension(), Arcane::StringBuilder::append(), Arcane::XmlNode::attrValue(), Arcane::Application::build(), Arcane::VariableMng::build(), Arcane::centralizePartInfo(), Arcane::VariableMng::checkVariable(), collapseWhiteSpace(), contains(), Arcane::TimeLoopMng::doComputeLoop(), Arcane::mesh::DynamicMesh::endAllocate(), Arcane::Platform::getLoadedSharedLibraryFullPath(), Arcane::MemoryUtils::getMemoryResourceFromName(), Arcane::Materials::MeshMaterialVariableCommonStaticImpl< TrueType >::getReference(), Arcane::PropertyImpl::PropertyKeyValues::getValue(), Arcane::Application::initialize(), Arcane::PapiPerformanceService::initialize(), Arcane::Accelerator::Impl::RuntimeLoader::loadRuntime(), Arcane::CaseOptionName::name(), Arcane::ArcaneBasicCheckpointService::notifyBeginRead(), Arcane::ArcaneBasicCheckpointService::notifyBeginWrite(), Arcane::ArcaneVerifierModule::onExit(), Arcane::dom::LibXml2_Parser::parse(), Arcane::ArcaneMain::parseArgs(), Arcane::CaseOptions::read(), Arcane::CheckpointMng::readCheckpointInfo(), Arcane::LimaMeshReaderService::readMeshFromFile(), Arcane::MeshGeneratorService::readMeshFromFile(), Arcane::TimeLoopReader::readTimeLoops(), Arcane::TimeHistoryMngInternal::readVariables(), Arcane::Accelerator::AcceleratorMemoryAllocatorBase::reallocate(), Arcane::StringVariableReplace::replaceWithCmdLineArgs(), Arcane::TraceMng::setErrorFileName(), Arcane::TraceMng::setLogFileName(), Arcane::CaseFunction::setName(), Arcane::TimeLoopMng::setUsedTimeLoop(), Arcane::Internal::ServiceInfo::tagName(), Arcane::CaseOptionBase::translatedName(), Arcane::CaseOptions::translatedName(), Arcane::Convert::ScalarType< T >::tryParseFromEnvironment(), and Arcane::VtuMeshWriter::writeMeshToFile().

◆ operator StringView()

Arcane::String::operator StringView ( ) const

Returns a view of the current string.

The encoding used is UTF-8.

Warning
The instance remains the owner of the returned value and this value is invalidated by any modification of this instance. The returned view should not be retained.

Definition at line 381 of file String.cc.

References view().

Here is the call graph for this function:

◆ operator+() [1/13]

String Arcane::String::operator+ ( const APReal & v) const

Definition at line 665 of file String.cc.

◆ operator+() [2/13]

String Arcane::String::operator+ ( const char * str) const
inline

Returns the concatenation of this string with the string str encoded in UTF-8

Definition at line 376 of file arccore/src/base/arccore/base/String.h.

References operator+, and String().

Here is the call graph for this function:

◆ operator+() [3/13]

String Arcane::String::operator+ ( const std::string & str) const

Returns the concatenation of this string with the string str encoded in UTF-8

Definition at line 503 of file String.cc.

References String().

Here is the call graph for this function:

◆ operator+() [4/13]

String Arcane::String::operator+ ( const String & str) const

Returns the concatenation of this string with the string str.

Definition at line 515 of file String.cc.

References String().

Here is the call graph for this function:

◆ operator+() [5/13]

String Arcane::String::operator+ ( double v) const

Definition at line 623 of file String.cc.

◆ operator+() [6/13]

String Arcane::String::operator+ ( int v) const

Definition at line 637 of file String.cc.

◆ operator+() [7/13]

String Arcane::String::operator+ ( long double v) const

Definition at line 630 of file String.cc.

◆ operator+() [8/13]

String Arcane::String::operator+ ( long long v) const

Definition at line 658 of file String.cc.

◆ operator+() [9/13]

String Arcane::String::operator+ ( long v) const

Definition at line 644 of file String.cc.

◆ operator+() [10/13]

String Arcane::String::operator+ ( std::string_view str) const

Returns the concatenation of this string with the string str encoded in UTF-8

Definition at line 491 of file String.cc.

References String().

Here is the call graph for this function:

◆ operator+() [11/13]

String Arcane::String::operator+ ( unsigned int v) const

Definition at line 616 of file String.cc.

◆ operator+() [12/13]

String Arcane::String::operator+ ( unsigned long long v) const

Definition at line 651 of file String.cc.

◆ operator+() [13/13]

String Arcane::String::operator+ ( unsigned long v) const

Definition at line 609 of file String.cc.

◆ operator=() [1/6]

String & Arcane::String::operator= ( const char * str)
inline

References str encoded in UTF-8 in this instance.

Warning
Attention, the string is assumed to have infinite constant validity (i.e., it is a compile-time constant string. If the string passed as an argument can be deallocated, use String::operator=(std::string_view) instead.

Definition at line 142 of file arccore/src/base/arccore/base/String.h.

References _removeReferenceIfNeeded(), m_const_ptr_size, m_p, and String().

Here is the call graph for this function:

◆ operator=() [2/6]

String & Arcane::String::operator= ( const std::string & str)

Copies str encoded in UTF-8 into this instance.

Definition at line 216 of file String.cc.

References operator=(), and String().

Here is the call graph for this function:

◆ operator=() [3/6]

String & Arcane::String::operator= ( const String & str)

Copies str into this instance.

Definition at line 171 of file String.cc.

References _removeReferenceIfNeeded(), m_p, and String().

Referenced by operator=(), operator=(), and operator=().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=() [4/6]

String & Arcane::String::operator= ( std::string_view str)

Copies str encoded in UTF-8 into this instance.

Definition at line 207 of file String.cc.

References operator=(), and String().

Here is the call graph for this function:

◆ operator=() [5/6]

String & Arcane::String::operator= ( String && str)

Copies str into this instance.

Definition at line 184 of file String.cc.

References _removeReferenceIfNeeded(), and String().

Here is the call graph for this function:

◆ operator=() [6/6]

String & Arcane::String::operator= ( StringView str)

Copies str into this instance.

Definition at line 198 of file String.cc.

References operator=(), and String().

Here is the call graph for this function:

◆ plural() [1/2]

String Arcane::String::plural ( const Integer n,
const String & str,
const bool with_number = true )
static

Standard plural form by adding an 's'.

Definition at line 1051 of file String.cc.

References plural(), and String().

Referenced by Arcane::mesh::DynamicMeshChecker::checkValidConnectivity(), and plural().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ plural() [2/2]

String Arcane::String::plural ( const Integer n,
const String & str,
const String & str2,
const bool with_number = true )
static

Special plural form by variant.

Definition at line 1066 of file String.cc.

References String().

Here is the call graph for this function:

◆ replaceWhiteSpace()

String Arcane::String::replaceWhiteSpace ( const String & rhs)
static

Performs whitespace character normalization.

All whitespace characters are replaced by space characters #x20, namely #xD (Carriage Return), #xA (Line Feed), and #x9 (Tabulation). This corresponds to the xs:replace attribute of XMLSchema 1.0

Definition at line 441 of file String.cc.

References m_p, and String().

Here is the call graph for this function:

◆ split()

template<typename StringContainer>
void Arcane::String::split ( StringContainer & str_array,
char c ) const
inline

Splits the string based on the character c.

Definition at line 495 of file arccore/src/base/arccore/base/String.h.

References len(), length(), localstr(), and String().

Referenced by Arcane::SimpleTableWriterHelper::_computeName(), Arcane::ConfigurationReader::addValuesFromXmlNode(), Arcane::PapiPerformanceService::initialize(), and Arcane::SimpleCsvReaderWriter::readTable().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ startsWith()

bool Arcane::String::startsWith ( const String & s) const

Indicates if the string starts with the characters of s.

Definition at line 1110 of file String.cc.

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

Referenced by Arcane::SimpleTableWriterHelper::_computeName(), Arcane::ParameterOptionElementsCollection::addParameter(), and Arcane::BackwardCppStackTraceService::stackTrace().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ substring() [1/2]

String Arcane::String::substring ( Int64 pos) const

Substring starting at position pos.

Definition at line 1125 of file String.cc.

References length(), String(), and substring().

Referenced by Arcane::VtkMeshIOService::_readData(), Arcane::ParameterList::addParameterLine(), Arcane::ParameterListWithCaseOption::addParameterLine(), and substring().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ substring() [2/2]

String Arcane::String::substring ( Int64 pos,
Int64 len ) const

Substring starting at position pos and of length len.

Definition at line 1134 of file String.cc.

References len(), m_p, and String().

Here is the call graph for this function:

◆ toStdStringView()

std::string_view Arcane::String::toStdStringView ( ) const

Returns an STL view of the current string.

The encoding used is UTF-8.

Warning
The instance remains the owner of the returned value and this value is invalidated by any modification of this instance. The returned view should not be retained.

Definition at line 349 of file String.cc.

References ARCCORE_FATAL, m_const_ptr_size, and m_p.

Referenced by Arcane::LegacyMeshBuilder::_readMesh(), contains(), Arcane::Application::getCodeService(), len(), length(), Arcane::MeshReaderMng::readMesh(), and String().

Here is the caller graph for this function:

◆ upper()

String Arcane::String::upper ( ) const

Transforms all characters in the string to uppercase.

Definition at line 467 of file String.cc.

References m_p, and String().

Referenced by Arcane::MetisMeshPartitioner::_partitionMesh().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ utf16()

ConstArrayView< UChar > Arcane::String::utf16 ( ) const

Returns the conversion of the instance into UTF-16 encoding.

The returned array always contains a terminal zero if the string is not null-terminated. Therefore, the size of any non-null string is the array size minus 1.

Warning
The instance remains the owner of the returned value and this value is invalidated by any modification of this instance.
Deprecated
Use StringUtils::asUtf16BE() instead. Note that the StringUtils::asUtf16BE() function does not contain a terminal 0x00.

Definition at line 267 of file String.cc.

◆ utf8()

ByteConstArrayView Arcane::String::utf8 ( ) const

Returns the conversion of the instance into UTF-8 encoding.

The returned array always contains a terminal zero if the string is not null-terminated. Therefore, the size of any non-null string is the array size minus 1.

Warning
The instance remains the owner of the returned value and this value is invalidated by any modification of this instance.

Definition at line 276 of file String.cc.

References Arcane::arccoreCheckArraySize(), m_const_ptr_size, and m_p.

Referenced by Arcane::VtkMeshIOService::_readData(), Arcane::FlexLMMng::featureInfo(), Arcane::GlibDynamicLibrary::getSymbolAddress(), Arcane::IOMng::parseXmlString(), and Arcane::impl::BasicWriter::setMetaData().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ view()

StringView Arcane::String::view ( ) const

Returns a view of the current string.

The encoding used is UTF-8.

Warning
The instance remains the owner of the returned value and this value is invalidated by any modification of this instance. The returned view should not be retained.

Definition at line 368 of file String.cc.

References m_p.

Referenced by Arcane::ParameterOptionElementsCollection::addParameter(), Arcane::builtInGetValue(), Arcane::ParameterCaseOption::count(), Arcane::ParameterCaseOption::count(), Arcane::ParameterCaseOption::exist(), Arcane::ParameterCaseOption::existAnyIndex(), Arcane::ParameterCaseOption::existAnyIndex(), Arcane::ParameterCaseOption::getParameterOrNull(), Arcane::ParameterCaseOption::getParameterOrNull(), Arcane::ParameterCaseOption::getParameterOrNull(), Arcane::ParameterCaseOption::indexesInParam(), Arcane::ParameterCaseOption::indexesInParam(), and operator StringView().

Here is the caller graph for this function:

◆ writeBytes()

void Arcane::String::writeBytes ( std::ostream & o) const

Writes the string in UTF-8 format to the stream o.

Definition at line 1246 of file String.cc.

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

Referenced by Arcane::InternalInfosDumper::dumpArcaneDatabase(), operator<<, and Arcane::impl::BasicWriter::setMetaData().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator!= [1/3]

bool operator!= ( const char * a,
const String & b )
friend

Compares two unicode strings.

Return values
trueif they are different,
falseif they are equal.

Definition at line 345 of file arccore/src/base/arccore/base/String.h.

References operator==, and String().

◆ operator!= [2/3]

bool operator!= ( const String & a,
const char * b )
friend

Compares two unicode strings.

Return values
trueif they are different,
falseif they are equal.

Definition at line 362 of file arccore/src/base/arccore/base/String.h.

References operator==, and String().

◆ operator!= [3/3]

bool operator!= ( const String & a,
const String & b )
friend

Compares two unicode strings.

Return values
trueif they are different,
falseif they are equal. \relate String

Definition at line 323 of file arccore/src/base/arccore/base/String.h.

References operator==, and String().

◆ operator+

String operator+ ( const char * a,
const String & b )
friend

Adds two strings.

Definition at line 1219 of file String.cc.

References operator+, and String().

Referenced by operator+, and operator+().

◆ operator< [1/2]

bool operator< ( const String & a,
const String & b )
friend

Definition at line 1204 of file String.cc.

◆ operator< [2/2]

bool operator< ( const String & a,
const String & b )
friend

Definition at line 1204 of file String.cc.

◆ operator<<

std::ostream & operator<< ( std::ostream & o,
const String & str )
friend

String output operator.

Definition at line 1231 of file String.cc.

References localstr(), operator<<, String(), and writeBytes().

Referenced by operator<<.

◆ operator== [1/3]

bool operator== ( const char * a,
const String & b )
friend

Compares two unicode strings.

Return values
trueif they are equal,
falseotherwise.

Definition at line 1199 of file String.cc.

References operator==, and String().

◆ operator== [2/3]

bool operator== ( const String & a,
const char * b )
friend

Compares two unicode strings.

Return values
trueif they are equal,
falseotherwise.

Definition at line 1193 of file String.cc.

References operator==, and String().

◆ operator== [3/3]

bool operator== ( const String & a,
const String & b )
friend

Compares two unicode strings.

Return values
trueif they are equal,
falseotherwise. \relate String

Definition at line 1164 of file String.cc.

References Arcane::CStringUtils::isEqual(), m_p, operator==, and String().

Referenced by operator!=, operator!=, operator!=, operator==, operator==, and operator==.

◆ operator>>

std::istream & operator>> ( std::istream & o,
String & str )
friend

String input operator.

Definition at line 1258 of file String.cc.

References String().

◆ StringBuilder

friend class StringBuilder
friend

Definition at line 74 of file arccore/src/base/arccore/base/String.h.

◆ StringUtilsImpl

friend class StringUtilsImpl
friend

Definition at line 75 of file arccore/src/base/arccore/base/String.h.

Member Data Documentation

◆ m_const_ptr

const char* Arcane::String::m_const_ptr = nullptr
mutableprivate

Definition at line 534 of file arccore/src/base/arccore/base/String.h.

◆ m_const_ptr_size

Int64 Arcane::String::m_const_ptr_size = 0
mutableprivate

◆ m_p


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