// ----------------------------------------------------------------------------- // JPLangUtil::ConvertFullHiragnaToFullKatakana // Converts Full-width Hiragana and Special Character text found in // aUnicodeSource to their Full-width counterparts and places the // resulting text into aUnicodeTarget. // ----------------------------------------------------------------------------- // EXPORT_C TInt JPLangUtil::ConvertFullHiragnaToFullKatakana ( const TDesC16& aUnicodeSource, TDes16& aUnicodeTarget ) { TInt totalConverted( 0 ); const TInt length( aUnicodeSource.Length() ); const TInt maxLength( aUnicodeTarget.MaxLength() ); if( length > maxLength ) { return KErrTooBig; } const TUint comp = KFullWidthKatakanaSmallA - KFullWidthHiraganaSmallA; aUnicodeTarget.Zero(); for( TInt i( 0 ); i < length; ++i ) { const TText uniChar( aUnicodeSource[i] ); TText uniChar2(0); if (i + 1 < length) { uniChar2 = aUnicodeSource[i+1]; } // First check if this is this Full Width Katakana if (KFullWidthHiraganaSmallA <= uniChar && uniChar <= KFullWidthHiraganaVU) { if (uniChar == KFullWidthHiraganaU && uniChar2 == KFullWidthHiraganaVoicedSound) { aUnicodeTarget.Append(KFullWidthKatakanaSmallVU); totalConverted++; i++; } else { TUint katakana = uniChar + comp; if (IsKatakana(katakana)) { aUnicodeTarget.Append(katakana); totalConverted++; } } } else { aUnicodeTarget.Append(uniChar); totalConverted++; } } // Now handle special characters // This logic may be moved into this function to avoid another loop over // the text totalConverted += UnicodeTextUtil::ConvertSpecialCharactersInPlace( EFullToHalfWidth, aUnicodeTarget ); return totalConverted; }
int IsJap(wchar_t c) { return (IsHiragana(c) || IsKatakana(c) || IsKanji(c) || IsHalfWidthKatakana(c)); }