OCCT3D OCCT 8.0.1
OCCT documentation

Search guides and API reference

Enter at least two characters.

    Open CASCADE Technology Reference Manual 8.0.1
    NCollection_UtfString< Type > Class Template Reference

    This template class represent constant UTF-* string. String stored in memory continuously, always NULL-terminated and can be used as standard C-string using ToCString() method. More...

    #include <NCollection_UtfString.hxx>

    Public Member Functions

    NCollection_UtfIterator< Type > Iterator () const
    int Size () const noexcept
    int Length () const noexcept
    char32_t GetChar (const int theCharIndex) const
     Retrieve Unicode symbol at specified position. Warning! This is a slow access. Iterator should be used for consecutive parsing.
    const Type * GetCharBuffer (const int theCharIndex) const
     Retrieve string buffer at specified position. Warning! This is a slow access. Iterator should be used for consecutive parsing.
    char32_t operator[] (const int theCharIndex) const
     Retrieve Unicode symbol at specified position. Warning! This is a slow access. Iterator should be used for consecutive parsing.
     NCollection_UtfString ()
     Initialize empty string.
     NCollection_UtfString (const NCollection_UtfString &theCopy)
     Copy constructor.
     NCollection_UtfString (NCollection_UtfString &&theOther) noexcept
     Move constructor.
     NCollection_UtfString (const char *theCopyUtf8, const int theLength=-1)
     Copy constructor from UTF-8 string.
     NCollection_UtfString (const char16_t *theCopyUtf16, const int theLength=-1)
     Copy constructor from UTF-16 string.
     NCollection_UtfString (const char32_t *theCopyUtf32, const int theLength=-1)
     Copy constructor from UTF-32 string.
     NCollection_UtfString (const wchar_t *theCopyUtfWide, const int theLength=-1)
     Copy constructor from wide UTF string.
    template<typename TypeFrom>
    void FromUnicode (const TypeFrom *theStringUtf, const int theLength=-1)
     Copy from Unicode string in UTF-8, UTF-16, or UTF-32 encoding, determined by size of TypeFrom character type.
    void FromLocale (const char *theString, const int theLength=-1)
     Copy from multibyte string in current system locale.
     ~NCollection_UtfString ()
     Destructor.
    bool IsEqual (const NCollection_UtfString &theCompare) const noexcept
     Compares this string with another one.
    NCollection_UtfString SubString (const int theStart, const int theEnd) const
     Returns the substring.
    const Type * ToCString () const noexcept
     Returns NULL-terminated Unicode string. Should not be modified or deleted!
    const NCollection_UtfString< char > ToUtf8 () const
    const NCollection_UtfString< char16_t > ToUtf16 () const
    const NCollection_UtfString< char32_t > ToUtf32 () const
    const NCollection_UtfString< wchar_t > ToUtfWide () const
    bool ToLocale (char *theBuffer, const int theSizeBytes) const
     Converts the string into string in the current system locale.
    bool IsEmpty () const noexcept
    void Clear ()
     Zero string.
    compare operators
    bool operator== (const NCollection_UtfString &theCompare) const noexcept
    bool operator!= (const NCollection_UtfString &theCompare) const noexcept

    assign operators

    Copy from another string.

    const NCollection_UtfStringAssign (const NCollection_UtfString &theOther)
     Exchange the data of two strings (without reallocating memory).
    void Swap (NCollection_UtfString &theOther) noexcept
     Exchange the data of two strings (without reallocating memory).
    const NCollection_UtfStringoperator= (const NCollection_UtfString &theOther)
     Copy from another string.
    NCollection_UtfStringoperator= (NCollection_UtfString &&theOther)
     Move assignment operator.
    const NCollection_UtfStringoperator= (const char *theStringUtf8)
     Copy from UTF-8 NULL-terminated string.
    const NCollection_UtfStringoperator= (const wchar_t *theStringUtfWide)
     Copy from wchar_t UTF NULL-terminated string.
    NCollection_UtfStringoperator+= (const NCollection_UtfString &theAppend)
     Join strings.

    Detailed Description

    template<typename Type>
    class NCollection_UtfString< Type >

    This template class represent constant UTF-* string. String stored in memory continuously, always NULL-terminated and can be used as standard C-string using ToCString() method.

    Notice that changing the string is not allowed and any modifications should produce new string.

    In comments to this class, terms "Unicode symbol" is used as synonym of "Unicode code point".

    Constructor & Destructor Documentation

    ◆ NCollection_UtfString() [1/7]

    template<typename Type>
    NCollection_UtfString< Type >::NCollection_UtfString ( )

    Initialize empty string.

    ◆ NCollection_UtfString() [2/7]

    template<typename Type>
    NCollection_UtfString< Type >::NCollection_UtfString ( const NCollection_UtfString< Type > & theCopy)

    Copy constructor.

    Parameters
    theCopystring to copy.

    ◆ NCollection_UtfString() [3/7]

    template<typename Type>
    NCollection_UtfString< Type >::NCollection_UtfString ( NCollection_UtfString< Type > && theOther)
    noexcept

    Move constructor.

    ◆ NCollection_UtfString() [4/7]

    template<typename Type>
    NCollection_UtfString< Type >::NCollection_UtfString ( const char * theCopyUtf8,
    const int theLength = -1 )

    Copy constructor from UTF-8 string.

    Parameters
    theCopyUtf8UTF-8 string to copy
    theLengthoptional length limit in Unicode symbols (NOT bytes!) The string is copied till NULL symbol or, if theLength >0, till either NULL or theLength-th symbol (which comes first).

    ◆ NCollection_UtfString() [5/7]

    template<typename Type>
    NCollection_UtfString< Type >::NCollection_UtfString ( const char16_t * theCopyUtf16,
    const int theLength = -1 )

    Copy constructor from UTF-16 string.

    Parameters
    theCopyUtf16UTF-16 string to copy
    theLengththe length limit in Unicode symbols (NOT bytes!) The string is copied till NULL symbol or, if theLength >0, till either NULL or theLength-th symbol (which comes first).

    ◆ NCollection_UtfString() [6/7]

    template<typename Type>
    NCollection_UtfString< Type >::NCollection_UtfString ( const char32_t * theCopyUtf32,
    const int theLength = -1 )

    Copy constructor from UTF-32 string.

    Parameters
    theCopyUtf32UTF-32 string to copy
    theLengththe length limit in Unicode symbols (NOT bytes!) The string is copied till NULL symbol or, if theLength >0, till either NULL or theLength-th symbol (which comes first).

    ◆ NCollection_UtfString() [7/7]

    template<typename Type>
    NCollection_UtfString< Type >::NCollection_UtfString ( const wchar_t * theCopyUtfWide,
    const int theLength = -1 )

    Copy constructor from wide UTF string.

    Parameters
    theCopyUtfWidewide UTF string to copy
    theLengththe length limit in Unicode symbols (NOT bytes!) The string is copied till NULL symbol or, if theLength >0, till either NULL or theLength-th symbol (which comes first).

    This constructor is undefined if wchar_t is the same type as char16_t.

    ◆ ~NCollection_UtfString()

    template<typename Type>
    NCollection_UtfString< Type >::~NCollection_UtfString ( )

    Destructor.

    Member Function Documentation

    ◆ Assign()

    template<typename Type>
    const NCollection_UtfString & NCollection_UtfString< Type >::Assign ( const NCollection_UtfString< Type > & theOther)

    Exchange the data of two strings (without reallocating memory).

    ◆ Clear()

    template<typename Type>
    void NCollection_UtfString< Type >::Clear ( )

    Zero string.

    ◆ FromLocale()

    template<typename Type>
    void NCollection_UtfString< Type >::FromLocale ( const char * theString,
    const int theLength = -1 )

    Copy from multibyte string in current system locale.

    Parameters
    theStringmultibyte string
    theLengththe length limit in Unicode symbols The string is copied till NULL symbol or, if theLength >0, till either NULL or theLength-th symbol (which comes first).

    ◆ FromUnicode()

    template<typename Type>
    template<typename TypeFrom>
    void NCollection_UtfString< Type >::FromUnicode ( const TypeFrom * theStringUtf,
    const int theLength = -1 )
    inline

    Copy from Unicode string in UTF-8, UTF-16, or UTF-32 encoding, determined by size of TypeFrom character type.

    Parameters
    theStringUtfUnicode string
    theLengththe length limit in Unicode symbols The string is copied till NULL symbol or, if theLength >0, till either NULL or theLength-th symbol (which comes first).

    ◆ GetChar()

    template<typename Type>
    char32_t NCollection_UtfString< Type >::GetChar ( const int theCharIndex) const

    Retrieve Unicode symbol at specified position. Warning! This is a slow access. Iterator should be used for consecutive parsing.

    Parameters
    theCharIndexthe index of the symbol, should be lesser than Length()
    Returns
    the Unicode symbol value

    ◆ GetCharBuffer()

    template<typename Type>
    const Type * NCollection_UtfString< Type >::GetCharBuffer ( const int theCharIndex) const

    Retrieve string buffer at specified position. Warning! This is a slow access. Iterator should be used for consecutive parsing.

    Parameters
    theCharIndexthe index of the symbol, should be less than Length() (first symbol of the string has index 0)
    Returns
    the pointer to the symbol

    ◆ IsEmpty()

    template<typename Type>
    bool NCollection_UtfString< Type >::IsEmpty ( ) const
    inlinenoexcept
    Returns
    true if string is empty

    ◆ IsEqual()

    template<typename Type>
    bool NCollection_UtfString< Type >::IsEqual ( const NCollection_UtfString< Type > & theCompare) const
    noexcept

    Compares this string with another one.

    ◆ Iterator()

    template<typename Type>
    NCollection_UtfIterator< Type > NCollection_UtfString< Type >::Iterator ( ) const
    inline

    ◆ Length()

    template<typename Type>
    int NCollection_UtfString< Type >::Length ( ) const
    inlinenoexcept
    Returns
    the length of the string in Unicode symbols

    ◆ operator!=()

    template<typename Type>
    bool NCollection_UtfString< Type >::operator!= ( const NCollection_UtfString< Type > & theCompare) const
    noexcept

    ◆ operator+=()

    template<typename Type>
    NCollection_UtfString & NCollection_UtfString< Type >::operator+= ( const NCollection_UtfString< Type > & theAppend)

    Join strings.

    ◆ operator=() [1/4]

    template<typename Type>
    const NCollection_UtfString & NCollection_UtfString< Type >::operator= ( const char * theStringUtf8)

    Copy from UTF-8 NULL-terminated string.

    ◆ operator=() [2/4]

    template<typename Type>
    const NCollection_UtfString & NCollection_UtfString< Type >::operator= ( const NCollection_UtfString< Type > & theOther)
    inline

    Copy from another string.

    ◆ operator=() [3/4]

    template<typename Type>
    const NCollection_UtfString & NCollection_UtfString< Type >::operator= ( const wchar_t * theStringUtfWide)

    Copy from wchar_t UTF NULL-terminated string.

    ◆ operator=() [4/4]

    template<typename Type>
    NCollection_UtfString & NCollection_UtfString< Type >::operator= ( NCollection_UtfString< Type > && theOther)
    inline

    Move assignment operator.

    ◆ operator==()

    template<typename Type>
    bool NCollection_UtfString< Type >::operator== ( const NCollection_UtfString< Type > & theCompare) const
    inlinenoexcept

    ◆ operator[]()

    template<typename Type>
    char32_t NCollection_UtfString< Type >::operator[] ( const int theCharIndex) const
    inline

    Retrieve Unicode symbol at specified position. Warning! This is a slow access. Iterator should be used for consecutive parsing.

    ◆ Size()

    template<typename Type>
    int NCollection_UtfString< Type >::Size ( ) const
    inlinenoexcept
    Returns
    the size of the buffer in bytes, excluding NULL-termination symbol

    ◆ SubString()

    template<typename Type>
    NCollection_UtfString NCollection_UtfString< Type >::SubString ( const int theStart,
    const int theEnd ) const

    Returns the substring.

    Parameters
    theStartstart index (inclusive) of subString
    theEndend index (exclusive) of subString
    Returns
    the substring

    ◆ Swap()

    template<typename Type>
    void NCollection_UtfString< Type >::Swap ( NCollection_UtfString< Type > & theOther)
    noexcept

    Exchange the data of two strings (without reallocating memory).

    ◆ ToCString()

    template<typename Type>
    const Type * NCollection_UtfString< Type >::ToCString ( ) const
    inlinenoexcept

    Returns NULL-terminated Unicode string. Should not be modified or deleted!

    Returns
    (const Type* ) pointer to string

    ◆ ToLocale()

    template<typename Type>
    bool NCollection_UtfString< Type >::ToLocale ( char * theBuffer,
    const int theSizeBytes ) const

    Converts the string into string in the current system locale.

    Parameters
    theBufferoutput buffer
    theSizeBytesbuffer size in bytes
    Returns
    true on success

    ◆ ToUtf16()

    template<typename Type>
    const NCollection_UtfString< char16_t > NCollection_UtfString< Type >::ToUtf16 ( ) const
    Returns
    copy in UTF-16 format

    ◆ ToUtf32()

    template<typename Type>
    const NCollection_UtfString< char32_t > NCollection_UtfString< Type >::ToUtf32 ( ) const
    Returns
    copy in UTF-32 format

    ◆ ToUtf8()

    template<typename Type>
    const NCollection_UtfString< char > NCollection_UtfString< Type >::ToUtf8 ( ) const
    Returns
    copy in UTF-8 format

    ◆ ToUtfWide()

    template<typename Type>
    const NCollection_UtfString< wchar_t > NCollection_UtfString< Type >::ToUtfWide ( ) const
    Returns
    copy in wide format (UTF-16 on Windows and UTF-32 on Linux)

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