Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Public Member Functions
TCollection_HExtendedString Class Reference

A variable-length sequence of "extended" (UNICODE) characters (16-bit character type). It provides editing operations with built-in memory management to make ExtendedString objects easier to use than ordinary extended character arrays. HExtendedString objects are handles to strings. More...

#include <TCollection_HExtendedString.hxx>

Inheritance diagram for TCollection_HExtendedString:
Inheritance graph
[legend]

Public Member Functions

 TCollection_HExtendedString ()
 Initializes a HExtendedString to an empty ExtendedString.
 
 TCollection_HExtendedString (const char *const message)
 Initializes a HExtendedString with a CString.
 
 TCollection_HExtendedString (const char16_t *const message)
 Initializes a HExtendedString with an ExtString.
 
 TCollection_HExtendedString (const char16_t aChar)
 Initializes a HExtendedString with a single character.
 
 TCollection_HExtendedString (const int length, const char16_t filler)
 Initializes a HExtendedString with <length> space allocated. and filled with <filler>. This is useful for buffers.
 
 TCollection_HExtendedString (const TCollection_ExtendedString &aString)
 Initializes a HExtendedString with a ExtendedString.
 
 TCollection_HExtendedString (TCollection_ExtendedString &&theString) noexcept
 Initializes a HExtendedString with a ExtendedString.
 
 TCollection_HExtendedString (const occ::handle< TCollection_HAsciiString > &aString)
 Initializes a HExtendedString with an HAsciiString.
 
 TCollection_HExtendedString (const occ::handle< TCollection_HExtendedString > &aString)
 Initializes a HExtendedString with a HExtendedString.
 
void AssignCat (const occ::handle< TCollection_HExtendedString > &other)
 Appends <other> to me.
 
occ::handle< TCollection_HExtendedStringCat (const occ::handle< TCollection_HExtendedString > &other) const
 Returns a string appending <other> to me.
 
void ChangeAll (const char16_t aChar, const char16_t NewChar)
 Substitutes all the characters equal to aChar by NewChar in the string <me>.
 
void Clear ()
 Removes all characters contained in <me>. This produces an empty ExtendedString.
 
bool IsEmpty () const
 Returns True if the string <me> contains zero character.
 
void Insert (const int where, const char16_t what)
 Insert a ExtCharacter at position <where>. Example: aString contains "hy not ?" aString.Insert(1,'W'); gives "Why not ?" aString contains "Wh" aString.Insert(3,'y'); gives "Why" aString contains "Way" aString.Insert(2,'h'); gives "Why".
 
void Insert (const int where, const occ::handle< TCollection_HExtendedString > &what)
 Insert a HExtendedString at position <where>.
 
bool IsLess (const occ::handle< TCollection_HExtendedString > &other) const
 Returns TRUE if <me> is less than <other>.
 
bool IsGreater (const occ::handle< TCollection_HExtendedString > &other) const
 Returns TRUE if <me> is greater than <other>.
 
bool IsAscii () const
 Returns True if the string contains only "Ascii Range" characters.
 
int Length () const
 Returns number of characters in <me>. This is the same functionality as 'strlen' in C.
 
void Remove (const int where, const int ahowmany=1)
 Erases <ahowmany> characters from position <where>, <where> included. Example: aString contains "Hello" aString.Erase(2,2) erases 2 characters from position 1 This gives "Hlo".
 
void RemoveAll (const char16_t what)
 Removes every <what> characters from <me>.
 
void SetValue (const int where, const char16_t what)
 Replaces one character in the string at position <where>. If <where> is less than zero or greater than the length of <me> an exception is raised. Example: aString contains "Garbake" astring.Replace(6,'g') gives <me> = "Garbage".
 
void SetValue (const int where, const occ::handle< TCollection_HExtendedString > &what)
 Replaces a part of <me> by another string.
 
occ::handle< TCollection_HExtendedStringSplit (const int where)
 Splits a ExtendedString into two sub-strings. Example: aString contains "abcdefg" aString.Split(3) gives <me> = "abc" and returns "defg".
 
int Search (const occ::handle< TCollection_HExtendedString > &what) const
 Searches a String in <me> from the beginning and returns position of first item <what> matching. It returns -1 if not found.
 
int SearchFromEnd (const occ::handle< TCollection_HExtendedString > &what) const
 Searches a ExtendedString in another ExtendedString from the end and returns position of first item <what> matching. It returns -1 if not found.
 
const char16_tToExtString () const
 Returns pointer to ExtString.
 
occ::handle< TCollection_HExtendedStringToken (const char16_t *const separators, const int whichone=1) const
 Extracts <whichone> token from <me>. By default, the <separators> is set to space and tabulation. By default, the token extracted is the first one (whichone = 1). <separators> contains all separators you need. If no token indexed by <whichone> is found, it returns an empty String. Example: aString contains "This is a message" aString.Token() returns "This" aString.Token(" ",4) returns "message" aString.Token(" ",2) returns "is" aString.Token(" ",9) returns "" Other separators than space character and tabulation are allowed aString contains "1234; test:message , value" aString.Token("; :,",4) returns "value" aString.Token("; :,",2) returns "test".
 
void Trunc (const int ahowmany)
 Truncates <me> to <ahowmany> characters. Example: me = "Hello Dolly" -> Trunc(3) -> me = "Hel".
 
char16_t Value (const int where) const
 Returns ExtCharacter at position <where> in <me>. If <where> is less than zero or greater than the length of <me>, an exception is raised. Example: aString contains "Hello" aString.Value(2) returns 'e'.
 
const TCollection_ExtendedStringString () const
 Returns the field myString.
 
void Print (Standard_OStream &astream) const
 Displays <me>.
 
bool IsSameState (const occ::handle< TCollection_HExtendedString > &other) const
 
- Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor.
 
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing.
 
Standard_Transientoperator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter.
 
virtual ~Standard_Transient ()=default
 Destructor must be virtual.
 
virtual const opencascade::handle< Standard_Type > & DynamicType () const
 Returns a type descriptor about this object.
 
bool IsInstance (const opencascade::handle< Standard_Type > &theType) const
 Returns a true value if this is an instance of Type.
 
bool IsInstance (const char *const theTypeName) const
 Returns a true value if this is an instance of TypeName.
 
bool IsKind (const opencascade::handle< Standard_Type > &theType) const
 Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
 
bool IsKind (const char *const theTypeName) const
 Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
 
Standard_TransientThis () const
 Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero.
 
int GetRefCount () const noexcept
 Get the reference counter of this object.
 
void IncrementRefCounter () noexcept
 Increments the reference counter of this object. Uses relaxed memory ordering since incrementing only requires atomicity, not synchronization with other memory operations.
 
int DecrementRefCounter () noexcept
 Decrements the reference counter of this object; returns the decremented value. Uses release ordering for the decrement to ensure all writes to the object are visible before the count reaches zero. An acquire fence is added only when the count reaches zero, ensuring proper synchronization before deletion. This is more efficient than using acq_rel for every decrement.
 
virtual void Delete () const
 Memory deallocator for transient classes.
 

Additional Inherited Members

- Public Types inherited from Standard_Transient
typedef void base_type
 Returns a type descriptor about this object.
 
- Static Public Member Functions inherited from Standard_Transient
static constexpr const charget_type_name ()
 Returns a type descriptor about this object.
 
static const opencascade::handle< Standard_Type > & get_type_descriptor ()
 Returns type descriptor of Standard_Transient class.
 

Detailed Description

A variable-length sequence of "extended" (UNICODE) characters (16-bit character type). It provides editing operations with built-in memory management to make ExtendedString objects easier to use than ordinary extended character arrays. HExtendedString objects are handles to strings.

Constructor & Destructor Documentation

◆ TCollection_HExtendedString() [1/9]

TCollection_HExtendedString::TCollection_HExtendedString ( )

Initializes a HExtendedString to an empty ExtendedString.

◆ TCollection_HExtendedString() [2/9]

TCollection_HExtendedString::TCollection_HExtendedString ( const char *const message)

Initializes a HExtendedString with a CString.

◆ TCollection_HExtendedString() [3/9]

TCollection_HExtendedString::TCollection_HExtendedString ( const char16_t *const message)

Initializes a HExtendedString with an ExtString.

◆ TCollection_HExtendedString() [4/9]

TCollection_HExtendedString::TCollection_HExtendedString ( const char16_t aChar)

Initializes a HExtendedString with a single character.

◆ TCollection_HExtendedString() [5/9]

TCollection_HExtendedString::TCollection_HExtendedString ( const int length,
const char16_t filler )

Initializes a HExtendedString with <length> space allocated. and filled with <filler>. This is useful for buffers.

◆ TCollection_HExtendedString() [6/9]

TCollection_HExtendedString::TCollection_HExtendedString ( const TCollection_ExtendedString & aString)

Initializes a HExtendedString with a ExtendedString.

◆ TCollection_HExtendedString() [7/9]

TCollection_HExtendedString::TCollection_HExtendedString ( TCollection_ExtendedString && theString)
inlinenoexcept

Initializes a HExtendedString with a ExtendedString.

◆ TCollection_HExtendedString() [8/9]

TCollection_HExtendedString::TCollection_HExtendedString ( const occ::handle< TCollection_HAsciiString > & aString)

Initializes a HExtendedString with an HAsciiString.

◆ TCollection_HExtendedString() [9/9]

TCollection_HExtendedString::TCollection_HExtendedString ( const occ::handle< TCollection_HExtendedString > & aString)

Initializes a HExtendedString with a HExtendedString.

Member Function Documentation

◆ AssignCat()

void TCollection_HExtendedString::AssignCat ( const occ::handle< TCollection_HExtendedString > & other)

Appends <other> to me.

◆ Cat()

occ::handle< TCollection_HExtendedString > TCollection_HExtendedString::Cat ( const occ::handle< TCollection_HExtendedString > & other) const

Returns a string appending <other> to me.

◆ ChangeAll()

void TCollection_HExtendedString::ChangeAll ( const char16_t aChar,
const char16_t NewChar )

Substitutes all the characters equal to aChar by NewChar in the string <me>.

◆ Clear()

void TCollection_HExtendedString::Clear ( )

Removes all characters contained in <me>. This produces an empty ExtendedString.

◆ Insert() [1/2]

void TCollection_HExtendedString::Insert ( const int where,
const char16_t what )

Insert a ExtCharacter at position <where>. Example: aString contains "hy not ?" aString.Insert(1,'W'); gives "Why not ?" aString contains "Wh" aString.Insert(3,'y'); gives "Why" aString contains "Way" aString.Insert(2,'h'); gives "Why".

◆ Insert() [2/2]

void TCollection_HExtendedString::Insert ( const int where,
const occ::handle< TCollection_HExtendedString > & what )

Insert a HExtendedString at position <where>.

◆ IsAscii()

bool TCollection_HExtendedString::IsAscii ( ) const

Returns True if the string contains only "Ascii Range" characters.

◆ IsEmpty()

bool TCollection_HExtendedString::IsEmpty ( ) const

Returns True if the string <me> contains zero character.

◆ IsGreater()

bool TCollection_HExtendedString::IsGreater ( const occ::handle< TCollection_HExtendedString > & other) const

Returns TRUE if <me> is greater than <other>.

◆ IsLess()

bool TCollection_HExtendedString::IsLess ( const occ::handle< TCollection_HExtendedString > & other) const

Returns TRUE if <me> is less than <other>.

◆ IsSameState()

bool TCollection_HExtendedString::IsSameState ( const occ::handle< TCollection_HExtendedString > & other) const

◆ Length()

int TCollection_HExtendedString::Length ( ) const

Returns number of characters in <me>. This is the same functionality as 'strlen' in C.

◆ Print()

void TCollection_HExtendedString::Print ( Standard_OStream & astream) const

Displays <me>.

◆ Remove()

void TCollection_HExtendedString::Remove ( const int where,
const int ahowmany = 1 )

Erases <ahowmany> characters from position <where>, <where> included. Example: aString contains "Hello" aString.Erase(2,2) erases 2 characters from position 1 This gives "Hlo".

◆ RemoveAll()

void TCollection_HExtendedString::RemoveAll ( const char16_t what)

Removes every <what> characters from <me>.

◆ Search()

int TCollection_HExtendedString::Search ( const occ::handle< TCollection_HExtendedString > & what) const

Searches a String in <me> from the beginning and returns position of first item <what> matching. It returns -1 if not found.

◆ SearchFromEnd()

int TCollection_HExtendedString::SearchFromEnd ( const occ::handle< TCollection_HExtendedString > & what) const

Searches a ExtendedString in another ExtendedString from the end and returns position of first item <what> matching. It returns -1 if not found.

◆ SetValue() [1/2]

void TCollection_HExtendedString::SetValue ( const int where,
const char16_t what )

Replaces one character in the string at position <where>. If <where> is less than zero or greater than the length of <me> an exception is raised. Example: aString contains "Garbake" astring.Replace(6,'g') gives <me> = "Garbage".

◆ SetValue() [2/2]

void TCollection_HExtendedString::SetValue ( const int where,
const occ::handle< TCollection_HExtendedString > & what )

Replaces a part of <me> by another string.

◆ Split()

occ::handle< TCollection_HExtendedString > TCollection_HExtendedString::Split ( const int where)

Splits a ExtendedString into two sub-strings. Example: aString contains "abcdefg" aString.Split(3) gives <me> = "abc" and returns "defg".

◆ String()

const TCollection_ExtendedString & TCollection_HExtendedString::String ( ) const

Returns the field myString.

◆ ToExtString()

const char16_t * TCollection_HExtendedString::ToExtString ( ) const
inline

Returns pointer to ExtString.

◆ Token()

occ::handle< TCollection_HExtendedString > TCollection_HExtendedString::Token ( const char16_t *const separators,
const int whichone = 1 ) const

Extracts <whichone> token from <me>. By default, the <separators> is set to space and tabulation. By default, the token extracted is the first one (whichone = 1). <separators> contains all separators you need. If no token indexed by <whichone> is found, it returns an empty String. Example: aString contains "This is a message" aString.Token() returns "This" aString.Token(" ",4) returns "message" aString.Token(" ",2) returns "is" aString.Token(" ",9) returns "" Other separators than space character and tabulation are allowed aString contains "1234; test:message , value" aString.Token("; :,",4) returns "value" aString.Token("; :,",2) returns "test".

◆ Trunc()

void TCollection_HExtendedString::Trunc ( const int ahowmany)

Truncates <me> to <ahowmany> characters. Example: me = "Hello Dolly" -> Trunc(3) -> me = "Hel".

◆ Value()

char16_t TCollection_HExtendedString::Value ( const int where) const

Returns ExtCharacter at position <where> in <me>. If <where> is less than zero or greater than the length of <me>, an exception is raised. Example: aString contains "Hello" aString.Value(2) returns 'e'.


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