void U_EXPORT2 Normalizer::normalize(const UnicodeString& source, UNormalizationMode mode, int32_t options, UnicodeString& result, UErrorCode &status) { if(source.isBogus() || U_FAILURE(status)) { result.setToBogus(); if(U_SUCCESS(status)) { status=U_ILLEGAL_ARGUMENT_ERROR; } } else { UnicodeString localDest; UnicodeString *dest; if(&source!=&result) { dest=&result; } else { // the source and result strings are the same object, use a temporary one dest=&localDest; } const Normalizer2 *n2=Normalizer2Factory::getInstance(mode, status); if(U_SUCCESS(status)) { if(options&UNORM_UNICODE_3_2) { FilteredNormalizer2(*n2, *uniset_getUnicode32Instance(status)). normalize(source, *dest, status); } else { n2->normalize(source, *dest, status); } } if(dest==&localDest && U_SUCCESS(status)) { result=*dest; } } }
UnicodeString & U_EXPORT2 Normalizer::concatenate(UnicodeString & left, UnicodeString & right, UnicodeString & result, UNormalizationMode mode, int32_t options, UErrorCode & errorCode) { if (left.isBogus() || right.isBogus() || U_FAILURE(errorCode)) { result.setToBogus(); if (U_SUCCESS(errorCode)) { errorCode = U_ILLEGAL_ARGUMENT_ERROR; } } else { UnicodeString localDest; UnicodeString * dest; if (&right != &result) { dest = &result; } else { // the right and result strings are the same object, use a temporary one dest = &localDest; } *dest = left; const Normalizer2 * n2 = Normalizer2Factory::getInstance(mode, errorCode); if (U_SUCCESS(errorCode)) { if (options & UNORM_UNICODE_3_2) { FilteredNormalizer2(*n2, *uniset_getUnicode32Instance(errorCode)). append(*dest, right, errorCode); } else { n2->append(*dest, right, errorCode); } } if (dest == &localDest && U_SUCCESS(errorCode)) { result = *dest; } } return result; }
UBool Normalizer::isNormalized(const UnicodeString& source, UNormalizationMode mode, int32_t options, UErrorCode &status) { const Normalizer2 *n2=Normalizer2Factory::getInstance(mode, status); if(U_SUCCESS(status)) { if(options&UNORM_UNICODE_3_2) { return FilteredNormalizer2(*n2, *uniset_getUnicode32Instance(status)). isNormalized(source, status); } else { return n2->isNormalized(source, status); } } else { return FALSE; } }
UNormalizationCheckResult Normalizer::quickCheck(const UnicodeString& source, UNormalizationMode mode, int32_t options, UErrorCode &status) { const Normalizer2 *n2=Normalizer2Factory::getInstance(mode, status); if(U_SUCCESS(status)) { if(options&UNORM_UNICODE_3_2) { return FilteredNormalizer2(*n2, *uniset_getUnicode32Instance(status)). quickCheck(source, status); } else { return n2->quickCheck(source, status); } } else { return UNORM_MAYBE; } }