Logo Search packages:      
Sourcecode: icu version File versions  Download package

int32_t UnicodeString::toUTF32 ( UChar32 utf32,
int32_t  capacity,
UErrorCode errorCode 
) const

Convert the UnicodeString to UTF-32. Unpaired surrogates are replaced with U+FFFD. Calls u_strToUTF32WithSub().

Parameters:
utf32 destination string buffer, can be NULL if capacity==0
capacity the number of UChar32s available at utf32
errorCode Standard ICU error code. Its input value must pass the U_SUCCESS() test, or else the function returns immediately. Check for U_FAILURE() on output or use with function chaining. (See User Guide for details.)
Returns:
The length of the UTF-32 string.
See also:
fromUTF32 ICU 4.2

Definition at line 878 of file unistr.cpp.

References getBuffer(), length(), NULL, and U_SUCCESS.

                                                                                    {
  int32_t length32=0;
  if(U_SUCCESS(errorCode)) {
    // getBuffer() and u_strToUTF32WithSub() check for illegal arguments.
    u_strToUTF32WithSub(utf32, capacity, &length32,
        getBuffer(), length(),
        0xfffd,  // Substitution character.
        NULL,    // Don't care about number of substitutions.
        &errorCode);
  }
  return length32;
}


Generated by  Doxygen 1.6.0   Back to index