Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Public Member Functions
NCollection_UtfIterator< Type > Class Template Reference

Template class for Unicode strings support. More...

#include <NCollection_UtfIterator.hxx>

Public Member Functions

 NCollection_UtfIterator (const Type *theString)
 Constructor.
 
void Init (const Type *theString)
 Initialize iterator within specified NULL-terminated string.
 
NCollection_UtfIteratoroperator++ ()
 Pre-increment operator. Reads the next unicode symbol. Notice - no protection against overrun!
 
NCollection_UtfIterator operator++ (int)
 Post-increment operator. Notice - no protection against overrun!
 
constexpr bool operator== (const NCollection_UtfIterator &theRight) const noexcept
 Equality operator.
 
constexpr bool IsValid () const noexcept
 Return true if Unicode symbol is within valid range.
 
constexpr char32_t operator* () const noexcept
 Dereference operator.
 
constexpr const Type * BufferHere () const noexcept
 Buffer-fetching getter.
 
Type * ChangeBufferHere () noexcept
 Buffer-fetching getter. Dangerous! Iterator should be reinitialized on buffer change.
 
constexpr const Type * BufferNext () const noexcept
 Buffer-fetching getter.
 
constexpr int Index () const noexcept
 
int AdvanceBytesUtf8 () const
 
int AdvanceBytesUtf16 () const
 
int AdvanceCodeUnitsUtf16 () const
 
constexpr int AdvanceBytesUtf32 () const noexcept
 
charGetUtf8 (char *theBuffer) const
 Fill the UTF-8 buffer within current Unicode symbol. Use method AdvanceUtf8() to allocate buffer with enough size.
 
unsigned charGetUtf8 (unsigned char *theBuffer) const
 
char16_tGetUtf16 (char16_t *theBuffer) const
 Fill the UTF-16 buffer within current Unicode symbol. Use method AdvanceUtf16() to allocate buffer with enough size.
 
char32_tGetUtf32 (char32_t *theBuffer) const
 Fill the UTF-32 buffer within current Unicode symbol. Use method AdvanceUtf32() to allocate buffer with enough size.
 
template<typename TypeWrite >
int AdvanceBytesUtf () const
 
template<typename TypeWrite >
TypeWriteGetUtf (TypeWrite *theBuffer) const
 Fill the UTF-** buffer within current Unicode symbol. Use method AdvanceUtf**() to allocate buffer with enough size.
 

Detailed Description

template<typename Type>
class NCollection_UtfIterator< Type >

Template class for Unicode strings support.

It defines an iterator and provide correct way to read multi-byte text (UTF-8 and UTF-16) and convert it from one to another. The current value of iterator is returned as UTF-32 Unicode symbol.

Here and below term "Unicode symbol" is used as synonym of "Unicode code point".

Constructor & Destructor Documentation

◆ NCollection_UtfIterator()

template<typename Type >
NCollection_UtfIterator< Type >::NCollection_UtfIterator ( const Type * theString)
inline

Constructor.

Parameters
theStringbuffer to iterate

Member Function Documentation

◆ AdvanceBytesUtf()

template<typename Type >
template<typename TypeWrite >
int NCollection_UtfIterator< Type >::AdvanceBytesUtf ( ) const
inline
Returns
the advance in TypeWrite chars needed to store current symbol

◆ AdvanceBytesUtf16()

template<typename Type >
int NCollection_UtfIterator< Type >::AdvanceBytesUtf16 ( ) const
Returns
the advance in bytes to store current symbol in UTF-16. 0 means an invalid symbol; 2 bytes is a general case; 4 bytes for surrogate pair.

◆ AdvanceBytesUtf32()

template<typename Type >
constexpr int NCollection_UtfIterator< Type >::AdvanceBytesUtf32 ( ) const
inlineconstexprnoexcept
Returns
the advance in bytes to store current symbol in UTF-32. Always 4 bytes (method for consistency).

◆ AdvanceBytesUtf8()

template<typename Type >
int NCollection_UtfIterator< Type >::AdvanceBytesUtf8 ( ) const
Returns
the advance in bytes to store current symbol in UTF-8. 0 means an invalid symbol; 1-4 bytes are valid range.

◆ AdvanceCodeUnitsUtf16()

template<typename Type >
int NCollection_UtfIterator< Type >::AdvanceCodeUnitsUtf16 ( ) const
Returns
the advance in bytes to store current symbol in UTF-16. 0 means an invalid symbol; 1 16-bit code unit is a general case; 2 16-bit code units for surrogate pair.

◆ BufferHere()

template<typename Type >
constexpr const Type * NCollection_UtfIterator< Type >::BufferHere ( ) const
inlineconstexprnoexcept

Buffer-fetching getter.

◆ BufferNext()

template<typename Type >
constexpr const Type * NCollection_UtfIterator< Type >::BufferNext ( ) const
inlineconstexprnoexcept

Buffer-fetching getter.

◆ ChangeBufferHere()

template<typename Type >
Type * NCollection_UtfIterator< Type >::ChangeBufferHere ( )
inlinenoexcept

Buffer-fetching getter. Dangerous! Iterator should be reinitialized on buffer change.

◆ GetUtf()

template<typename Type >
template<typename TypeWrite >
TypeWrite * NCollection_UtfIterator< Type >::GetUtf ( TypeWrite * theBuffer) const
inline

Fill the UTF-** buffer within current Unicode symbol. Use method AdvanceUtf**() to allocate buffer with enough size.

Parameters
theBufferbuffer to fill
Returns
new buffer position (for next char)

◆ GetUtf16()

template<typename Type >
char16_t * NCollection_UtfIterator< Type >::GetUtf16 ( char16_t * theBuffer) const

Fill the UTF-16 buffer within current Unicode symbol. Use method AdvanceUtf16() to allocate buffer with enough size.

Parameters
theBufferbuffer to fill
Returns
new buffer position (for next char)

◆ GetUtf32()

template<typename Type >
char32_t * NCollection_UtfIterator< Type >::GetUtf32 ( char32_t * theBuffer) const

Fill the UTF-32 buffer within current Unicode symbol. Use method AdvanceUtf32() to allocate buffer with enough size.

Parameters
theBufferbuffer to fill
Returns
new buffer position (for next char)

◆ GetUtf8() [1/2]

template<typename Type >
char * NCollection_UtfIterator< Type >::GetUtf8 ( char * theBuffer) const

Fill the UTF-8 buffer within current Unicode symbol. Use method AdvanceUtf8() to allocate buffer with enough size.

Parameters
theBufferbuffer to fill
Returns
new buffer position (for next char)

◆ GetUtf8() [2/2]

template<typename Type >
unsigned char * NCollection_UtfIterator< Type >::GetUtf8 ( unsigned char * theBuffer) const

◆ Index()

template<typename Type >
constexpr int NCollection_UtfIterator< Type >::Index ( ) const
inlineconstexprnoexcept
Returns
the index displacement from iterator initialization (first symbol has index 0)

◆ Init()

template<typename Type >
void NCollection_UtfIterator< Type >::Init ( const Type * theString)
inline

Initialize iterator within specified NULL-terminated string.

◆ IsValid()

template<typename Type >
constexpr bool NCollection_UtfIterator< Type >::IsValid ( ) const
inlineconstexprnoexcept

Return true if Unicode symbol is within valid range.

◆ operator*()

template<typename Type >
constexpr char32_t NCollection_UtfIterator< Type >::operator* ( ) const
inlineconstexprnoexcept

Dereference operator.

Returns
the UTF-32 codepoint of the symbol currently pointed by iterator.

◆ operator++() [1/2]

template<typename Type >
NCollection_UtfIterator & NCollection_UtfIterator< Type >::operator++ ( )
inline

Pre-increment operator. Reads the next unicode symbol. Notice - no protection against overrun!

◆ operator++() [2/2]

Post-increment operator. Notice - no protection against overrun!

◆ operator==()

template<typename Type >
constexpr bool NCollection_UtfIterator< Type >::operator== ( const NCollection_UtfIterator< Type > & theRight) const
inlineconstexprnoexcept

Equality operator.


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