Open CASCADE Technology  6.9.0
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. More...
 
 TCollection_HExtendedString (const Standard_CString message)
 Initializes a HExtendedString with a CString. More...
 
 TCollection_HExtendedString (const Standard_ExtString message)
 Initializes a HExtendedString with an ExtString. More...
 
 TCollection_HExtendedString (const Standard_ExtCharacter aChar)
 Initializes a HExtendedString with a single character. More...
 
 TCollection_HExtendedString (const Standard_Integer length, const Standard_ExtCharacter filler)
 Initializes a HExtendedString with <length> space allocated. and filled with <filler>.This is usefull for buffers. More...
 
 TCollection_HExtendedString (const TCollection_ExtendedString &aString)
 Initializes a HExtendedString with a HExtendedString. More...
 
 TCollection_HExtendedString (const Handle< TCollection_HAsciiString > &aString)
 Initializes a HExtendedString with an HAsciiString. More...
 
 TCollection_HExtendedString (const Handle< TCollection_HExtendedString > &aString)
 Initializes a HExtendedString with a HExtendedString. More...
 
void AssignCat (const Handle< TCollection_HExtendedString > &other)
 Appends <other> to me. More...
 
Handle
< TCollection_HExtendedString
Cat (const Handle< TCollection_HExtendedString > &other) const
 Returns a string appending <other> to me. More...
 
void ChangeAll (const Standard_ExtCharacter aChar, const Standard_ExtCharacter NewChar)
 Substitutes all the characters equal to aChar by NewChar in the string <me>. More...
 
void Clear ()
 Removes all characters contained in <me>. This produces an empty ExtendedString. More...
 
Standard_Boolean IsEmpty () const
 Returns True if the string <me> contains zero character. More...
 
void Insert (const Standard_Integer where, const Standard_ExtCharacter 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". More...
 
void Insert (const Standard_Integer where, const Handle< TCollection_HExtendedString > &what)
 Insert a HExtendedString at position <where>. More...
 
Standard_Boolean IsLess (const Handle< TCollection_HExtendedString > &other) const
 Returns TRUE if <me> is less than <other>. More...
 
Standard_Boolean IsGreater (const Handle< TCollection_HExtendedString > &other) const
 Returns TRUE if <me> is greater than <other>. More...
 
Standard_Boolean IsAscii () const
 Returns True if the string contains only "Ascii Range" characters. More...
 
Standard_Integer Length () const
 Returns number of characters in <me>. This is the same functionality as 'strlen' in C. More...
 
void Remove (const Standard_Integer where, const Standard_Integer 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". More...
 
void RemoveAll (const Standard_ExtCharacter what)
 Removes every <what> characters from <me>. More...
 
void SetValue (const Standard_Integer where, const Standard_ExtCharacter 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". More...
 
void SetValue (const Standard_Integer where, const Handle< TCollection_HExtendedString > &what)
 Replaces a part of <me> by another string. More...
 
Handle
< TCollection_HExtendedString
Split (const Standard_Integer where)
 Splits a ExtendedString into two sub-strings. Example: aString contains "abcdefg" aString.Split(3) gives <me> = "abc" and returns "defg". More...
 
Standard_Integer Search (const 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. More...
 
Standard_Integer SearchFromEnd (const 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. More...
 
const Standard_ExtString ToExtString () const
 Returns pointer to ExtString. More...
 
Handle
< TCollection_HExtendedString
Token (const Standard_ExtString separators, const Standard_Integer 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". More...
 
void Trunc (const Standard_Integer ahowmany)
 Truncates <me> to <ahowmany> characters. Example: me = "Hello Dolly" -> Trunc(3) -> me = "Hel". More...
 
Standard_ExtCharacter Value (const Standard_Integer 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'. More...
 
const TCollection_ExtendedStringString () const
 Returns the field myString. More...
 
void Print (Standard_OStream &astream) const
 Displays <me> . More...
 
Standard_Boolean IsSameState (const Handle< TCollection_HExtendedString > &other) const
 
- Public Member Functions inherited from MMgt_TShared
virtual void Delete () const
 Memory deallocator for transient classes. More...
 
- Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor. More...
 
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing. More...
 
Standard_Transientoperator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter. More...
 
virtual ~Standard_Transient ()
 Destructor must be virtual. More...
 
virtual const
Handle_Standard_Type & 
DynamicType () const
 Returns a type information object about this object. More...
 
Standard_Boolean IsInstance (const Handle_Standard_Type &theType) const
 Returns a true value if this is an instance of Type. More...
 
Standard_Boolean IsInstance (const Standard_CString theTypeName) const
 Returns a true value if this is an instance of TypeName. More...
 
Standard_Boolean IsKind (const 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. More...
 
Standard_Boolean IsKind (const Standard_CString 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. More...
 
virtual Handle_Standard_Transient This () const
 Returns a Handle which references this object. Must never be called to objects created in stack. More...
 
Standard_Integer GetRefCount () const
 Get the reference counter of this object. More...
 

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::TCollection_HExtendedString ( )

Initializes a HExtendedString to an empty ExtendedString.

TCollection_HExtendedString::TCollection_HExtendedString ( const Standard_CString  message)

Initializes a HExtendedString with a CString.

TCollection_HExtendedString::TCollection_HExtendedString ( const Standard_ExtString  message)

Initializes a HExtendedString with an ExtString.

TCollection_HExtendedString::TCollection_HExtendedString ( const Standard_ExtCharacter  aChar)

Initializes a HExtendedString with a single character.

TCollection_HExtendedString::TCollection_HExtendedString ( const Standard_Integer  length,
const Standard_ExtCharacter  filler 
)

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

TCollection_HExtendedString::TCollection_HExtendedString ( const TCollection_ExtendedString aString)

Initializes a HExtendedString with a HExtendedString.

TCollection_HExtendedString::TCollection_HExtendedString ( const Handle< TCollection_HAsciiString > &  aString)

Initializes a HExtendedString with an HAsciiString.

TCollection_HExtendedString::TCollection_HExtendedString ( const Handle< TCollection_HExtendedString > &  aString)

Initializes a HExtendedString with a HExtendedString.

Member Function Documentation

void TCollection_HExtendedString::AssignCat ( const Handle< TCollection_HExtendedString > &  other)

Appends <other> to me.

Handle< TCollection_HExtendedString > TCollection_HExtendedString::Cat ( const Handle< TCollection_HExtendedString > &  other) const

Returns a string appending <other> to me.

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

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

void TCollection_HExtendedString::Clear ( )

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

void TCollection_HExtendedString::Insert ( const Standard_Integer  where,
const Standard_ExtCharacter  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 TCollection_HExtendedString::Insert ( const Standard_Integer  where,
const Handle< TCollection_HExtendedString > &  what 
)

Insert a HExtendedString at position <where>.

Standard_Boolean TCollection_HExtendedString::IsAscii ( ) const

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

Standard_Boolean TCollection_HExtendedString::IsEmpty ( ) const

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

Standard_Boolean TCollection_HExtendedString::IsGreater ( const Handle< TCollection_HExtendedString > &  other) const

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

Standard_Boolean TCollection_HExtendedString::IsLess ( const Handle< TCollection_HExtendedString > &  other) const

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

Standard_Boolean TCollection_HExtendedString::IsSameState ( const Handle< TCollection_HExtendedString > &  other) const
Standard_Integer TCollection_HExtendedString::Length ( ) const

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

void TCollection_HExtendedString::Print ( Standard_OStream astream) const

Displays <me> .

void TCollection_HExtendedString::Remove ( const Standard_Integer  where,
const Standard_Integer  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 TCollection_HExtendedString::RemoveAll ( const Standard_ExtCharacter  what)

Removes every <what> characters from <me>.

Standard_Integer TCollection_HExtendedString::Search ( const 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.

Standard_Integer TCollection_HExtendedString::SearchFromEnd ( const 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.

void TCollection_HExtendedString::SetValue ( const Standard_Integer  where,
const Standard_ExtCharacter  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 TCollection_HExtendedString::SetValue ( const Standard_Integer  where,
const Handle< TCollection_HExtendedString > &  what 
)

Replaces a part of <me> by another string.

Handle< TCollection_HExtendedString > TCollection_HExtendedString::Split ( const Standard_Integer  where)

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

const TCollection_ExtendedString& TCollection_HExtendedString::String ( ) const

Returns the field myString.

const Standard_ExtString TCollection_HExtendedString::ToExtString ( ) const

Returns pointer to ExtString.

Handle< TCollection_HExtendedString > TCollection_HExtendedString::Token ( const Standard_ExtString  separators,
const Standard_Integer  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 TCollection_HExtendedString::Trunc ( const Standard_Integer  ahowmany)

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

Standard_ExtCharacter TCollection_HExtendedString::Value ( const Standard_Integer  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: